0 Replies Latest reply on Nov 18, 2015 1:50 PM by Mohammed Gh

    Trim Surface Macro

    Mohammed Gh

      I have a cylinder and four planes. Two are horizontal and the other two are perpendicular.

      I want to automate trimming a surface using a plane. I want to trim the top and bottom of the cylinder using the two horizontal planes, and the left and right side of the cylinder using the perpendicular planes.
      Manually it is not problem since you click on the side you want to keep or to get ride of, but when it comes to automation I couldn't find a way to select the exact side I want to trim. Is there a way to choose the right side of the plane used for trimming?

       

      Thanks

       

      Here is the code I am using.

       

      Set swApp = _

      Application.SldWorks

       

      Set Part = swApp.ActiveDoc

      boolstatus = Part.Extension.SelectByID2("Plane1", "PLANE", 0, 0, 0, False, 0, Nothing, 0)

      boolstatus = Part.FeatureManager.PreTrimSurface(False, False, False, True)

      boolstatus = Part.FeatureManager.PreTrimSurface(False, False, False, True)

      boolstatus = Part.Extension.SelectByID2("", "SURFACEBODY", -0.017189983037099, 7.42465110406698E-03, -4.78031848643354E-02, True, 0, Nothing, 0)

      Dim myFeature As sldworks.Feature

      Set myFeature = Part.FeatureManager.PostTrimSurface(True)