create a user input form to generate parts

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
Answers 5
SF
SF 2008-11-24 Best Answer
have you tried driveworksxpress?
SF
SF 2008-11-24
It will take about 10 minutes in VBA.

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...
SF
SF 2008-11-24
Luke, yes, I want to specifiy the length and width of therectangle and that the location will be centered on the origin.Also need to be able to input the extrusion depth on the form.
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!
SF
SF 2008-12-24
Luke, have you completed this sample? please post ifpossible.

thanks.
SF
SF 2008-12-25
Option Explicit

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.