Granprix
Mechanical
- Dec 30, 2003
- 5
Can someone help me create a macro/program to flip the mate alignment? The following are the main lines of the code that I have started to use from a recorded macro. The first line seems to work every time for selecting the mate if it is preselected. The next line for picking the mate entity is the problem. I can not figure out how to make it pick the correct surface. When I get it to pick the correct entities, the command swModel.EditMate2 works. Or is there a better approach? I am using SW2004. Thank you.
boolstatus = swModel.Extension.SelectByID(swFeat.Name, "MATE", 0, 0, 0, False, 0, Nothing)
boolstatus = swModel.Extension.SelectByID("", swMate.MateEntity(1).ReferenceType, swMate.MateEntity(1).EntityParams(0), swMate.MateEntity(1).EntityParams(1), swMate.MateEntity(1).EntityParams(2), True, 1, Nothing)
'Change alignment indicator
If swMate.alignment = 1 Then
NewAlign = 0
Else
NewAlign = 1
End If
swModel.EditMate2 swMate.Type, NewAlign, swMate.CanBeFlipped, 0.01, 0, 0, 1, 1, 0.5235987755983, 0.5235987755983, 0.5235987755983, longstatus
boolstatus = swModel.Extension.SelectByID(swFeat.Name, "MATE", 0, 0, 0, False, 0, Nothing)
boolstatus = swModel.Extension.SelectByID("", swMate.MateEntity(1).ReferenceType, swMate.MateEntity(1).EntityParams(0), swMate.MateEntity(1).EntityParams(1), swMate.MateEntity(1).EntityParams(2), True, 1, Nothing)
'Change alignment indicator
If swMate.alignment = 1 Then
NewAlign = 0
Else
NewAlign = 1
End If
swModel.EditMate2 swMate.Type, NewAlign, swMate.CanBeFlipped, 0.01, 0, 0, 1, 1, 0.5235987755983, 0.5235987755983, 0.5235987755983, longstatus