Hi,
I am in the process of automation. I can get information of the component placed in the assembly by
ThisApplication.CommandManager.Pick
as shown in the function
Function Add_imate_const()
In that function i call Function
DoiMates
to creat imate automatically between two components which has been selected by user.
But i would like to know, how to get information of the Constraint automatically (d174,d175) by some ilogic command.
I can delete last created composite constraint by
oiMateResults.Delete
Command. But i would like to know, how to get details of the constraint created automatically.
Kindly find below the code, which i have used in my assembly
Function Add_imate_const()
Dim oConstraint As iMateResult
Dim comp1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter,"Select First Component to constraint:")
Dim comp2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter,"Select Second Component to constraint:")
Face=InputListBox("Select Face name", MultiValue.List("Face"), Face, Title := "Select Face_name", ListName := "Select Face_name")
Face_Ang=InputListBox("Select Face_Ang name", MultiValue.List("Face_Ang"), Face_Ang, Title := "Select Face_Ang_name", ListName := "Select Face_Ang_name")
icomposite_name = Face & "-" & Face_Ang
'icomposite_name= InputListBox("Select constraint name", MultiValue.List("icomposite_name"), icomposite_name, Title := "Select icomposite_name", ListName := "Select icomposite_name")
'Constraint_sup(comp1)
'Constraint_sup(comp2)
DoiMates (comp1,comp2,icomposite_name)
'Constraint_un_sup(comp1)
'Constraint_un_sup(comp2)
accept = InputRadioBox("Accept or Reject the last constraint", "Accept", "Reject", accept, Title := "Accept or Reject last constraint")
While accept <> True
oiMateResults.Delete
comp1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter,"Select First Component to constraint:")
comp2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter,"Select Second Component to constraint:")
ThisApplication.CommandManager.StartCommand(2179)
Face=InputListBox("Select Face name", MultiValue.List("Face"), Face, Title := "Select Face_name", ListName := "Select Face_name")
Face_Ang=InputListBox("Select Face_Ang name", MultiValue.List("Face_Ang"), Face_Ang, Title := "Select Face_Ang_name", ListName := "Select Face_Ang_name")
icomposite_name = Face & "-" & Face_Ang
DoiMates (comp1,comp2,icomposite_name)
accept = InputRadioBox("Accept or Reject the last constraint", "Accept", "Reject", accept, Title := "Accept or Reject last constraint")
If accept <> True
oiMateResults.Delete
End If
End While
End Function
Public Dim oiMateResults As iMateResult
Public Sub DoiMates(BaseComponent As ComponentOccurrence, SecondComponent As ComponentOccurrence,icomposite_name1 As String)
Dim oiMateDef1 As iMateDefinition
Dim oiMateDef2 As iMateDefinition
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
For Each oiMateDef1 In BaseComponent.iMateDefinitions
If oiMateDef1.Name = icomposite_name1 Then Exit For
Next
If oiMateDef1 Is Nothing Then
MsgBox ("Missing iMate information on Base Component" )
Exit Sub
End If
For Each oiMateDef2 In SecondComponent.iMateDefinitions
If oiMateDef2.Name = icomposite_name1 Then Exit For
Next
If oiMateDef2 Is Nothing Then
MsgBox ("Missing iMate information on Next Component", vbCritical)
Exit Sub
End If
oiMateResults = oAsmCompDef.iMateResults.AddByTwoiMates(oiMateDef1, oiMateDef2)
'MsgBox(oiMateResults.ParentComposite)
MsgBox(oiMateResults.Name)
Last_constraint_name=oiMateResults.Name
End Sub
Thanks in advance