Constrain origin plane and part plane

Constrain origin plane and part plane

ysbaodnj
Enthusiast Enthusiast
170 Views
0 Replies
Message 1 of 1

Constrain origin plane and part plane

ysbaodnj
Enthusiast
Enthusiast

The code below creates constraints by selecting FLANGE and END PIPE, and FLANGE and END PIPE are parts in the assembly.
I want to add an additional condition here inside the if statement that constrains the origin XY plane of the assembly and the XZ plane of the FLANGE.
If anyone knows how, please let me know.

Dim aOcc As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Pick 1st connected part")
Dim bOcc As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(kAssemblyOccurrenceFilter, "Pick 2nd connected part")

Dim item1 As String = aOcc.Name
Dim item2 As String = bOcc.Name
 
If item1.Contains("FLANGE") And item2.Contains("END PIPE") Then
   Constraints.AddMate("", item2, "Z축", item1, "Z축", offset := 0.0)
   Constraints.AddMate("", item2, "XZ PLANE", item1, "XZ PLANE",offset := 0.0)
   Constraints.AddMate("", item2, "FACE1", item1, "XY PLANE", "ENDPIPE_T*0.7")
Else If item1.Contains("END PIPE") And item2.Contains("FLANGE") Then
   Constraints.AddMate("", item1, "Z축", item2, "Z축", offset := 0.0)
   Constraints.AddMate("", item1, "XZ PLANE", item2, "XZ PLANE", offset := 0.0)
   Constraints.AddMate("", item1, "FACE1", item2, "XY PLANE", "ENDPIPE_T*0.7")
END IF

 

0 Likes
171 Views
0 Replies
Replies (0)