*Expert Elite*
Posts: 9,384
Registered: ‎06-29-2007
Message 21 of 22 (84 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 -

Ingenieur Studio HOLLAUS ... www.hollaus.at
Posts: 250
Registered: ‎04-15-2011
Message 22 of 22 (66 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.



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!