Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro

Status
Not open for further replies.

CycloneWade

Automotive
Apr 1, 2005
76
I'm looking for some help in creating a macro that will start a sketch on a preselected face and offset a preselected loop and extrude the new sketch x number of units. I've created a macro but macro becomes attached to that specific face on that specific part. A little guidance should be adequate. Thanks.
 
Replies continue below

Recommended for you

Make sure you clear the SelectionManager selections before you close the macro.
 
Okay I finally crippled together some code, which for now appears to work.

Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean

Dim Feature As Object
Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Part.SketchManager.InsertSketch True
boolstatus = Part.SketchOffsetEntities2(0.00127, False, True)
Part.ClearSelection2 True
Part.ClearSelection2 True
Part.FeatureManager.FeatureExtrusion True, False, True, 0, 0, 0.00127, 0.00254, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1
Part.SelectionManager.EnableContourSelection = 0
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor