designerstuart Posted June 24, 2010 Posted June 24, 2010 trying to learn lisp..... got hundreds of objects in front of me all need new origins for their hatch anyone tell me how to write lisp that follows command: -hatchedit origin set new origin then i can just hit enter and click each one (x 100s!) thanks Quote
lpseifert Posted June 24, 2010 Posted June 24, 2010 I'd probably approach it by making a selection set of the hatches with (ssget...) then iterate through each member of the selection set using (command "-hatchedit"...) or (vlax-put-property obj 'Origin...) speak up if you need more help than that Quote
rkmcswain Posted June 24, 2010 Posted June 24, 2010 If you are wanting to set the same origin for all, just select them and set it in ._Properties Quote
lpseifert Posted June 24, 2010 Posted June 24, 2010 Listen to Mr. McSwain's advise... a lisp isn't needed for every task in Autocad. Quote
designerstuart Posted June 24, 2010 Author Posted June 24, 2010 @ rkmcswain no, sorry more complex than that! i got 100 hatches, want to individually assign (by "select new origin" clicking method) new origins for each one. i figure a routine which allows me to have a single command, then click point for each at least reduces my work by severl hundred clicks a drawing! thanks keep it coming....... Quote
designerstuart Posted June 24, 2010 Author Posted June 24, 2010 I'd probably approach it by making a selection set of the hatches with (ssget...) then iterate through each member of the selection set using (command "-hatchedit"...) or (vlax-put-property obj 'Origin...) don't quite get this.... to illustrate my newbism, why does this sort of thing not work? (defun c:hatcho() command "-hatchedit" "origin" "set new origin" ) a macro would also be fine.... any one-click option greatly accepted! thanks Quote
alanjt Posted June 24, 2010 Posted June 24, 2010 Follow along with the exact prompts from the command. eg. Command: -HATCHEDIT Select hatch object: Enter hatch option [DIsassociate/Style/Properties/DRaw order/ADd boundaries/Remove boundaries/recreate Boundary/ASsociate/separate Hatches/Origin/ANnotative] <Properties>: ORIGIN [use current origin/Set new origin/Default to boundary extents] <Default to boundary extents>: S Select point: Store as default origin? [Yes/No] <N>: Quote
designerstuart Posted June 24, 2010 Author Posted June 24, 2010 @ alanjt thanks so now i realise why mine doesn't work - i can't click mid-way through the routine i made. so now, is there a way to do this that works? thanks for your prompt replies! Quote
rkmcswain Posted June 24, 2010 Posted June 24, 2010 @ rkmcswainno, sorry more complex than that! i got 100 hatches, want to individually assign (by "select new origin" clicking method) new origins for each one. i figure a routine which allows me to have a single command, then click point for each at least reduces my work by severl hundred clicks a drawing! thanks keep it coming....... Understood, but I wanted to ask since your original question was not clear. i can't click mid-way through the routine i made. Well, actually you could if you included a pause, but that defeats the purpose, since you would have to pick a point for each one. It looks like to me that you would have to calculate a new origin based on the boundary of each hatch object because the 'origin' property expects a point, not a setting like "center", or "bottom left". Are you wanting to set a specific point relative to each hatch object or just somewhere in the vicinity of the hatch? Quote
alanjt Posted June 24, 2010 Posted June 24, 2010 You could take the midpoint from the bounding box (vla-getboundingbox obj). Then again, you could just take one of the two bounding box points. Either could be used to change the origin point. What's the purpose of changing the origin point? Quote
rkmcswain Posted June 24, 2010 Posted June 24, 2010 You could take the midpoint from the bounding box (vla-getboundingbox obj). Then again, you could just take one of the two bounding box points. Yea, that is what I was thinking - unless the requirement is that the origin be the "lower left" corner (or something like that...) - in which case, you would have to figure out what that point is before you could apply it. What's the purpose of changing the origin point? My guess is that maybe it's a brick/tile pattern that needs to start at a certain corner... Quote
alanjt Posted June 24, 2010 Posted June 24, 2010 Yea, that is what I was thinking - unless the requirement is that the origin be the "lower left" corner (or something like that...) - in which case, you would have to figure out what that point is before you could apply it. My guess is that maybe it's a brick/tile pattern that needs to start at a certain corner... Ahh, OK. The only the I ever really worry with on the origin is making sure my my concrete hatch doesn't get screwed up from being in state plane coordinates. Quote
designerstuart Posted June 25, 2010 Author Posted June 25, 2010 My guess is that maybe it's a brick/tile pattern that needs to start at a certain corner... actually no it's a ceiling grid layout, but the tiles have been randomly placed and cannot be changed. my drawing has a load of new hatches, all with origin 0,0. so now i have to select each one, and manually tell it where it's origin should be. this cannot be formulated, only option is to specify each with a click...... just as you mention here: Well, actually you could if you included a pause, but that defeats the purpose, since you would have to pick a point for each one. i think i need to include a pause, just like you say here. would it be too much trouble for someone to write out the code with this pause please? to recap i think i need: -hatchedit origin select new origin <click to secify> no and i think that is all! thanks you guys for your perseverence. Quote
rkmcswain Posted June 25, 2010 Posted June 25, 2010 i think i need to include a pause, just like you say here. would it be too much trouble for someone to write out the code with this pause please? How about something like this? (defun C:NewOrg ( / ent pt1) (while (setq ent (car (entsel "\nSelect HATCH: "))) (setq pt1 (getpoint "\nSelect new Origin: ")) (command "._hatchedit" ent "_O" "_S" pt1 "_N") ) (princ) ) Note that is very basic, no error checking, etc. Quote
designerstuart Posted June 25, 2010 Author Posted June 25, 2010 THAT'S GREAT THANKS WORKS PERFECTLY (sorry bout the caps - didn't mean to shout!) :-) Quote
designerstuart Posted June 29, 2010 Author Posted June 29, 2010 .... and another thing ... could someone please explain a bit how it works? as in, what does each line do? i'd like to learn, if it's not a problem would be great. thanks! (defun C:NewOrg ( / ent pt1) (while (setq ent (car (entsel "\nSelect HATCH: "))) (setq pt1 (getpoint "\nSelect new Origin: ")) (command "._hatchedit" ent "_O" "_S" pt1 "_N") ) (princ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.