Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Inventor VBA - Get Extrusion Size

isocam
Collaborator

Inventor VBA - Get Extrusion Size

isocam
Collaborator
Collaborator

Can anybody help?

 

Does any body know, using a VBA macro, to get the size of an extruded part and display it in a message box?

 

For example,

 

I have created a single sketch and extruded it to a certain size,

 

All I need, for testing purposes, is to get the extrusion size and display it in a message box.

 

Many thanks in advance!

 

Darren

0 Likes
Reply
206 Views
2 Replies
Replies (2)

Curtis_Waguespack
Consultant
Consultant

Hi @isocam 

In addition to the previous reply if you know the parameter name you can use something like this:

 

Dim oUOM As UnitsOfMeasure = ThisDoc.Document.UnitsOfMeasure
oInvUnits = UnitsTypeEnum.kCentimeterLengthUnits
oConversion = oUOM.ConvertUnits(1, oUOM.LengthUnits, oInvUnits)

For Each oParam In Feature.InventorFeature("Extrusion3").Parameters
	If oParam.name = "Len" Then
		MsgBox(oParam.Name & " is " & oParam.Value / oConversion & " long")
		Exit For
	End If
Next