ADDING COMPONENT MULTIPLE TIMES IN MORE THAN 3 SITOATIONS

ADDING COMPONENT MULTIPLE TIMES IN MORE THAN 3 SITOATIONS

kothaananthasai0811
Participant Participant
146 Views
1 Reply
Message 1 of 2

ADDING COMPONENT MULTIPLE TIMES IN MORE THAN 3 SITOATIONS

kothaananthasai0811
Participant
Participant

ThisAssembly.BeginManage

Dim OMEGA_PROFILE_ASSY_W As ManagedComponentOccurrence
Dim i As Integer
Dim panelCount As Integer = CInt(NUMBER_OF_PANELS_ON_BTM)

Select Case DRAIN
Case "DRAIN_BEFORE_BLOWER", "DRAIN_AFTER_BLOWER", "DRAIN_BEFORE_AND_AFTER_BLOWER"
For i = 1 To panelCount
OMEGA_PROFILE_ASSY_W = Components.Add("OMEGA_PROFILE_ASSY_W:" & i, "OMEGA_PROFILE_ASSY_W.iam")
If OMEGA_PROFILE_ASSY_W IsNot Nothing Then
' Use OMEGA_PROFILE_ASSY_W directly without casting
Constraints.AddMate("Mate:" & (i + 16), OMEGA_PROFILE_ASSY_W, "XZ Plane", "", "YZ Plane")
Constraints.AddMate("Mate:" & (i + 17), "", "XZ Plane", {"OMEGA_PROFILE_ASSY_W:" & i, "OMEGA_PROFILE_W:1"}, "Face5")
Constraints.AddFlush("Flush:" & (i + 1), "", "XY Plane", OMEGA_PROFILE_ASSY_W, "YZ Plane", -(B_PANEL_L_1 + B_PANEL_L_10 + B_PANEL_L_3 + DRAIN_1 + 42.5 mm + DRAIN_2 + 15))
End If
Next

Case "NO_DRAIN"
For i = 1 To panelCount
OMEGA_PROFILE_ASSY_W = Components.Add("OMEGA_PROFILE_ASSY_W:" & i, "OMEGA_PROFILE_ASSY_W.iam")
If OMEGA_PROFILE_ASSY_W IsNot Nothing Then
Constraints.AddMate("Mate:" & (i + 16), OMEGA_PROFILE_ASSY_W, "XZ Plane", "", "YZ Plane")
Constraints.AddMate("Mate:" & (i + 17), "", "XZ Plane", {"OMEGA_PROFILE_ASSY_W:" & i, "OMEGA_PROFILE_W:1"}, "Face5")
Constraints.AddFlush("Flush:" & (i + 1), "", "XY Plane", OMEGA_PROFILE_ASSY_W, "YZ Plane", -(B_PANEL_L_1 + B_PANEL_L_10 + B_PANEL_L_3 + 30 mm + 42.5 mm + 45))
End If
Next
End Select

ThisAssembly.EndManage




ERROR IM GETTING IN THIS 

Error on line 13 in rule: Rule4, in document: BTM_OMEGA_PROFILES.iam

"Mate:18" was already managed by an earlier statement in unnamed group.

0 Likes
147 Views
1 Reply
Reply (1)
Message 2 of 2

JMGunnar
Collaborator
Collaborator

you code generate  mate name  

@kothaananthasai0811 

 

For i = 1 To panelCount

    "Mate:" & (i + 17)  = "Mate:18"

Next

 

For i = 1 To panelCount

     "Mate:" & (i + 17) = "Mate:18 "

 

Next

 

Best Regards Johan G