blackeng1660
Automotive
- Feb 24, 2021
- 10
Hi friends
I am working about macro which multiple coincidence assemblies fastly.
Briefly; the logic of the code is as follows
1- Selecting all part axis with tools palette
2- Selecting axis to be moved with tools palette
3- Updating
But my code give error on line 55.
Can you help me plz.
Sub CATMain()
Dim i, j As Integer
Dim parcaeksenSelection, konumeksenSelection As Object
Dim partaxisStatus, placeaxisStatus As Variant
Dim oRef1, oRef2 As reference
Set MyDoc = CATIA.ActiveDocument
Dim oProduct1 As Product
Set oProduct1 = CATIA.ActiveDocument.Product
Dim oConstraints As constraints
Set oConstraints = oProduct1.Connections("CATIAConstraints")
Dim partaxisobjectType(0)
partaxisobjectType(0) = "AxisSystems"
Set partaxisSelection = MyDoc.Selection
partaxisSelection.Clear
Set partaxisSelection = partaxisSelection
partaxisStatus = partaxisSelection.SelectElement3(partaxisobjectType(), "select part axis", True, CATMultiSelTriggWhenUserValidatesSelection, False)
If (partaxisStatus = "cancel") Then
Exit Sub
End If
Dim placeaxisobjectType(0)
placeaxisobjectType(0) = "AxisSystems"
Set placeaxisSelection = MyDoc.Selection
placeaxisSelection.Clear
Set placeaxisSelection = placeaxisSelection
placeaxisStatus = placeaxisSelection.SelectElement3(placeaxisobjectType, "select another axis", True, CATMultiSelTriggWhenUserValidatesSelection, False)
If (placeaxisStatus = "cancel") Then
Exit Sub
End If
j = 1
For i = 1 To placeaxis.Count
Set oRef1 = partaxisSelection.Item(i)
Set oRef2 = placeaxisSelection.Item(i)
Set Constraint&("j") = constraints&("j").AddBiEltCst(catCstTypeOn, oRef1, oRef2)
j = j + 1
Next
End Sub
I am working about macro which multiple coincidence assemblies fastly.
Briefly; the logic of the code is as follows
1- Selecting all part axis with tools palette
2- Selecting axis to be moved with tools palette
3- Updating
But my code give error on line 55.
Can you help me plz.
Sub CATMain()
Dim i, j As Integer
Dim parcaeksenSelection, konumeksenSelection As Object
Dim partaxisStatus, placeaxisStatus As Variant
Dim oRef1, oRef2 As reference
Set MyDoc = CATIA.ActiveDocument
Dim oProduct1 As Product
Set oProduct1 = CATIA.ActiveDocument.Product
Dim oConstraints As constraints
Set oConstraints = oProduct1.Connections("CATIAConstraints")
Dim partaxisobjectType(0)
partaxisobjectType(0) = "AxisSystems"
Set partaxisSelection = MyDoc.Selection
partaxisSelection.Clear
Set partaxisSelection = partaxisSelection
partaxisStatus = partaxisSelection.SelectElement3(partaxisobjectType(), "select part axis", True, CATMultiSelTriggWhenUserValidatesSelection, False)
If (partaxisStatus = "cancel") Then
Exit Sub
End If
Dim placeaxisobjectType(0)
placeaxisobjectType(0) = "AxisSystems"
Set placeaxisSelection = MyDoc.Selection
placeaxisSelection.Clear
Set placeaxisSelection = placeaxisSelection
placeaxisStatus = placeaxisSelection.SelectElement3(placeaxisobjectType, "select another axis", True, CATMultiSelTriggWhenUserValidatesSelection, False)
If (placeaxisStatus = "cancel") Then
Exit Sub
End If
j = 1
For i = 1 To placeaxis.Count
Set oRef1 = partaxisSelection.Item(i)
Set oRef2 = placeaxisSelection.Item(i)
Set Constraint&("j") = constraints&("j").AddBiEltCst(catCstTypeOn, oRef1, oRef2)
j = j + 1
Next
End Sub