need a macro to offset a rectangle twice & change layers of the 2 new objects

need a macro to offset a rectangle twice & change layers of the 2 new objects

Anonymous
Not applicable
944 Views
5 Replies
Message 1 of 6

need a macro to offset a rectangle twice & change layers of the 2 new objects

Anonymous
Not applicable

I need a macro/script to offset a rectangle (by .0625") twice & then change layer of the 2 new objects & do a little trimming/extending. can this all be done in one macro/script/tool button? below is an example of what i need the finished product to look like. using autocad 2021top rectangle shows desired offset linestop rectangle shows desired offset lines

0 Likes
945 Views
5 Replies
Replies (5)
Message 2 of 6

pendean
Community Legend
Community Legend
Are you stuck in the LT version of AutoCAD? that's about the only time folks ask for a macro or script to do what you want.

BTW are you aware OFFSET command has a LAYER option? Explore it in HELP.
0 Likes
Message 3 of 6

Anonymous
Not applicable

I'm not using LT, but others in the office are. I'm trying to make a tool button to quicken the process of creating these offset lines....i am aware the offset command has a layer option...here is what I've come up with so far... [^C^C_chprop;\;ltscale;1;;_LAYER;set;hidden;;Offset;l;current;.0625;\\\\;^C^C_chprop;l;\LA;LTLINES;;Offset;L;S;;;X;\;X;\;^C^C_EX;;\ ] it does most of what i want until it gets to the extend function & it just quits.

0 Likes
Message 4 of 6

pendean
Community Legend
Community Legend
You probably should be posting in the LT forum then if you are trying to cater to the LT users at your office: do you still want to keep your post here for a LISP option for non-LT users?

The dedicated LT forum is over here https://forums.autodesk.com/t5/autocad-lt/ct-p/2000
Message 5 of 6

Anonymous
Not applicable

nah, I only have 2 non LT users. Not worth it. Thanks tho!

0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

...here is what I've come up with so far... [^C^C_chprop;\;ltscale;1;;_LAYER;set;hidden;;Offset;l;current;.0625;\\\\;^C^C_chprop;l;\LA;LTLINES;;Offset;L;S;;;X;\;X;\;^C^C_EX;;\ ] it does most of what i want until it gets to the extend function & it just quits.


 

It looks to me like some of the ; and \ elements are not correct.  I'm thinking something like [untested]:

^C^C_chprop;\;ltscale;1;;_LAYER;set;hidden;;Offset;l;current;.0625;\\\\;_chprop;l;;LA;LTLINES;;Offset;L;S;;\\;X;\\;_EX;;

 

The red ; is to complete object selection  in the CHPROP command.  The blue \\ is to pick an object to OFFSET and the side [but see below].  The magenta \\ combines selection of two things to EXPLODE into one  command, instead of two.

 

I also removed some ^C^C cancels along the way -- if everything else is formatted correctly, commands will be completed, and you don't need those.  And I took the last \ off the end -- it should just leave you in the command with all objects as boundaries, to pick things as desired -- no need to explicitly put in a character for only the first selection.

 

Your first group of four \\\\ allows for two  Offsets.  I assume you are starting with a Polyline rectangle, Offsetting it twice, and later Exploding those for the Extending part.  But then I'm confused about what the later Offset command is for -- can that be omitted?

 

Of course, all of this depends on the User never missing in a pick, and understanding what to pick when and to which side to Offset things.  An advantage of an AutoLisp routine is that it can include controls for at least some such considerations.

Kent Cooper, AIA
0 Likes