can someone provide a generic "template" form with theseinput parameters to build a simple part?
need to offset the front plane,
sketch a rectangle,
extrude,
then sketch again on the right plane.
can this be done or is this wishfull thinking??
thanks!SolidworksApi macros
need to offset the front plane,
sketch a rectangle,
extrude,
then sketch again on the right plane.
can this be done or is this wishfull thinking??
thanks!SolidworksApi macros

Just be more specific; do you want to specify the size and locationof the rectangle, the distance of the extrusion, the second sketchis what?, etc...
The second sketch is another rectangle off the right plane. Thissketch will be extruded a different depth.
please let me know if you need more info .
thanks!
thanks.
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim SelMgr As SelectionMgr
Sub main()
Set swApp = Application.SldWorks
' Use currently active part
'Set swModel = swApp.ActiveDoc
' Or create new one...
Set swModel =swApp.NewDocument("C:\ProgramData\SolidWorks\SolidWorks2008\templates\Part.prtdot", 0, 0#, 0#)
Set SelMgr = swModel.SelectionManager
swModel.Extension.SelectByID2 "Front Plane", "PLANE", 0, 0, 0,False, 0, Nothing, 0
swModel.CreatePlaneAtOffset3 0.01, True, True
swModel.Extension.SelectByID2 "Plane1", "PLANE", 0, 0, 0, False, 0,Nothing, 0
swModel.SketchManager.CreateCenterRectangle 0, 0, 0, 0.05, 0.02, 0
swModel.FeatureManager.FeatureExtrusion2 True, False, True, 0, 0,0.01, 0.01, False, False, False, False, 0, 0, False, False, False,False, 1, 1, 1, 0, 0, False
swModel.Extension.SelectByID2 "Right Plane", "PLANE", 0, 0, 0,False, 0, Nothing, 0
swModel.SketchManager.InsertSketch True
swModel.SketchManager.CreateCenterRectangle 0, 0, 0, 0.05, 0.02, 0
swModel.Extension.SelectByID2 "Sketch2", "SKETCH", 0, 0, 0, False,0, Nothing, 0
swModel.FeatureManager.FeatureExtrusion True, False, True, 0, 0,0.01, 0.01, False, False, False, False, 0, 0, False, False, False,False, 1, 1, 1
swModel.EditRebuild3
End Sub
Alter dimensions and positions to suit. Can expand to have userform to gather information if required.