Read SoftPointerId From ResultBuffer

Read SoftPointerId From ResultBuffer

youssefGC
Advocate Advocate
286 Views
2 Replies
Message 1 of 3

Read SoftPointerId From ResultBuffer

youssefGC
Advocate
Advocate

Hi everyone,

I have stored information of type "ObjectId" (as SoftPointerId) in an entity, but in read data I found the problem "Impossible to cast an object of type ObjectId to type String", it doesn't work in my case.

youssefGC_0-1718888999320.png


Thank you.

 

0 Likes
Accepted solutions (2)
287 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor
Accepted solution

You can simply

 

var id=(ObjectId)result[0].Value;

 

Note, the ObjectId could be ObjectId.Null, if the underline entity no long exists (i.e. was erased), or its IsErased property could be true, if the underline entity was just erased prior to the ResultBuffer is retrieved.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3

Gepaha
Collaborator
Collaborator
Accepted solution

 

ObjectId idOfRebarEch = (ObjectId)result[0].Value;
if (idOfRebarEch.IsValid)
// ....