Read the properties of a drill/tap/mill via the SolidWorks Document Manager API

Hello

I am still making a little more progress in the part analysis via solidworks document manager (API) and I don't know if it is possible to retrieve the information of a tapping, drilling, milling?

If someone uses this function, I'm interested in a track or a piece of code:)

Hello!

For some features, you have to recover its definition for I###FeatureData.

An example below:

Use Hole Wizard Feature Data Object to Create Hole Wizard Feature Example (VBA) - 2020 - SOLIDWORKS API Help

The APIs you're interested in I think:

IFeature::GetDefinition: GetDefinition Method (IFeature) - 2012 - SOLIDWORKS API Help

IFeature::ModifyDefinition2 if you also want to edit: IModifyDefinition2 Method (IFeature) - 2012 - SOLIDWORKS API Help

Good luck!

 

3 Likes

Hello indeed this function works well I have been using it even since the beginning but I would like not to have to open the part to check this parameter and do it from the "SolidWorks Document Manager"

FYI

Function Controle_Parametre_Fraisurage(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, i As Long) As String
    Dim swSelMgr    As SldWorks.SelectionMgr
    Dim swFeat      As SldWorks.Feature
    Dim swWizHole   As SldWorks.WizardHoleFeatureData2
    
    Set swSelMgr = swModel.SelectionManager
    Set swFeat = swModel.FirstFeature
    
    Do While Not swFeat Is Nothing And Controle_Parametre_Fraisurage = ""
        Select Case swFeat.GetTypeName
            Case "HoleWzd"
                Set swWizHole = swFeat.GetDefinition
                If swWizHole.FastenerType2 = 141 Or swWizHole.FastenerType2 = 142 Then Controle_Parametre_Fraisurage = "Type de fraisurage incorrect détecté"
        End Select
        Set swFeat = swFeat.GetNextFeature
    Loop
End Function

 

Indeed, a clear lack of coffee on my part, I had missed the constraint of "SolidWorks Document Manager".

My apologies, good luck!

1 Like