Select objects, change layer, turn off other layers and recolor

Select objects, change layer, turn off other layers and recolor

etilley327KA
Advocate Advocate
558 Views
7 Replies
Message 1 of 8

Select objects, change layer, turn off other layers and recolor

etilley327KA
Advocate
Advocate

ACAD 2022

I do this same process tons of times in a day and I'm looking for a way to speed up the process, any help would be very much appreciated. 

Not sure how to write this LISP, but I'm obviously doing something wrong. Ultimately, I'm trying to start LISP, select multiple objects hit enter and then it changes the selected objects to layer "00FORM", double the object size, turn off another layer and change the color of another layer. The current coding doesn't even touch resizing at the moment, but if I could get everything else to work would be great.

 

(defun c:FDERT (SELECT OBJECTS, CHANGE OBJECTS LAYER, TURN OFF LAYER / A)
(princ "\nSelect Points ")
(setq A (ssget))
(vl-cmdf "._change" A "" "_p" "_la" "OOFORM")
(command "_LAYER" "_OFF" "SHOT" "_F" "SHOT"
"_C" "255" "0ELEV,PNTELEV" "")
(princ)
)

0 Likes
559 Views
7 Replies
Replies (7)
Message 2 of 8

ВeekeeCZ
Consultant
Consultant

@etilley327KA wrote:

ACAD 2022

I do this same process tons of times in a day and I'm looking for a way to speed up the process, any help would be very much appreciated. 

Not sure how to write this LISP, but I'm obviously doing something wrong. Ultimately, I'm trying to start LISP, select multiple objects hit enter and then it changes the selected objects to layer "00FORM", double the object size, turn off another layer and change the color of another layer. The current coding doesn't even touch resizing at the moment, but if I could get everything else to work would be great.

 

(defun c:FDERT (SELECT OBJECTS, CHANGE OBJECTS LAYER, TURN OFF LAYER / A)  ; place your note here, behind a semicolon
(princ "\nSelect Points ")
(setq A (ssget))
(vl-cmdf "._change" A "" "_p" "_la" "OOFORM")
(command "_LAYER" "_OFF" "SHOT" "_F" "SHOT"
"_C" "255" "0ELEV,PNTELEV" "")
(princ)
)


 

This is the main issue. That's not a space for a comment.

0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

@etilley327KA wrote:

....

(defun c:FDERT (/ A); (SELECT OBJECTS, CHANGE OBJECTS LAYER, TURN OFF LAYER / A)

(princ "\nSelect Points ")
(setq A (ssget))
(vl-cmdf "._change" A "" "_p" "_la" "OOFORM" ""); <-- and finish the CHANGE command
(command "_LAYER" "_OFF" "SHOT" "_F" "SHOT"
"_C" "255" "0ELEV,PNTELEV" "")
(princ)
)


 

Kent Cooper, AIA
0 Likes
Message 4 of 8

etilley327KA
Advocate
Advocate

Sweet! That seemed to be it, thanks. Any ideas on how I could add resizing to my LISP?

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant

@etilley327KA wrote:

Sweet! That seemed to be it, thanks. Any ideas on how I could add resizing to my LISP?


That can be done, if you have a way of determining a base point around which to Scale them.  You can combine multiple commands in one (command) function [I don't see any reason to use both (vl-cmdf) and (command):

 

(defun c:FDERT (/ A); SELECT OBJECTS, CHANGE OBJECTS LAYER, TURN OFF LAYER

  (princ "\nSelect Points ")
  (setq A (ssget))
  (command

    "._change" A "" "_p" "_la" "OOFORM" ""

    "_.scale" A "" {Your scaling base point} 2

    "_LAYER" "_OFF" "SHOT" "_F" "SHOT" "_C" "255" "0ELEV,PNTELEV" ""

  )
  (princ)
)

Kent Cooper, AIA
0 Likes
Message 6 of 8

etilley327KA
Advocate
Advocate

Thanks so much, how can it pull the base point data for each object.

0 Likes
Message 7 of 8

Kent1Cooper
Consultant
Consultant

You want each object doubled in size separately, not as a group?  You still need to have a base point for each.  If you want them all Scaled about the midpoint of their individual bounding boxes [extents], so they kind of stay where they are, you can use ScaleAboutCenters.lsp with its SAC command, >here<.  I suppose your other operations could be incorporated into a modification of that.

Kent Cooper, AIA
0 Likes
Message 8 of 8

etilley327KA
Advocate
Advocate

Thanks, that's what I'm currently looking at. I'm trying to combine them together so that the data is pulled only once. Not having much luck with it so far.

0 Likes