;Get the AutoCAD Object
(setq acadObject (vlax-get-acad-object))
;Get the Document Object
(setq acadDocument (vla-get-ActiveDocument acadObject))
;Get the Layer Collection from the Active Document
(setq LayerCollection (vla-get-layers acadDocument))
(setq Character1 "NewLayer")
;Create layer, where 'Character1' holds the value for the layername
(vla-add LayerCollection Character1)
This works fine. Now...
How can I assign the color and linetype of this layer?
Warren M
(setq Layer (vla-item LayerCollection "NewLayer"))
Then you would just do this:
(vla-Put-Color Layer <color>)
(vla-Put-Linetype Layer <Linetype>)
Without checking the help, I can't tell you if
<Linetype> is a linetype object, or the name of
a linetype, because many of the ActiveX methods
that reference items by name, are incorrectly
named (e.g., The "Layer" property of entities
should be the "LayerName" property, since the
data type is not a layer object, but the name
of a layer).
It's all those little things, ya know.... :-)
--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.t...@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
Warren Medernach
Tony Tanzillo wrote:
> I'm not sure if (vla-add) returns the new layer or
> not, but if it doesn't, then you would get it with:
>
> (setq Layer (vla-item LayerCollection "NewLayer"))
>
> Then you would just do this:
>
> (vla-Put-Color Layer <color>)
> (vla-Put-Linetype Layer <Linetype>)
>
> Without checking the help, I can't tell you if
> <Linetype> is a linetype object, or the name of
> a linetype, because many of the ActiveX methods
> that reference items by name, are incorrectly
> named (e.g., The "Layer" property of entities
> should be the "LayerName" property, since the
> data type is not a layer object, but the name
> of a layer).
>
> It's all those little things, ya know.... :-)
>