Jump to content

Create a Temporary Override for "Make Object's Layer Current"


Recommended Posts

Hi all,

I've been using AutoCAD for about 15 years, so I'm pretty familiar w/ most of it's ins and outs. I've been looking for a little faster way of changing the current layer I've on to another way. I've customized the "mouse bottons" in the CUI to "Ctrl+Click" to intialize the "Make Object's Layer Current" command. However, I was wondering if there is a way to make it work more like Photoshop. In Photoshop, when you are using the paint bucket tool and you want to change your color to another color that is already in the picture, you press "Alt+Left Click" to select the color, and when you release the "Alt" button it goes back to the paint bucket and you just color the item you want that color. Similarly, I would like to make AutoCAD do this by using "Ctrl+Left CLick" at any point to change to the layer I'm on to a layer that I select, with out actually intiallizing a command. i could of started a line command or no command, press "Ctrl" and click on the object that I want my current layer switched to and it's done. Hope this is not too confusing. If there's a way to do it in the CUI, I'm ok with that, or even a LISP would work too. THanks for your help.

Mike

Link to post
Share on other sites

Hi StykFace,

Thanks for your reply. That's pretty much the way I've drawn for the last 15 years. However, editing images photoshop or drawing in sketchup, I've found that changing my current material or color during or before I issue a command, in the matter described, is a lot faster than coming back later and matching properties. If I'm able to quickly touch an object, that's on a layer that I want to be current, before I draw a line, then I don't have to come back later and change that line to the desired layer. Thank you for you response.

Mike

Link to post
Share on other sites
tzframpton

You're going to need a customized routine then, I assume. I don't know of a way to do as you are inquiring about right out of the box. Hopefully someone might have something for you in a future post.

 

:)

Link to post
Share on other sites

Theres a lisp that allows you to pick an existing object and basicly starts the correct command to do another with the object properties. I am sure I got it from here but I could not find so here it is again.

 

; 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 post
Share on other sites

Thanks Bigal,

I copied the lisp you posted for me, saved it as a .lsp file into my Autodesk folder on my "C" drive, loaded it, which it loaded successfully, and..... now what do I need to do? I tried starting a line, then "Ctrl+Left Click" and "Ctrl+Right Click" and nothing happens. Was this Lisp a command invoked by a key shroke plus enter? or a custom button macro? I was hoping for something like what I described above. Hold Ctrl down, place aperture over the object that is on the layer I want to switch to, and left click. I don't have to issue a command, Ctrl pauses autocad and tells it I'm about to switch layers, and my next click will be telling it what layer I want to be on for the line I'm fixing to draw, Same with circle, pretty much anything I'm drawing. It's like Photoshop, using the eyedroper to select what color I want to use during the paint bucket command. Thanks for your help.

Link to post
Share on other sites

Its invoked as command like above zzz something simple

 

Others may be able to advise suggestions could put zzz on a function key say F1 or reprogram another key on key board ? reprogram Ctrl+left click maybe.

Link to post
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
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...