Macro to create multiple lines from same base point

Macro to create multiple lines from same base point

Anonymous
Not applicable
3,356 Views
25 Replies
Message 1 of 26

Macro to create multiple lines from same base point

Anonymous
Not applicable

Hi All 

 

having trouble with this macro i created which should draw multiple lines from the same base point .  it works up until the point where i choose the base then when i try to initiate the polyline from the basepoint it fails. It just trys to enter $M= as a point and returns an invlaid point. Can anyone see my mistake here. 

 

^C^CATTREQ;0;_Laymcur;\_INSERT;"Block";\1;1;0;ATTREQ;1;BASE;\;Pline;$M=$(GETVAR,INSBASE);\;Pline;$M=$(GETVAR,insbase);\;Pline;$M=$(GETVAR,insbase);\;Pline;$M=$(GETVAR,insbase);\;Pline;$M=$(GETVAR,insbase);\;

 

 

cheers 

 

Paul 

0 Likes
Accepted solutions (3)
3,357 Views
25 Replies
Replies (25)
Message 21 of 26

h_s_walker
Mentor
Mentor

Ignore what I said script files do not pause for user input.

 

HOWEVER I do have a slight change to Steven's macro. After  it has called the first pline command change all the other pline commands to a semicolon. I did that and created 20 polylines using that method

 

^C^CATTREQ;0;_Laymcur;\_INSERT;"Block";\1;1;0;ATTREQ;1;UCS;\;;pline;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;;;0,0;\;UCS;w;

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 22 of 26

steven-g
Mentor
Mentor

It will depend on what you are seeing, but macros can definately be affected by osnap points, it's counterintuitive but if there is a snap point and your coordinates in a macro are close enough to that point then a macro will snap to that point exactly as it would when you are moving the mouse cursor even though the cursor doesn't move. So in many cases turning osnaps off before running a macro is sensible, or include the word "non" before every coordinate in a macro to stop that behavior.

Message 23 of 26

steven-g
Mentor
Mentor
Accepted solution

Not wishing to be trumped by "Kermit" Smiley Very Happy, and loving a good challenge, I see your 20 plines and raise it to 21 and then without the UCS setting so you can break out with Esc at anytime.

^C^CATTREQ;0;_Laymcur;\_INSERT;"Block";\1;1;0;ATTREQ;1;pline;\\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;;;\c;

Resulting in a saving of 67 characters in the code

 

Message 24 of 26

Anonymous
Not applicable
Thats great guys. Can you explain the "c" part steven-g?
0 Likes
Message 25 of 26

steven-g
Mentor
Mentor
Accepted solution

"C" closes a polyline, so in effect it draws a segment back to the start point, which is handy when you are drawing around areas, in this case it makes the last point entered the base point again, and by entering ";" that restarts the last command (pline) pressing ";" again will start the new pline from the last entered point. The code is a bit tongue in cheek I usually prefer writing out macros using full words rather than the repeat notation";" it is much easier to read and debug the code that way, and in 3 weeks time when you try and change it and have no idea what it all means that really helps.

 

One drawback in doing it this way it actually creates a double "line" but it does trick the system into working. And as a point of note exploding the polylines would result in 2 lines, but selecting all these polylines and changing the properties to open would actually remove that extra segment.

Message 26 of 26

Anonymous
Not applicable
Yes i realised about a minute after i replied what it was 😉, thats great. Its not the end of the world to select the plines and open them once finished.
0 Likes