API - how to get Thickness

Sep 30, 2003 7 Replies

In VBA I have:



Dim Model As ModelDoc2



and I try to access the sheet metal thickness like this:



Model.feature.SheetMetalFeatureData.thickness



... but apparently that is not how to get it. What is the statement that retrieves the thickness?



John


If you have the Feature for a sheetmetal feature, you can use the retval = Feature.GetDefinition( ) to get the SheetMetalFeatureData object, then you can use the thickness method against that object to get the value.

Best Regards,

this is not tested but it should work. if it does not work then it will at least give you the idea of how it is done.

sub main()

dim swapp as sldworks.sldworks dim model as modeldoc2 dim firstfeature as feature dim nextfeature as feature dim FeatureDefinition as SheetMetalFeatureData dim thickness as double

set swapp = new sldworks.sldworks

set model = swapp.activedoc

set firstfeature = model.firstfeature

set nextfeature = firstfeature.getnextfeature

while nextfeature.gettypename "SheetMetal"

set firstfeature = nextfeature.getnextfeature

set nextfeature = firstfeature

loop

set FeatureDefinition = nextfeature.GetDefinition

thickness = FeatureDefinition.Thickness

debug.print thickness end sub

sorry i forgot the "DO"

sub main()

dim swapp as sldworks.sldworks dim model as modeldoc2 dim firstfeature as feature dim nextfeature as feature dim FeatureDefinition as SheetMetalFeatureData dim thickness as double

set swapp = new sldworks.sldworks

set model = swapp.activedoc

set firstfeature = model.firstfeature

set nextfeature = firstfeature.getnextfeature

do while nextfeature.gettypename "SheetMetal"

set firstfeature = nextfeature.getnextfeature

set nextfeature = firstfeature

loop

set FeatureDefinition = nextfeature.GetDefinition

thickness = FeatureDefinition.Thickness

debug.print thickness end sub

Hi all...

Regarding the "thickness" problem. I used this code in one of my utilities...

swType = swFeature.GetTypeName() If (swType = "Shell") Then smThk = swFeature.GetDefinition.Thickness() ElseIf (swType = "SheetMetal") Then smThk = swFeature.GetDefinition.Thickness()

etc...

Remember that while traversing the feature tree, you have to keep track of where ("shell" or "sheetmetal") you got a valid thickness value.

Regards,

Vinodh Kumar M

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required