View Full Version : change all entities to default settings
james.126519
2008-07-17, 05:36 PM
I have numerous files not created internally that I need to incorporate into a set of drawings, but the layers are all screwed up. Is there a code that will assign each entity's color, lineweight and linetype to "by layer", including all entities within all of the blocks attached to the drawing?
its so irritating having to deal with some peoples useless CAD files! lol
michel.t
2008-07-17, 07:21 PM
if you are on AutoCAD 2008, just type « setbylayer »
I have numerous files not created internally that I need to incorporate into a set of drawings, but the layers are all screwed up. Is there a code that will assign each entity's color, lineweight and linetype to "by layer", including all entities within all of the blocks attached to the drawing?
its so irritating having to deal with some peoples useless CAD files! lol
'gile'
2008-07-17, 07:36 PM
Hi,
Here's a little routine, all Layers have to be unlocked
(vl-load-com)
(vlax-for blk (vla-get-Blocks
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
(vlax-for obj blk
(mapcar
(function
(lambda (prop val)
(if (vlax-property-available-p obj prop T)
(vlax-put obj prop val)
)
)
)
'(Color Linetype Lineweight)
'(256 "ByLayer" -1)
)
)
)
Hi,
Here's a little routine, all Layers have to be unlocked
(vl-load-com)
(vlax-for blk (vla-get-Blocks
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
(vlax-for obj blk
(mapcar
(function
(lambda (prop val)
(if (vlax-property-available-p obj prop T)
(vlax-put obj prop val)
)
)
)
'(Color Linetype Lineweight)
'(256 "ByLayer" -1)
)
)
)
That's SWEET!!
Nice and clean too, I don't do VLISP
It would take a more complicated routine to do this the "old school" way (I think).
Thanks for sharing :beer:
james.126519
2008-07-17, 08:37 PM
if you are on AutoCAD 2008, just type « setbylayer »
you are my favorite person today! lol
why did I not know about that command....that is a huge frustration reducer lol.
thanks a million
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.