Getting part parameter of assembly placed in drawing

Getting part parameter of assembly placed in drawing

harvey_craig2RCUH
Advocate Advocate
262 Views
4 Replies
Message 1 of 5

Getting part parameter of assembly placed in drawing

harvey_craig2RCUH
Advocate
Advocate

I would like to get parameter "E1" in part "NPT_Port" which is part of an assembly placed as a view on a drawing.

 

I can get to the occurrence like so:

Dim oModelDoc = ActiveSheet.View("VIEW1").ModelDocument
Dim oAssemblyDoc As AssemblyDocument = oModelDoc
Dim oPartOcc = oAssemblyDoc.ComponentDefinition.Occurrences.ItemByName("NPT_Port")

I would expect parameters to be accessed in oPartOcc as I can see patterns, constraint etc etc, where do I find parameters?

 

Thanks,

Harvey

0 Likes
Accepted solutions (1)
263 Views
4 Replies
Replies (4)
Message 2 of 5

mat_hijs
Collaborator
Collaborator

You will need to get the component definition from the component occurrence and then get the parameters from there as you would in any other component definition.

0 Likes
Message 3 of 5

harvey_craig2RCUH
Advocate
Advocate

Ok, so I'm in the definition:

Dim oDef As ComponentDefinition = oPartOcc.Definition

 And inside oDef I still can't see anything relevant to parameters?:

harvey_craig2RCUH_0-1733489032440.pngharvey_craig2RCUH_1-1733489084734.pngharvey_craig2RCUH_2-1733489139721.png

Thanks,

Harvey

0 Likes
Message 4 of 5

mat_hijs
Collaborator
Collaborator
Accepted solution

I think the reason your intellisense isn't showing Parameters is because you declared it as ComponentDefinition but not as PartComponentDefinition

I think sure that you can still access the Parameters from there without declaring it specifically as PartComponentDefinition even though the intellisense doesn't show it. If you know it's a part you may as well declare it as PartComponentDefinition, that should make the intellisense work.

I can't test this right now unfortunately, but if this doesn't work you may need to use Definition.Document to get teh PartDocument and then get the PartComponentDefinition from there.

Message 5 of 5

harvey_craig2RCUH
Advocate
Advocate

Thanks very much. I rely too much on intellisense!

0 Likes