Assembly Parameters unlinking Part Parameters

Assembly Parameters unlinking Part Parameters

Anonymous
Not applicable
510 Views
1 Reply
Message 1 of 2

Assembly Parameters unlinking Part Parameters

Anonymous
Not applicable

Hello friends,

I am working on an assembly template that accesses part's parameters via iLogic. I have had everything working fine with my rules and forms changing the parameters and enabling and disabling parts depending on the choices. However, I was told to create a couple more parts since the original workflow was working. I made the new part, placed it into the assembly, but it was very large. All of my previous parts units were defaulted to Feet in the tools menu. This new part was set to Inches so it was odd to see it way larger than the parts created with feet. 

 

I started using the measure tool and found out that the parts in Feet were actually very, very small. I went back to the part and saw that the user parameters were no longer linked to the model parameters. I re-linked them and then tried out the assembly forms again. The code worked, but it unlinked the part parameters again when i looked in the .ipt file. I believe the error is how i am accessing the parameters in the rule and that somehow breaks the link. Below is my code:  

 

Sub Main

	Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
	
	For i As Integer = 1 To oAsmDoc.ComponentDefinition.Occurrences.Count
		Dim oOcc As ComponentOccurrence = oAsmDoc.ComponentDefinition.Occurrences.Item(i)
		
		If oOcc.Name = "Pier_Part:1" Then			
		oOcc.Definition.Parameters("Pier_Diameter").Value = a_PIER_DIAMETER
		oOcc.Definition.Parameters("Pier_Depth").Value = a_PIER_DEPTH
		oOcc.Definition.Parameters("Pier_Chamfer").Value = a_PIER_CHAMFER
		
		End If
	Next
	
	Parameter.UpdateAfterChange = True
	iLogicVb.UpdateWhenDone = True
	
	
End Sub

Any help or advice is appreciated!! Thanks. Also, let me know if i need to share the entire project folder. 

0 Likes
Accepted solutions (1)
511 Views
1 Reply
Reply (1)
Message 2 of 2

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hello, when you work with ilogic, usually the shortcuts of programming are very useful, however sometimes punctual can give headaches. I think that you have defined the access to the value of the parameter of the occurrence well, however I suspect that "a_PIER_DIAMETER" for example, must have a bluish color.

oOcc.Definition.Parameters("Pier_Diameter").Value = a_PIER_DIAMETER

When it has a bluish color in ilogic, there is an internal shortcut that relates this name to a parameter with the same name (within the assembly in this case).
If this is the case, I would recommend that you try redefining the access to this parameter, for example in the following way:

 

  oa_PIER_DIAMETER = ThisDoc.Document.ComponentDefinition.Parameters ("a_PIER_DIAMETER"). Value

 

and then place for example:

 

oOcc.Definition.Parameters ("Pier_Diameter"). Value = oa_PIER_DIAMETER

 

I hope you can solve your problem. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn