2 Replies Latest reply on May 22, 2017 4:59 AM by Oleksandr Lutsenko

    Troubles with extruded cut in macros

    Oleksandr Lutsenko

      I have created a part using "extruded boss/base" instrument, and after that I need to cut a few circles in it. Everything is correct until I try to play the macro, which records this. It does not extrude anything for some reasons. Help me to understand how to solve it. The first pic is  the result of macros work and the second one is what I need to get.

      photo_2017-05-21_18-01-34.jpg

      Снимоgggк.PNG

        • Re: Troubles with extruded cut in macros
          Peter Brinkhuis

          Debugging is extraordinarily difficult without code Please share your macro and a more detailed description of what you want to achieve and we will be probably be able to help you.

            • Re: Troubles with extruded cut in macros
              Oleksandr Lutsenko

              I can't understand how to make a hole in an already extruded part, even in this simple example:

              Dim swApp As Object

               

               

              Dim Part As Object

              Dim boolstatus As Boolean

              Dim longstatus As Long, longwarnings As Long

               

               

              Sub main()

               

               

              Set swApp = _

              Application.SldWorks

               

               

              Set Part = swApp.ActiveDoc

              Part.SketchManager.InsertSketch True

              boolstatus = Part.Extension.SelectByID2("Top Plane", "PLANE", -0.274697033056675, 9.99351988327248E-02, -3.41451207890486E-02, False, 0, Nothing, 0)

              Part.ClearSelection2 True

              Dim vSkLines As Variant

              vSkLines = Part.SketchManager.CreateCornerRectangle(-0.151828385983616, 7.61210436539109E-02, 0, -1.82028582650656E-02, 1.94439622376838E-02, 0)

              Part.ShowNamedView2 "*Trimetric", 8

              Part.ClearSelection2 True

              boolstatus = Part.Extension.SelectByID2("Line2", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)

              boolstatus = Part.Extension.SelectByID2("Line1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)

              boolstatus = Part.Extension.SelectByID2("Line4", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)

              boolstatus = Part.Extension.SelectByID2("Line3", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)

              Dim myFeature As Object

              Set myFeature = Part.FeatureManager.FeatureExtrusion2(True, False, False, 0, 0, 0.045, 0.045, False, False, False, False, 0.143989663289533, 0.143989663289533, False, False, False, False, True, True, True, 0, 0, False)

              Part.SelectionManager.EnableContourSelection = False

              Part.SetPickMode

              Part.ClearSelection2 True

              boolstatus = Part.Extension.SelectByID2("", "FACE", -9.77399731322635E-02, 4.49999999999022E-02, -5.13686511280298E-02, False, 0, Nothing, 0)

              Part.SketchManager.InsertSketch True

              Part.ClearSelection2 True

              Dim skSegment As Object

              Set skSegment = Part.SketchManager.CreateCircle(-0.098786, 0.046068, 0#, -0.107799, 0.040633, 0#)

              Part.ClearSelection2 True

              boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)

              Set myFeature = Part.FeatureManager.FeatureCut3(True, False, False, 0, 0, 0.045, 0.045, False, False, False, False, 0.143989663289533, 0.143989663289533, False, False, False, False, False, True, True, True, True, False, 0, 0, False)

              Part.SelectionManager.EnableContourSelection = False

              End Sub

               

              I know, that here I can create a sketch with that circle, which I was trying to cut, and use "Extrude" operation after this, but in my first task I need one hole into another. The pics are included above. I hope, that you understand, what I'm talking about