Accessing parameters from parts in an assembly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
From the posts I’ve found here, it seems that when I place a part into an assembly I should be able to access that part’s parameters. Unfortunately, I’m having some problems doing that. With some parts it works fine, but with others it seems like it is only looking in the assembly parameters not in the part specified. All parts were placed the same way, and I used the same code to try an access the parameters from both parts. My code is below:
Placing parts:
Dim oAssemblyDoc As AssemblyDocument = ThisDoc.Document
Dim oComponentDef As ComponentDefinition = oAssemblyDoc.ComponentDefinition
Dim oMatrix As Matrix = ThisApplication.TransientGeometry.CreateMatrix
Dim oPlaceCap As ComponentOccurrence = oComponentDef.Occurrences.Add("C:\VaultWork\Documents\Common\944A0112_BUTTWELD_PIPE_CAP\944A0112H10.ipt", oMatrix)
Dim oDLPipeCapOccurance As String = "DropLegPipeCap:1"
Dim oPlaceCoupling As ComponentOccurrence = oComponentDef.Occurrences.Add("C:\VaultWork\Documents\Common\COUPLING\944A0044H05.ipt", oMatrix)
Dim oDLCouplingOccurance As String = "DropLegDrainCouping:1"
Getting parameters from the parts:
oPipeCapHeight = Parameter(oDLPipeCapOccurance, "OAHCap")
oCouplingLength = Parameter(oDLCouplingOccurance, "LENGTH")
(Both “OAHCap” and “LENGTH” are parameters in their respective parts. Getting the “LENGTH” parameter from the coupling part works without any issues, but I cannot get “OAHCap” from the pipe cap part. I get an error saying not found, and it looks like it is only looking in the assembly, which does not have that parameter.)
One thing I noticed was that in the box at the top for the parts that allow me to access the parameters, under the occurrence the parameters are there, but for the parts that do not, they aren’t. Is there some setting or something that is blocking that? Both I, and our CAD administrator have looked over the part files and can’t really see anything different about them, but we don’t really know what to be looking for, either. (Also I just saw when taking this screen shot, the symbols next to the parts are different, I'm sure that also has something to do with it)
I’m also open to work-arounds. I thought maybe I could just open the part, make it active, and then save the parameter I want to a variable that I can use after the part is closed, but so far I have been unable to make that work either.