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: 

Need to set multi-value parameter back to default

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
dtompsett
549 Views, 4 Replies

Need to set multi-value parameter back to default

Inventor 2011

 

So I'm using a parameter to launch an excel file that this specific Assembly references.  It's not embedded. 

 

I need the ability to launch the referenced excel file.  I have a parameter called "Launch_Excel" with No and Yes as options.

 

I need to write it such that, if it detects "Yes", that it launches Excel, and also sets that value back to "No".  I can't seem to get it to make this change while the parameter window is open.  Do I need to force Inventor to close the parameter window? 

 

 

Current code:

Format:HTML Format
Version:1.0
StartHTML: 165
EndHTML: 4650
StartFragment: 314
EndFragment: 4618
StartSelection: 314
EndSelection: 314

If Launch_Excel = "Yes" Then
Launch_Excel = "No"
Dim sheetName As String = ring_size
newExcelApp = CreateObject("Excel.Application")
newExcelApp.Visible = True

wb = newExcelApp.Workbooks.Open(IO.Path.Combine("X:\Autodesk\EVR Inventor Reference Files\", "retaining_ring_specs.xlsm"))
wb.Sheets(sheetName).Activate

End If

 

4 REPLIES 4
Message 2 of 5
MjDeck
in reply to: dtompsett

While you are editing the "Launch_Excel" parameter, the parameters dialog will not show value changes to it that are made by the rule.  It only shows the changes that you make directly to the cell. This is the way the multi-value list editing control (ComboBox) works within the table of parameters.  I will see if we can change it.

 The way it is now, if you click in another cell in the parameters dialog, you will see that the Launch_Excel value has changed back to Yes.

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 5
dtompsett
in reply to: dtompsett

Ok... makes sense. 

 

Now, would it be possible to:

 

open parameters, click "yes" from multi-value to launch excel file. 

 

Clicking Yes causes:

 

If param="Yes" then

-close parameter window

-set param back to "No"

-open parameter window

-launch excel file

 

 

 

Message 4 of 5
MjDeck
in reply to: dtompsett

Here's a modified version of your rule to do those steps:

 

If Launch_Excel = "Yes" Then
Dim oControlDef as ControlDefinition  = ThisApplication.CommandManager.ControlDefinitions.Item("AppSelectNorthwestArrowCmd")
oControlDef.Execute  ' start the default command (Select)

Launch_Excel = "No"
RuleParametersOutput() ' assign the modified value to the parameter right away

Dim sheetName As String = ring_size
newExcelApp = CreateObject("Excel.Application")
newExcelApp.Visible = True

wb = newExcelApp.Workbooks.Open(IO.Path.Combine("X:\Autodesk\EVR Inventor Reference Files\", "retaining_ring_specs.xlsm"))
wb.Sheets(sheetName).Activate 

oControlDef  = ThisApplication.CommandManager.ControlDefinitions.Item("AppParametersCmd")
oControlDef.Execute ' start the Parameters command

End If

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 5
dtompsett
in reply to: dtompsett

Awesome!  Works perfectly!   Smiley Happy

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

Post to forums  

Autodesk Design & Make Report