1 Reply Latest reply on Nov 18, 2015 1:06 PM by Mohammed Gh

    macro to extend REFSURFACES plane. InsertExtendSurface

    Mohammed Gh

      I am writing a piece of code to automatically  Select swSelREFSURFACES surface type and extend it to a distance.

      I am using InsertExxtendSurface.


      In the help page of  InsertExtendSurface it says: The selection list can contain faces or edges from the surface.

       

      Bellow is the code using two ways of selection that select the surface but it does not extend it.

       

      Maybe because I am not selecting the face that the InsertExtendSurface requires.


      How to select a face from a surface?


      Thanks

       

       

       

      -------------- First selection--------------------------

      Set Part = swApp.ActiveDoc

      boolstatus = Part.Extension.SelectByID2("surface1", "SURFACEBODY", 0, 0, 0, False, 0, Nothing, 0)

      Part.InsertExtendSurface True, 0, 0.356362

      --------------------------------------------------------

       

      ----------Second Selection-----------------------

      Set Part = swApp.ActiveDoc

      boolstatus = Part.Extension.SelectByID2("surface1", "REFSURFACE", 0, 0, 0, False, 0, Nothing, 0)
      Part.InsertExtendSurface True, 0, 0.356362

       

       

       

       

       

        • Re: macro to extend REFSURFACES plane. InsertExtendSurface
          Mohammed Gh

          I just figured it out.

           

              Model.ClearSelection2 True

              boolstatus = Model.Extension.SelectByID2("surface1", "REFSURFACE", 0, 0, 0, False, 0, Nothing, 0)

              Set swFeat = selMgr.GetSelectedObject6(1, -1)

              vFaceArr = swFeat.GetFaces

              For Each oneFace In vFaceArr

                      Set swFace = oneFace

                      Set swEnt = swFace

                      boolstatus = swEnt.Select2(True, -1)

                      Model.InsertExtendSurface True, 0, 0.5

              Next