Jump to content

Pline Macro with line width


kaziko

Recommended Posts

im working on several macros that allow you to click the ribbon button and start drawing a polyline on a specific layer. The issue I'm having is that the pline width for each macro needs to be different, without setting the default width. Basically I need the default width to stay at 0, and a pline from my macro to have a width of 1, when the macro is finished, the pline width should go back to 0 for future plines. This is what I have so far

^C^Cplinewid;1;-LAYER;S;"UNDERGROUND";^C^C;;_PLINE;\plinewid;0;

 

This works as far as setting the pline width for that particular macro, however the plinewid;0; command at the end seems to not be functioning as the plinewid is remaining at 1.

Link to comment
Share on other sites

My take on your task but using lisp in the ribbon this is the way I would do it in our menus.

 

^c^c(setvar "plinewid" 1)(setvar "clayer" "underground")(command "_pline")(while (= (getvar "cmdactive") 1 ) (command pause))(setvar "plinewid" 0)

 

actually I would auto load this bit as you will repeat for the width

; create pline by picking points press enter when finished
(defun PLAUTO ( )
(command "_pline")
(while (= (getvar "cmdactive") 1 ) (command pause)
)
)

 

^c^c(setvar "plinewid" 1)(plauto)(setvar "plinewid" 0)

 

a bit more 
^c^c(plauto 1 "undergound")
^c^c(plauto 2 "undergound")
^c^c(plauto 3 "undergound")

Link to comment
Share on other sites

All of them ! This shows a couple of different methods you make a lisp plauto.lsp which has all the code in it hence the very simple (plauto 1 "underground") you would add plauto.lsp code to say acaddoc.lsp so it loads automatically. You can even run from command line just type (plauto 3 "ROADWAY")

 

(defun PLAUTO ( width layname / )
(setvar "plinewid" width)
(setvar "clayer" layname)
(command "_pline")
(while (= (getvar "cmdactive") 1 ) (command pause)
)
(setvar "plinewid" 0)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...