Jump to content

Match layer to what I'm snapping to?


eturner

Recommended Posts

Is there a way for a new line I'm drawing to automatically match properties to the line I've snapped to? Often times the item holding me back from working quicker is changing the layers around quickly. Not sure if this is a company lisp command or ACAD, but I do use "SL" to set the layer, which is relatively quick, but it would be much nicer if autocad would just know that if I'm snapping to something, 99% of the time I want the new line to be the same layer...

 

is that an option anywhere?

thanks!!

 

Erik

Link to comment
Share on other sites

Theres a program that allows you pick an object and make a new object with the same characteristics layer color etc

 

I downloaded it from here but can not remember what it was called so I have pasted it here

 

; matches pick object for next command plus layer
(defun c:ZZZ (/ 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 nil) (PropMatch Obj (entlast)))
         ((eq "LWPOLYLINE" typ)
          (comInv "pline" nil) (PropMatch Obj (entlast)))
         ((eq "LINE" typ)
          (setq lEnt (entlast))
          (comInv typ nil)
          (foreach ent (EntCol (if lEnt lEnt (entlast)))
            (PropMatch Obj ent)))
         ((eq "HATCH" typ)
          (setq lEnt (entlast))
          (comInv typ t)
          (if (not (eq lEnt (entlast)))
            (PropMatch Obj (entlast))))
         ((eq "VIEWPORT" typ)
          (setq lEnt (entlast))
          (comInv "-vports" nil)
          (if (not (eq lEnt (entlast)))
            (PropMatch Obj (entlast))))))
 (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
                 ViewportOn
                 ShadePlot
                 DisplayLocked                  
                 GradientAngle
                 GradientCentered
                 GradientColor1
                 GradientColor2
                 GradientName
                 HatchObjectType
                 HatchStyle
                 ISOPenWidth
                 Origin
                 PatternAngle
                 PatternDouble
                 PatternScale
                 PatternSpace)
   (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 flag)
 (if flag (initdia))
 (command (strcat "_." com))
 (while (eq 1 (logand 1 (getvar "CMDACTIVE")))
   (command pause)))

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...