Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Apr 1, 2005
Messages
76
Location
US
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.
 
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

Back
Top