AnsweredAssumed Answered

macro not working

Question asked by Dennie Janssens on Dec 11, 2015

Hello,
my name is Dennie,

 

I’m trying to make a macro for making a extruded cut.

Unfortunately the macro cut doesn’t work.

I have no experience in making macros.

The macro makes the sketch but the cut not.

Please help. (macro below)

 

 

Dim swApp As Object

Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

 

Submain()

 

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

 

boolstatus = Part.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

 

Dim A_Plane As Object

Set A_Plane = Part.FeatureManager.InsertRefPlane(8, 0, 0, 0, 0, 0)

 

Part.ClearSelection2 True

 

boolstatus = Part.Extension.SelectByID2(A_Plane.Name, "PLANE", 0, 0, 0, True, 0, Nothing, 0)

Part.SketchManager.InsertSketchTrue

Dim vSkLines As Variant

vSkLines = Part.SketchManager.CreateCornerRectangle(-0.02, -0.02, 0, 0.02, 0.02, 0)

Dim Sketch_A  As Object

Set Sketch_A = Part.GetActiveSketch2

Part.SketchManager.InsertSketch True

 

Part.ClearSelection2 True

 

boolstatus = Part.Extension.SelectByID2(Sketch_A.Name, "SKETCH", 0, 0, 0, False, 0, Nothing, 0)

Dim A_Cut As Object

Set A_Cut = Part.FeatureManager.FeatureCut2(True, False, False, 0, 0, 0.05, 0.01,
False, False, False, False, 0.01745329251994, 0.01745329251994, False, False,
False, False, True, True, True, 0, 0, False)

Part.SelectionManager.EnableContourSelection = False

 

End Sub

 

 

 

Outcomes