4 Replies Latest reply on Jun 11, 2018 5:59 PM by Kelly Hoffman

    part.insertcoordinatesystem()  from point that was just created

    Kelly Hoffman

      very simple task

       

      User pre-selects a face

      Macro creates a point at midpoint of surface and then create a coordinate system at that point. This is what I have so far:

       

      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

      Dim myModelView As Object

      Set myModelView = Part.ActiveView

      myModelView.FrameState = swWindowState_e.swWindowMaximized

      Dim vRefPointFeatures As Variant

      vRefPointFeatures = Part.FeatureManager.InsertReferencePoint(4, 0, 0.01, 1)

      Part.ClearSelection2 True

      boolstatus = Part.Extension.SelectByID2("Point5", "DATUMPOINT", 0, 0, 0, False, 1, Nothing, 0)

      boolstatus = Part.InsertCoordinateSystem(False, False, False)

      Part.ClearSelection2 True

      End Sub

       

       

       

      *I know that my "Point5" part is incorrect. I need to save the previous point somewhere and then call it?

       

      Thanks!