Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JhoelForshav
in reply to: jamieking89

Hi @jamieking89 

Happy to help!

 

You can do that but it's much more complex. Try the iLogic code below. You'll have to make a constraint and name it

Plate_Constraint in which the first entity in the constraint is "Top_of_pipe_plane" and the second is one of the planes from your parts.

You should have the same event trigger as before.

Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oConstraint As MateConstraint = oDoc.ComponentDefinition.Constraints.Item("Plate_Constraint")

Dim oPlaneProx1 As WorkPlaneProxy = Nothing
Dim oPlaneProx2 As WorkPlaneProxy = Nothing
Dim oPlate1 As ComponentOccurrence = oDoc.ComponentDefinition.Occurrences.ItemByName("Plate1:1")
Dim oPlate2 As ComponentOccurrence = oDoc.ComponentDefinition.Occurrences.ItemByName("Plate2:1")

If Component.IsActive("Plate1:1") = True And Component.IsActive("Plate2:1") = False
	Call oPlate1.CreateGeometryProxy(oPlate1.Definition.WorkPlanes.Item("Plate1_face_plane"), oPlaneProx1)
	oConstraint.ConvertToMateConstraint(oConstraint.EntityOne, oPlaneProx1, oConstraint.Offset.Value)
ElseIf Component.IsActive("Plate1:1") = False And Component.IsActive("Plate2:1") = True
	Call oPlate2.CreateGeometryProxy(oPlate2.Definition.WorkPlanes.Item("Plate2_face_plane"), oPlaneProx2)
	oConstraint.ConvertToMateConstraint(oConstraint.EntityOne, oPlaneProx2, oConstraint.Offset.Value)
Else
	Exit Sub
End If
oConstraint.Name = "Plate_Constraint"
ThisDoc.Document.Rebuild
	
	

See attached file :slightly_smiling_face: