.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get the layer of an Entity

3 REPLIES 3
Reply
Message 1 of 4
bolek75
181 Views, 3 Replies

How to get the layer of an Entity

Hi NG,

I fetch an Entity object like this:

Entity ent = (Entity)trans.GetObject(flstObj,OpenMode.ForRead);

and would like to get the name of the layer the entity is on. When calling ent.get_Layer() I get the compiler error, which is something lke this:

Operator or Accessor cannot be called explicit

What to do? Can somebody help? I am using C#.

Regards
bolek75
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: bolek75

Perhaps this :-

string layerName = ent.Layer;


wrote in message news:5024243@discussion.autodesk.com...
Hi NG,

I fetch an Entity object like this:

Entity ent = (Entity)trans.GetObject(flstObj,OpenMode.ForRead);

and would like to get the name of the layer the entity is on. When calling
ent.get_Layer() I get the compiler error, which is something lke this:

Operator or Accessor cannot be called explicit

What to do? Can somebody help? I am using C#.

Regards
bolek75
Message 3 of 4
bolek75
in reply to: bolek75

Hi Kerry,

you are right, it works. But why does the f.. Intellisense of the IDE does not show this property in the list?

Cheers
bolek75
Message 4 of 4
bolek75
in reply to: bolek75

ok, oh right.
I see, the get_ and set_ methods are the accessor-methods which I cant invoke directly. Instead I have to use the property.

Cheers
bolek75

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost