AnsweredAssumed Answered

Why click feature, GetSelectedObject5 is False

Question asked by Yong Ning on Dec 10, 2016
Latest reply on Dec 10, 2016 by Nilesh Patel

Click feature option, GetSelectedObject5 is False

Click Feature option.jpg

Follow code is Error

 

 

rivate Sub ll()

    Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

        Set SwApp = Application.SldWorks

        Set SwModel = SwApp.ActiveDoc

    Dim SwFeat As Feature

        Set SwFeat = SwSelMgr.GetSelectedObject5(1)

        Debug.Print SwFeat.Name

        Stop

    

End Sub

 

Error.jpg

 

 

 

 

 

*******************************************************************************

 

SelectByID2+GetSelectedObject5 → SwFeat → True

Follow code is True

 

Private Sub ll1()

    Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

        Set SwApp = Application.SldWorks

        Set SwModel = SwApp.ActiveDoc

    Dim SwSelMgr As SelectionMgr

        Set SwSelMgr = SwModel.SelectionManager

        boolstatus = SwModel.Extension.SelectByID2("Broken-out Section1", "SECTIONLINE", 0, 0, 0, False, 0, Nothing, 0)

    Dim SwFeat As Feature

        Set SwFeat = SwSelMgr.GetSelectedObject5(1)

        Debug.Print SwFeat.Name

        Stop

    

End Sub

Attachments

Outcomes