Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to change the flange-width of previously existing sheetmetal part using Inventor VBA code

Anonymous

How to change the flange-width of previously existing sheetmetal part using Inventor VBA code

Anonymous
Not applicable

I have a previously existing sheetmetal part with a flange (Flange1 - consider having only 1 flange). I need to get the "Flange1" feature and change the flange width with some other value.

Can you please help me with appropriate API for it? or a sample VBA code will do.

 

Thanks. 

0 Likes
Reply
545 Views
5 Replies
Replies (5)

johnsonshiue
Community Manager
Community Manager

Hi! This can be done quite easily using iLogic. Please share an example and forum experts can show the solution very quickly.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes

Anonymous
Not applicable

Hello,

I just have a simple problem that I have a sheetmetal part and a flange to it, as you can see in the imagePart.png

for eg. I just need to change the flange width from 1 inches to 2 inches using simple VBA code.

I have tried various ways but I am unable to achieve the thing, so can anyone please help me with a simple code asap ?

0 Likes

johnsonshiue
Community Manager
Community Manager

Hi! This can be done in two ways (quite similar to manual process). You can edit the Flange and change the type (click on double-arrow button) to Edge or Width. Set the desirable distance accordingly.

For iLogic/API, you will need to alter the Flange type and change the parameters programmatically. Or, you change the Flange type before starting the rule. Then you only need to change the parameter values.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes

Anonymous
Not applicable

Yes I know, but can i get just a simple VBA code to change the flangewidth ?

0 Likes

Ralf_Krieg
Advisor
Advisor

Hello

 

Don't know if the additional options are correct in your case.

Private Sub FlangeHeight()

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

Dim oFeatures As SheetMetalFeatures
Set oFeatures = oPartDoc.ComponentDefinition.Features

Dim oFlange As FlangeFeature
Set oFlange = oFeatures.FlangeFeatures.Item(1)

Dim oFlangeDef As FlangeDefinition
Set oFlangeDef = oFlange.Definition

Call oFlange.SetEndOfPart(True)

Call oFlangeDef.SetDistanceHeightExtent("2 in", kPositiveExtentDirection, kHeightDatumOuter)

Call oPartDoc.ComponentDefinition.SetEndOfPartToTopOrBottom(False)

End Sub

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes