How to launch an iFeature with only one button inside a form?

How to launch an iFeature with only one button inside a form?

moraesorlando
Advocate Advocate
946 Views
6 Replies
Message 1 of 7

How to launch an iFeature with only one button inside a form?

moraesorlando
Advocate
Advocate

Hello fellow inventor’s Experts

 

I am facing the needs of launch an iFeature using only one button located in a form.

 

I am already have an iFeature developed and working 100%.

 

Currently, when I need to insert this iFeature is required to go to Manage > Insert iFeature and use the browser to be looking for this iFeature *.ide files.

 

 

My target is to reduce this process for one only button and eliminate all other steps.

 

My idea about how this is going to work is to create a code that automatically will insert the iFeature.

This code will contain the commands and the path where the iFeature is stored.

 

Once all my iFeaures (*.ide) files are stored in only one path I believe that is possible to programming a button to reach and insert a specific iFeature.

 

I have an idea how this could work, but I don’t know how to create the code.

I would like to get help from the colleagues to build this code.

 

I have attached the file with the form and the button that will receive the code;

I have also attached a workflow to helps to clarify my idea;

And I have attached the iFetaure file to reduce the time of the colleague that will help.

 

I am available to supply any other necessary information.

 

Thanks in advance for everyone that can help.

 

Best regards,

0 Likes
Accepted solutions (1)
947 Views
6 Replies
Replies (6)
Message 2 of 7

JhoelForshav
Mentor
Mentor
Accepted solution

@moraesorlando 

Create a rule like this and add it to your form 🙂

'ifeature filename
Dim _iFeature As String = "C:\Users\Public\Documents\Autodesk\Inventor 2020\Catalog\Punches\curved slot.ide"
'get commandmanager
Dim cmdMgr As CommandManager = ThisApplication.CommandManager
'Post filename to commandmanagers internal clipboard
cmdMgr.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, _iFeature)
'Execute ifeature command
cmdMgr.ControlDefinitions("PartiFeatureInsertCmd").Execute
Message 3 of 7

moraesorlando
Advocate
Advocate

Hello @JhoelForshav !!!

 

Once again you solved the case. It is exactly what I was expecting!

 

Thank you very much. I have already gave you the deserved like. Just one more thing before mark this post as solved.

 

Is it possible to use an ilogic to program a button to open a pdf file?

Another button , not this one we are talking about open iFeature.

 

Thanks in advance for all the help.

 

Best regards,

0 Likes
Message 4 of 7

JhoelForshav
Mentor
Mentor

Hi @moraesorlando 

To open a pdf file you can use Process.Start("PathAndFileName")

like this:

Process.Start("C:\TEMP\Test.pdf")

If you want to browse to the pdf to open you can do something like this:

Dim oDlg As Inventor.FileDialog
ThisApplication.CreateFileDialog(oDlg)
oDlg.Filter = "PDF files (*.pdf)|*.pdf"
oDlg.OptionsEnabled = False
oDlg.ShowOpen
If oDlg.FileName <> "" Then Process.Start(oDlg.FileName)

 

Message 5 of 7

moraesorlando
Advocate
Advocate

Hello @JhoelForshav  congratulations for you!

One more time you have solved the case.

 

I will close this post as resolved.

 

Thank you very much for your help and I hope see in you in my next Inventor's pursuits.

 

Best regards,

0 Likes
Message 6 of 7

btoeringFTRKA
Participant
Participant

Good morning,

I use your written code for more then one iFeature.ide. I note that the post filename to the clipboard is not the filename according to the rule that I run. Looks like the clipboard must be reset first? before running:

'Post filename to commandmanagers internal clipboard
cmdMgr.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, _iFeature)
'Execute ifeature command
cmdMgr.ControlDefinitions("PartiFeatureInsertCmd").Execute

If my statement is correct, I look forward to your solution.

 

Many thanks,

Bas

0 Likes
Message 7 of 7

btoeringFTRKA
Participant
Participant

FYI

In another topic my question (6/6) was answered. Have a nice day

Bas

0 Likes