YZ Posted November 20, 2012 Posted November 20, 2012 I have a macro that turns a selected line into a polyline, then gives it a width, then starts the DLINE command at the same width and pauses for user to pick the endpoints of that line. I'm wondering if there is a way that a macro could return the start and end-points of the selected line automatically, rather than the user having to pick them again? So far I have been trying to accomplish this by using the "USERS1" type temporary variables, but they are temperamental and not much is written about them. I would appreciate any ideas (though not LISP). Out of interest, here is the macro: ^C^CMOVE\;0,0,0;0,0,1e99;MOVE;Previous;;0,0,0;0,0,-1e99;SELECT;Previous;;LAYISO;-LAYER;Ltype;PIPELINE;;;SELECT;Previous;;PEDIT;Width;0.100;;-LINETYPE;Set;CONTINUOUS;;DLINE;Width;0.100;'OSMODE;1;\\;OSMODE;39;-LINETYPE;Set;BYLAYER;;LAYUNISO; Quote
BIGAL Posted November 20, 2012 Posted November 20, 2012 If you write it all in lisp would probably be easier (entlast) is just that set a variable to the last entity created then its easy to get start and end pt, if you save these as variables they will be there until you end session, save it somewhere outside Autocad, save it internally user or Xdata, or just overwrite with new value. If you want to save for multi open close external or xdata is way to go. Quote
YZ Posted November 20, 2012 Author Posted November 20, 2012 Thanks BIGAL, you always have comprehensive replies (and it's good to see another Australian on here). This time I am not able to use LISP and will need to persist with macros. I'm checking out Environment Variables, doing some search for the syntax of getenv during a DLINE command. I just discovered you can invoke the command transparently (ie using and apostrophe 'getenv to run that command inside another command where it is normally asking to coordinate input). Quote
YZ Posted December 5, 2012 Author Posted December 5, 2012 Perhaps it will be simpler to ask: Does anyone know a macro method of storing the x value of the start point of a selected line? Quote
YZ Posted December 5, 2012 Author Posted December 5, 2012 I created this macro for easier pipe lines: ^C^CMOVE;\;0,0,0;0,0,1e99;MOVE;Previous;;0,0,0;0,0,-1e99;SELECT;Previous;;LAYISO;-LAYER;Ltype;PIPELINE;;;SELECT;Previous;;PEDIT;Width;1.350;;-LINETYPE;Set;CONTINUOUS;;DLINE;Width;1.350;'OSMODE;1;\\^C^COSMODE;39;-LINETYPE;Set;BYLAYER;;LAYUNISO; It is designed to click button, pick line, pick endpoints of line. The macro changes the selected line so it is coplanar, then gives it the desired polyline width, then draws a DLINE of same width to each endpoint. I am trying to reduce this to one click, so I do not have to click the endpoints, but it can use the properties of the line somehow from the initial selection. Quote
YZ Posted December 9, 2012 Author Posted December 9, 2012 I tried a new approach to this macro that would not require reading the x and y values of a selected line. Instead of the DLINE command I am using CHANGE and OFFSET commands to offset the line in both directions at half the width. Here's the result: ^C^CMOVE;\;0,0,0;0,0,1e99;MOVE;Previous;;0,0,0;0,0,-1e99;SELECT;Previous;;LAYISO;-LAYER;Ltype;PIPELINE;;;^C^CSELECT;PREVIOUS;;CHANGE;Properties;LType;CONTINUOUS;;^C^CSELECT;PREVIOUS;;OFFSET;0.45;-1E99,-1E99;;^C^CSELECT;PREVIOUS;;OFFSET;0.45;1E99,1E99;;^C^CSELECT;Previous;;CHANGE;Properties;LType;ByLayer;;^C^CSELECT;PREVIOUS;;PEDIT;Width;0.900;;^C^CLAYUNISO; I am really happy with this workaround because it has actually made this more robust (DLINE has some bugs when there are lines with common endpoints involved) and I could enhance it to do multiple lines at once. Still, I'm looking for the same concept: a macro to read the DVIEW twist variable, and then return that value during a move command... 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.