need a program to extract the dimensions of all the parts in an assembly through solid works api

need a program to extract  the dimensions of all the  parts in an assembly through solid works api
SolidworksApi macros
Answers 3
SF
SF 2010-03-27 Best Answer

Dim swApp As SldWorks.SldWorks
Dim swAssy As SldWorks.AssemblyDoc
Dim vComps As Variant
Dim swComp As SldWorks.Component2
Dim swFeat As SldWorks.Feature
Dim swDispDim As SldWorks.DisplayDimension
Dim i As Integer

Sub main()

    Set swApp = Application.SldWorks
   
    Set swAssy = swApp.ActiveDoc
   
    vComps = swAssy.GetComponents(False)
   
    For i = 0 To UBound(vComps)
       
        Set swComp = vComps(i)
              
        Set swFeat = swComp.FirstFeature
       
        While Not swFeat Is Nothing
       
            Set swDispDim = swFeat.GetFirstDisplayDimension
           
            While Not swDispDim Is Nothing
               
                Debug.Print swDispDim.GetNameForSelection
                Set swDispDim = swFeat.GetNextDisplayDimension(swDispDim)
               
            Wend
           
            Set swFeat = swFeat.GetNextFeature
           
        Wend
               
    Next
   
End Sub

________________________________________________________________

SolidWorks API Tips & Tricks: http://amcbridge.com/?q=SolidWorksApiBlog
SF
SF 2010-03-29

Hi, i tried this code for an assembly it works great, is it possible to modify the code to run against a part.

I tried to modify the code, but can't find something similar to GetComponents for a part document.

Thanks

TS
TS 2010-03-29

Howdy,

The attached might help you find what you are looking for.

This works in SW2010 (maybe 2009).