PDA

View Full Version : Routine to change Attributes color to Bylayer not working in AutoCAD 2008



framedNlv
2007-04-30, 10:52 PM
This is one for changing attributes to color bylayer. I got it ether here or on Autodesk forums.
1.

(if (ssget "x" '((0 . "INSERT")(66 . 1)))
(progn
(setq ss (vla-get-activeselectionset
(vla-get-activedocument
(vlax-get-acad-object))))
(vlax-for blk ss
(setq atts (vlax-invoke blk 'getattributes))
(foreach att atts
(vla-put-color att 256)
)
)
)
)
2nd


(setq doc (vla-get-activeDocument (vlax-get-acad-object))
layouts (vla-get-layouts doc)
)
(vlax-for layout layouts
(vla-put-showPlotStyles layout (if state :vlax-true :vlax-false))
)
;(vla-regen doc acAllViewports)

Any help to make it work again would be greatly appreciated.
Chris

Mike_R
2007-05-01, 01:23 PM
This is now done natively in 2008 with the Setbylayer command.

framedNlv
2007-05-01, 03:42 PM
This is now done natively in 2008 with the Setbylayer command.
I read about that on one of the blogs somewhere but could find any reference to it once we install 2008.

Thanks,
Chris

Tom Beauford
2007-05-02, 01:08 PM
I read about that on one of the blogs somewhere but could find any reference to it once we install 2008.

Thanks,
ChrisFrom the Menu:
Modify => Change to Bylayer

ccowgill
2007-05-03, 11:18 AM
From the Menu:
Modify => Change to Bylayer
or type setbylayer

framedNlv
2007-05-03, 04:15 PM
Thank you guys for pointing out the "setbylayer" feature.

I was wondering why the original lisp was failing. I have about three different lisp routines that are failing and they all use the vla/vlax in the lisp.


Chris

Tom Beauford
2007-05-03, 04:20 PM
Thank you guys for pointing out the "setbylayer" feature.

I was wondering why the original lisp was failing. I have about three different lisp routines that are failing and they all use the vla/vlax in the lisp.


ChrisI'm sure someone could debug it if you posted the whole routine.

ccowgill
2007-05-04, 11:53 AM
i would also make sure you have vl-load-com in your commands

framedNlv
2007-05-04, 04:26 PM
(VL-LOAD-COM)

That seems to have fixed it. I'll have to look at my startup lisp to see where it was loading and where I stopped loading it. For now I just added it to the beginning of our acad.lsp.

Thanks,
Chris

Opie
2007-05-04, 05:03 PM
(VL-LOAD-COM)

That seems to have fixed it. I'll have to look at my startup lisp to see where it was loading and where I stopped loading it. For now I just added it to the beginning of our acad.lsp.

Thanks,
Chris
It is only needed to be loaded once. Subsequent calls do not affect anything.

abdulhuck
2007-05-06, 08:18 AM
(VL-LOAD-COM)

That seems to have fixed it. I'll have to look at my startup lisp to see where it was loading and where I stopped loading it. For now I just added it to the beginning of our acad.lsp.

Thanks,
Chris
Chris,

There is no harm if you add (vl-load-com) in your individual lisp routines which utilize the com interface, especially if others are also using these routines, you can make sure that it is loaded. As Opie said, once if it is loaded, it ignores subsequent calls.

Regards
Abdul Huck