AnsweredAssumed Answered

Who can tell me How to create axis  by the selected Cylinder Surface?

Question asked by Frank Wu Frank Wu on Dec 2, 2014
Latest reply on Dec 5, 2014 by Frank Wu Frank Wu

Good morning,

Who can tell me How to create axis  by the selected Cylinder Surface?

Here is my code(VBA):


Dim swSelMgr                As SldWorks.SelectionMgr
Dim Part                    As SldWorks.ModelDoc2
Dim boolstatus              As Boolean
Dim k                       As Integer
Dim swskobj                 As SldWorks.Surface
Sub main()
        Set swApp = Application.SldWorks
        Set Part = swApp.ActiveDoc
        Set swSelMgr = Part.SelectionManager
        Set Part = swApp.ActiveDoc
        
        Set swSelMgr = Part.SelectionManager
        
        Part.Extension.SelectAll
        On Error Resume Next
        
        For k = 1 To swSelMgr.GetSelectedObjectCount2(-1)
            swskobj = swSelMgr.GetSelectedObject6(k, -1)
            If swskobj.IsCylinder Then
                
            'Set Part = swApp.ActiveDoc
            'boolstatus = Part.Extension.SelectByID2("", "FACE", 1.04985868722451E-03, 4.88853727966898E-03, 4.37064052035794E-02, True, 0, Nothing, 0)
            boolstatus = Part.InsertAxis2(True)
            Part.ClearSelection2 True
            End If
        Next
End Sub

Outcomes