MastroLube Posted January 18, 2018 Share Posted January 18, 2018 Hi there! A little question.. I'm looking for a command that allow to get the object pline settings (width, layer, color, linetype, and so on) and set as current setting. Have I to write a lisp to do that or autocad has a dedicate command? Thanks! Dennis Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted January 18, 2018 Share Posted January 18, 2018 You can sort of do this by making a tool palette button to make a polyline, and use the settings in the button to set the layer, color, linetype, etc. (You'll have to use a macro to set the WIDTH, unless you just want to set PLINEWID instead). One advantage of using a tool palette button is that the properties are only used for the command and it does NOT override defaults. If you really want to SET and RETAIN settings for layer, color, linetype width, etc. - then yeah, maybe a lisp routine would be best. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 19, 2018 Share Posted January 19, 2018 Try this I do apologise as to where I got it from will work with plines including width. ; copy a object as a command (alert "To run just type CCMD") (defun c:CCMD (/ ent Obj lEnt) (vl-load-com) (while (setq ent (car (nentsel "\nSelect Object: "))) (setq Obj (vlax-ename->vla-object ent) typ (cdr (assoc 0 (entget ent)))) (cond ( (vl-position typ '("CIRCLE" "ARC" "ELLIPSE" "SPLINE" "XLINE")) (comInv typ) (PropMatch Obj (entlast)) ) ((eq "LWPOLYLINE" typ) (comInv "pline") (PropMatch Obj (entlast))) ((eq "LINE" typ) (setq lEnt (entlast)) (comInv typ) (foreach ent (EntCol (if lEnt lEnt (entlast))) (PropMatch Obj ent)))) ) (princ) ) (defun PropMatch (bObj dObj) (or (eq 'VLA-OBJECT (type bObj)) (setq bObj (vlax-ename->vla-object bObj))) (or (eq 'VLA-OBJECT (type dObj)) (setq dObj (vlax-ename->vla-object dObj))) (foreach prop '(Layer Linetype LinetypeScale Color Lineweight constantwidth) (if (and (vlax-property-available-p bObj prop) (vlax-property-available-p dObj prop T)) (vlax-put-property dObj prop (vlax-get-property bObj prop))))) (defun EntCol (x / x) (if (setq x (entnext x)) (cons x (EntCol x)))) (defun comInv (com) (command (strcat "_." com)) (while (eq 1 (logand 1 (getvar "CMDACTIVE"))) (command pause))) PS changed CCMD to ZZZ a bit quicker to type. Quote Link to comment Share on other sites More sharing options...
MastroLube Posted January 24, 2018 Author Share Posted January 24, 2018 Thanks guys! Can you explain a bit better (rkmcswain)? I don't know this function of tool palette button. Sounds interesting Thanks bigal, very good code! I'll add a cycle in order to draw more lines instead of picking for everyone the source. Do you think a (while (1>0) before che command to draw the pline if fine to accomplish that? Thanks, sorry for the late answer Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted January 24, 2018 Share Posted January 24, 2018 Can you explain a bit better (rkmcswain)? I don't know this function of tool palette button. Sounds interesting You can add a command to a tool palette button and then assign properties to the command, such as layer, lineweight, color, etc. When you execute this command, the properties are changed to your desired settings while the command is active, then they return to the previous settings when the command is terminated. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 25, 2018 Share Posted January 25, 2018 A menu entry for a pline may look something like this similar for palette ^c^c^p-layer s pline3 plinewid 3.0 pline Quote Link to comment Share on other sites More sharing options...
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.