Hello All,
The first row is OK, the second row is wrong, it will show error "Element not found". It is wired, why I have to convert Dlong to long, and then convert long to Dlong, it seems nothing actually. Why cannot get element by ID directly?
Set TestEle = ActiveModelReference.GetElementByID(DLongFromLong(DLongToLong(MyEnum.Current.id))) Set TestEle = ActiveDesignFile.GetElementByID(MyEnum.Current.id)
Thanks a lot.
Hi Changsong,
Changsong Ling said:Why cannot get element by ID directly?
I think the problem is somewhere else, but without knowing context (how enumeration is created, for what model), it's hard to say why it does not work.
Exist the lines together in the code following one and the second? Or you just cut them from different places in the code?
Changsong Ling said:the second row is wrong
Yes, it seems to be wrong, but not because of what you ask about: Why you want to obtain an element by its ID, when you have it already (I guess MyEnum.Current is Element)?
BTW Why do you use ActiveModelReference and at the second row ActiveDesignRefernce?
Changsong Ling said:it will show error "Element not found".
As I wrote, I do not see any sense to write such code, but anyway: Does the element really exist in the file?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Changsong Ling
Oh, I'm so sorry, I didn't noticed the error ActiveModelReference. It is OK. All my fault. Thanks a lot!