PDA

View Full Version : Qselct and change layer scripts



Spinxy
4th Aug 2011, 07:15 am
Hey,

I'm trying to make some scripts that will automatically find certain elements from a qselect and change their layers and properties.

i'm trying ssx command which finds the elements but don't keep them selected, i'm also struggling with a command to change the layers, and set colour, linetype and lineweight to bylayer

i have lots of these to make which will all be pretty similar to automate track design outputs into our cad standard format.

i want to find everything on layer T-PROF-GRID and change to G_misc25, color to BYLAYER, Lintype to BYLAYER, Lineweight to BYLAYER.

also i want to find every polyline on T-PROF-TEXT and change to G_misc, color to BYLAYER, Lintype to BYLAYER, Lineweight to BYLAYER.

if i have help creating these i'm pretty sure i would figure out how to do the rest!

MSasu
4th Aug 2011, 07:39 am
Since seems that you are using AutoCAD full, you can solve that by AutoLISP:


(setq ItemsSet (ssget "_X" '((8 . "T-PROF-GRID"))))
(if ItemsSet (command "_CHPROP" ItemsSet "" "_LA" "G_misc25" "_C" "_ByLayer" "_LT" "_ByLayer" "_LW" "_ByLayer" ""))
(setq ItemsSet (ssget "_X" '((0 . "LWPOLYLINE") (8 . "T-PROF-TEXT"))))
(if ItemsSet (command "_CHPROP" ItemsSet "" "_LA" "G_misc" "_C" "_ByLayer" "_LT" "_ByLayer" "_LW" "_ByLayer" ""))

Regards,
Mircea

Spinxy
4th Aug 2011, 07:52 am
Sorry real basic question, i haven't run lisp for a while, how do i run this?

MSasu
4th Aug 2011, 08:08 am
There used to be a FAQ page on this subject - but I'm not able to locate it now. Please check this tutorial (http://lee-mac.com/runlisp.html) from LeeMac.

Regards,
Mircea