Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating layers, assign color and linetype with Vlisp?

1 view
Skip to first unread message

Warren Medernach

unread,
Nov 30, 1998, 3:00:00 AM11/30/98
to
Here's what I have so far to create a layer in VLISP:

;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


Tony Tanzillo

unread,
Nov 30, 1998, 3:00:00 AM11/30/98
to
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.... :-)

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.t...@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/

Warren Medernach

unread,
Nov 30, 1998, 3:00:00 AM11/30/98
to
Thanks again Tony!
That's exactly what I needed, and vla-add does not return the new layer,
so thats where I was hung up.

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.... :-)
>

0 new messages