adaptive component internal error

adaptive component internal error

Crashnorun
Participant Participant
783 Views
2 Replies
Message 1 of 3

adaptive component internal error

Crashnorun
Participant
Participant

Hi All, I'm writing an plugin to be executed as an externalcommand, and I'm running into a problem, below are the lines of code.

 

Dim fam As FamilySymbol = M_Doc.GetElement(obj.Id)

Dim comp As FamilyInstance = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(M_Doc, fam)

 

m_doc is a valid current document

obj.id is a valid id for a familysymbol

when the code reaches the second line "dim comp..." it throws an exception "an internal error has occured"

 

Any idea as to why it would be happening? Any input would be greately appreciated. 

Thanks,

0 Likes
784 Views
2 Replies
Replies (2)
Message 2 of 3

ollikat
Collaborator
Collaborator

Sorry that I don't know VB but I find starnge that if you write...

Dim fam As FamilySymbol = M_Doc.GetElement(obj.Id)

Why can't you directly cast obj to fam as FamilySymbol because now you are getting the element from document which actually you already have. Or is there some kind of logical error in your code?

0 Likes
Message 3 of 3

Joe.Ye
Alumni
Alumni

 

With only these 2 lines, it is hard to tell what's wrong.

From the code itself, it is correct.

 

Maybe the famiy symbol you passed in is not eligible to create the adaptive component.



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes