Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vb.Net - Show Extrusion Dialog Box

1 REPLY 1
Reply
Message 1 of 2
isocam
109 Views, 1 Reply

Vb.Net - Show Extrusion Dialog Box

Can anybody help?

 

Using Vb.Net, I am trying to show Inventor's "Extrusion Dialog Box".

 

Basically, I am checking the extrusion size against standard steel plate material thicknesses. If the extrusion size does not match standard steel metal plate thicknesses I want to show the "Extrusion Dialog Box" so that the user can easily make the change required.

 

I have the following code, but I cannot get it to work.

 

Dim oCMD As ControlDefinition

oCMD = m_inventorApplication.CommandManager.ControlDefinitions("SheetMetalStylesCmd")

Dim InvApp As Inventor.Application = ThisApplication

oCMD = m_inventorApplication.CommandManager.ControlDefinitions("PartDMExtrudeCmd")

Dim oDoc As Inventor.PartDocument

oDoc = m_inventorApplication.ActiveEditDocument

Dim oFeature As Inventor.PartFeature

oFeature = oDoc.ComponentDefinition.Features.ExtrudeFeatures(1)

oDoc.SelectSet.Clear

oDoc.SelectSet.Select oFeature

Dim oControlDef As Inventor.ControlDefinition

oCMD = m_inventorApplication.CommandManager.ControlDefinitions("PartNGxExtrudeEditCtxCmd")

oCMD.Execute

 

Does anybody know what is wrong with the code and rectify it for me?

 

Many thanks in advance!

 

Darren

1 REPLY 1
Message 2 of 2
WCrihfield
in reply to: isocam

Hi @isocam.  I just create this test code in an iLogic rule, in a part, ran it, and it worked OK.  So, the command seems to be OK.  I assume you are running your code from Visual Studio, due to formatting and use of certain variables.  Is there any other reference in your references that also has a ControlDefinition Type object?  If so, you may need to be more specific in your first line (As Inventor.ControlDefinition instead of just As ControlDefinition).  Why did you create a variable for the Inventor.Application, then not use it anywhere?  Why create a variable for a ControlDefinition, then not use it (3rd line from bottom)?  Your line for selecting the feature seems to maybe be something copied over from VBA, because it does not include the () symbols, which I believe are necessary in vb.net?

Dim oPDoc As PartDocument = ThisApplication.ActiveEditDocument
Dim oExtFeat As ExtrudeFeature = oPDoc.ComponentDefinition.Features.ExtrudeFeatures.Item(1)
Dim oCDs As ControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
Dim oCD As ControlDefinition = oCDs.Item("PartNGxExtrudeEditCtxCmd")
oPDoc.SelectSet.Clear
oPDoc.SelectSet.Select(oExtFeat)
oCD.Execute

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report