.NET

Reply
*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 21 of 22 (81 Views)

Re: ObjectClass is not a member of ObjectID (AutoCAD 2008)

03-26-2013 11:33 PM in reply to: DiningPhilosopher

That is turning my words around to make it bad.

>> CType() is faster than TryCast(), while completely ignoring the fact that

>> ignoring the fact that CType() cannot be used without also calling GetType()

>>    and Equals() or (more correctly) IsAssignableFrom

And TryCast don't need that, wow,  it does then magic things? Come on!

Additionally: I only run CType when I already know from GetType that is can be casted. Your code used TryCast for every ObjectID in the loop while I only use GetType.

 

But right, let us not waste time as you code is correct, as Gile's code is correct and as my revsed code is correct, but it is not like you want to write and so it has to be wrong.

 

You are right that my first attemt with twice calling trans.GetObject is not ok. And all after that hangs up on this first mistake.

I wish you never ever make a mistake and you're correction is then ignored as mine are.

At least for everyone: My apologizes, my first attempt needed two times GetObject (in case of it's the searched type) to get the accessable AttributeDefinition.

 

>> so I'm not going to waste time debating that with you.

Dicuss or debate, I tried to dicuss, yep, I never tried to push that up how it is now.

I always want to learn something, but with that hardness of reaction it is hard.

At least yes, time to stop.

 

To the story from Jeff, animierte smilies lachen grinsen happy freuen smilen witzig froh

...please don't forget the option, that one of your XTypes takes the parcel, brings it to the customer and has to bring it back as it's the wrong type :smileywink:

 

To Jeff's code a short comment,

If "btr" is a BlockTableRecord, then I guess he wanted to check for AttributeDefinition and not AttributeReferences and he works with latebinding, so the assignment from type DbObject to a Type derived from DbObject (AttributeReference in his code) is possible without (any type of) casting.

Interestingly I also wrote AttribtueReferences instead of ...Defintions first :smileywink:

 

 

I'm out then as this seems to not make sense any more and also does not include the fun like help anyone in forums should make. Very sorry, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
SRSDS
Posts: 243
Registered: ‎04-15-2011
Message 22 of 22 (63 Views)

Re: ObjectClass is not a member of ObjectID (AutoCAD 2008)

03-27-2013 10:02 AM in reply to: Alfred.NESWADBA

Thanks all for the extensive comments and advice.

I really appreciate the time you have taken to reply.

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community