2 Replies Latest reply on Jan 29, 2018 7:21 AM by Matt Bieringer

    Sketch Trim

    Matt Bieringer

      Hello everyone,

       

      I am having some difficulty trimming a created sketch via my macro. Attached are images of what I am starting with, what I need and then what my code is outputting.

       

      I have tried all the different options for .sketchtrim and have tried to move the order which I select the objects. My code below is the only option that outputs anything close to what I need.

       

      Thank you for your help

       

      bRet = swExt.SelectByID2("Spline4", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
      bRet = swExt.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
      If bRet = False Then Debug.Print "SP1 Error"
      bRet = swSkMgr.SketchTrim(2, 0, 0, 0)
      If bRet = False Then Debug.Print "SP1 Trim Error"
      
        • Re: Sketch Trim
          Simon Turner

          Have you tried the other options as defined in the swSketchTrimChoice_e Enumeration?

          You are using "2" which represents swSketchTrimTwoEntities

          Perhaps try 5 or 6.

            • Re: Sketch Trim
              Matt Bieringer

              I tried them all, but I was able to get it to work.

               

              For some reason the API doesn't like to trim closed profiles, so I changed my circles to arcs and was able to use the Trim Away Outside (5) and that worked great for me.

               

              bRet = swExt.SelectByID2("Arc1", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
              bRet = swExt.SelectByID2("Arc2", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
              bRet = swExt.SelectByID2("Spline4", "SKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
              If bRet = False Then Debug.Print "SP2 & Arc Selection Error"
              bRet = swSkMgr.SketchTrim(5, 0, 0, 0)
              If bRet = False Then Debug.Print "SP2 & Arc Trim Error"