L'enregistreur de macro donne ce code pour la generation de trois plan a 100mm de distance
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, True, 0, Nothing, 0)
Dim myRefPlane As Object
Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.1, 0, 0, 0, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Plan de face", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Plan de dessus", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Plan de dessus", "PLANE", 0, 0, 0, True, 0, Nothing, 0)
Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.1, 0, 0, 0, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Plan de dessus", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Plan de droite", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Plan de droite", "PLANE", 0, 0, 0, True, 0, Nothing, 0)
Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.1, 0, 0, 0, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Plan de droite", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
End Sub