+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Senior Member
    Using
    AutoCAD 2015
    Join Date
    Jan 2015
    Posts
    136

    Default Get Pline settings as current

    Registered forum members do not see this ad.

    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

  2. #2
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,540

    Default

    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.
    R.K. McSwain
    CAD Panacea | twitter

  3. #3
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,499

    Default

    Try this I do apologise as to where I got it from will work with plines including width.

    Code:
    ; 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.
    A man who never made mistakes never made anything

  4. #4
    Senior Member
    Using
    AutoCAD 2015
    Join Date
    Jan 2015
    Posts
    136

    Default

    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

  5. #5
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,540

    Default

    Quote Originally Posted by MastroLube View Post
    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.
    R.K. McSwain
    CAD Panacea | twitter

  6. #6
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,499

    Default

    Registered forum members do not see this ad.

    A menu entry for a pline may look something like this similar for palette

    Code:
    ^c^c^p-layer s pline3  plinewid 3.0 pline
    A man who never made mistakes never made anything

Similar Threads

  1. Replace current block using current block's attribute
    By Gotrekk in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 19th Apr 2017, 10:29 am
  2. Copy all settings from QNEW template to the current drawing
    By prodromosm in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 20th Dec 2015, 04:27 pm
  3. Current Dim Style Settings ( LEADER SETTINGS)
    By wimal in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 22nd Jun 2013, 03:13 pm
  4. Anything (BLOCK, LINE, PLINE, TEXT, MTEXT) Align to LINE, PLINE
    By cadamrao in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 21st Jun 2010, 02:53 pm
  5. 3D settings vs. classic settings
    By kmapro in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 6th Aug 2007, 03:14 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts