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

Show Inventor "Extrude" Dialog Box Using a VBA Macro

Can  anybody help???

 

Is it possible, using a VBA macro to show the "Extrude" dialog box?

 

I have a macro that runs whenever I press the save button. One of the things the macro does is to check the extrusion size to standard material thicknesses. This is used for parts that require laser cutting. If the extrusion thickness is not a standard thickness then I want to automatically show the "Extrusion" dialog box so that the user can simply change the extrusion size. Is it possible to do this?

 

Many thanks in advance!!

 

Darren

bradeneuropeArthur
in reply to: isocam

With the commandmanager this should be possible.

Dim cmd as thisapplication.commanđmanager("command")

Cmd.execute

 

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

DRoam
in reply to: isocam

Hi, you can do that using the CommandManager like so:

 

VBA:

'~~~~~Get the Part document~~~~~
Dim oDoc As Inventor.PartDocument
Set oDoc = ThisApplication.ActiveEditDocument

'~~~~~Get the Extrude feature~~~~~
Dim oFeature As Inventor.PartFeature
Set oFeature = oDoc.ComponentDefinition.Features.ExtrudeFeatures(1)

'~~~~~Select and edit extrude feature~~~~~~
oDoc.SelectSet.Clear
oDoc.SelectSet.Select oFeature

Dim oControlDef As Inventor.ControlDefinition
Set oControlDef = ThisApplication.CommandManager.ControlDefinitions("EditExtrudeCtxCmd")
oControlDef.Execute

iLogic:

'~~~~~Get the Part document~~~~~
Dim oDoc As Inventor.PartDocument = ThisDoc.Document

'~~~~~Get the Extrude feature~~~~~
Dim oFeature As Inventor.PartFeature = oDoc.ComponentDefinition.Features.ExtrudeFeatures(1)

'~~~~~Select and edit extrude feature~~~~~~
oDoc.SelectSet.Clear
oDoc.SelectSet.Select(oFeature)

Dim oControlDef As Inventor.ControlDefinition = ThisApplication.CommandManager.ControlDefinitions("EditExtrudeCtxCmd")
oControlDef.Execute

Tailor as necessary to work with your existing code and get the appropriate Extrude feature.