API - how to get Thickness

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

Reply to
John
Loading thread data ...

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,

Reply to
Robert V. Hanson

Reply to
John

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

Reply to
Sean Phillips

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

Reply to
Sean Phillips

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

Reply to
Vinodh Kumar M

Reply to
John

featurebyname

Reply to
Sean Phillips

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.