Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 3
Anonymous
89 Views, 2 Replies

need lisp

Hi all,

I need a lisp routine that turns line colors in to new layers, so all blue
lines get sent to a new layer called blue and so on, I had it but lost it,
Any help would be much appreciated

Pete
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Hi Pete

Try this program (A2k+)...
It changes object colors and linetypes to layers, eg.:
Object with color blue and linetype Continuous -> 'Col-4_Ltp-Continuous_Ents'


(defun C:ColToLay ( / CurObj CurSet EntCnt EntCol EntLtp LayObj NewLay)
(vl-load-com)
(setq CurSet (ssget)
EntCnt 0
Gb:AcD (cond
(Gb:AcD)
(T (vla-get-activedocument (vlax-get-acad-object)))
)
)
(if Curset
(repeat (sslength CurSet)
(setq CurObj (vlax-ename->vla-object (ssname CurSet EntCnt))
EntCnt (1+ EntCnt)
EntCol (vla-get-Color CurObj)
EntLtp (vla-get-Linetype CurObj)
NewLay (strcat "Col-" (itoa EntCol) "_Ltp-" EntLtp "_Ents")
LayObj (vla-add (vla-get-layers Gb:AcD) NewLay)
)
(vlax-put LayObj "Color" EntCol)
(vla-put-Color CurObj 256)
(if (/= EntLtp "BYLAYER")
(progn
(vlax-put LayObj "Linetype" EntLtp)
(vla-put-Linetype Curobj "BYLAYER")
)
)
(vla-put-Layer CurObj NewLay)
(vla-Update CurObj)
)
)
(princ)
)

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch


Pete Dibbs schrieb:
>
> Hi all,
>
> I need a lisp routine that turns line colors in to new layers, so all blue
> lines get sent to a new layer called blue and so on, I had it but lost it,
> Any help would be much appreciated
>
> Pete
Message 3 of 3
Anonymous
in reply to: Anonymous

Jürg,

Thanks for getting back, saved me, many many thanks

Pete,
"Jürg Menzi" wrote in message
news:3BD71EB0.495DBD1A@bluewin.ch...
> Hi Pete
>
> Try this program (A2k+)...
> It changes object colors and linetypes to layers, eg.:
> Object with color blue and linetype Continuous ->
'Col-4_Ltp-Continuous_Ents'
>
>
> (defun C:ColToLay ( / CurObj CurSet EntCnt EntCol EntLtp LayObj NewLay)
> (vl-load-com)
> (setq CurSet (ssget)
> EntCnt 0
> Gb:AcD (cond
> (Gb:AcD)
> (T (vla-get-activedocument (vlax-get-acad-object)))
> )
> )
> (if Curset
> (repeat (sslength CurSet)
> (setq CurObj (vlax-ename->vla-object (ssname CurSet EntCnt))
> EntCnt (1+ EntCnt)
> EntCol (vla-get-Color CurObj)
> EntLtp (vla-get-Linetype CurObj)
> NewLay (strcat "Col-" (itoa EntCol) "_Ltp-" EntLtp "_Ents")
> LayObj (vla-add (vla-get-layers Gb:AcD) NewLay)
> )
> (vlax-put LayObj "Color" EntCol)
> (vla-put-Color CurObj 256)
> (if (/= EntLtp "BYLAYER")
> (progn
> (vlax-put LayObj "Linetype" EntLtp)
> (vla-put-Linetype Curobj "BYLAYER")
> )
> )
> (vla-put-Layer CurObj NewLay)
> (vla-Update CurObj)
> )
> )
> (princ)
> )
>
> Cheers
> --
> Juerg Menzi
> MENZI ENGINEERING GmbH, Switzerland
> http://www.menziengineering.ch
>
>
> Pete Dibbs schrieb:
> >
> > Hi all,
> >
> > I need a lisp routine that turns line colors in to new layers, so all
blue
> > lines get sent to a new layer called blue and so on, I had it but lost
it,
> > Any help would be much appreciated
> >
> > Pete

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost