1

I'm trying to get the attributes from a Form Tool Feature. Primarily goal is to get the Placement Face, secondary goal would be to be able to "Flip Tool" if user set it up wrong.

Form Tool Feature

I tried to get the face via IFace2::GetAffectedFaces Method and the method returned nothing.

I tried to get the definition but when I tried to dim FTData As LibraryFormToolFeatureData or ILibraryFormToolFeatureData, I received a User-defined type not defined. I tried running the code shown in that API documentation and received the same error. My best guess is that it was implemented after Solidworks 2024 SP5.0 that the company is currently utilizing.

I also tried dim FTData As LibraryFeatureData or As Object and after the .GetDefinition Method FTData was still nothing.

Option Explicit

'Define once and utilize throughout code
Public swApp As SldWorks.SldWorks
Public swModel As ModelDoc2


Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    
    If swModel Is Nothing Then
        MsgBox "Please open a file first."
        Exit Sub
    End If
    
    Dim swSelMgr As SldWorks.SelectionMgr
    'Dim FormToolFeature As LibraryFeatureData           'Returns Nothing
    'Dim FormToolFeature As LibraryFormToolFeatureData 'Doesn't exist in SW2024SP5.0?
    'Dim FormToolFeature As Object                      'Returns Nothing
    Dim swFeat As SldWorks.Feature
    
    Set swSelMgr = swModel.SelectionManager
    Set swFeat = swSelMgr.GetSelectedObject6(1, 0)

    'swFeat.GetAffectedFaceCount                        'Returns 0
    Set FormToolFeature = swFeat.GetDefinition
    
End Sub

0

Your Answer

Draft saved
Draft discarded

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.