Just noticed in another thread that many people are needing a rotation lock mate..
Well thanks to Robert Franz who helped wrote a Macro for me... here it is!
It mates the front and right planes of the part, parallel to the model. Saves me a shed load of time!!!
Thanks Robert!!
Dim swApp As SldWorks.SldWorks
Dim assy As SldWorks.AssemblyDoc
Dim part As SldWorks.Component2
Dim myMate As SldWorks.Mate2
Dim selmgr As SldWorks.SelectionMgr
Dim selEntity As SldWorks.Entity
Dim PartName As String
Dim longstatus As SwConst.swAddMateError_e
Sub main()
Set swApp = Application.SldWorks
Set assy = swApp.ActiveDoc
Set selmgr = assy.SelectionManager
If selmgr.GetSelectedObjectCount > 0 Then
Set selEntity = selmgr.GetSelectedObject5(1)
Set part = selEntity.IGetComponent2
PartAndAssyString = "@" & part.Name2 & "@" & Split(assy.GetTitle, ".")(0)
assy.ClearSelection2 True
boolstatus = assy.Extension.SelectByID2("Right Plane" & PartAndAssyString, "PLANE", 0, 0, 0, False, 1, Nothing, 0)
boolstatus = assy.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, True, 1, Nothing, 0)
Set myMate = assy.AddMate3(swMateType_e.swMatePARALLEL, swMateAlign_e.swMateAlignCLOSEST, False, 0, 0, 0, 0, 0, 0, 0, 0, False, longstatus)
assy.ClearSelection2 True
assy.EditRebuild3
'boolstatus = assy.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "PARALLEL10")
boolstatus = assy.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 1, Nothing, 0)
boolstatus = assy.Extension.SelectByID2("Front Plane" & PartAndAssyString, "PLANE", 0, 0, 0, True, 1, Nothing, 0)
Set myMate = assy.AddMate3(swMateType_e.swMatePARALLEL, swMateAlign_e.swMateAlignCLOSEST, False, 0, 0, 0, 0, 0, 0, 0, 0, False, longstatus)
assy.ClearSelection2 True
assy.EditRebuild3
Else
MsgBox "Nothing Selected", vbOKOnly, "Auto-Mate"
End If
End Sub
Now just add a button to the toolbar assigning the macro to it.. good times