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: 

iLogic Form Button to place ilogic component

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Arnold82
2358 Views, 6 Replies

iLogic Form Button to place ilogic component

Hello,

 

I wish to create a form that with multiple buttons. Each button will place another component (platform, stairs, ladder, railing)

 

I wish to place them using 'Place iLogic Component"

 

I know you can call this command by:

ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.PlaceComponent").Execute

 

But is it possible to automatically browse to and open a file this way using a path "C:\CPSVault\PlatformComponents\Stairs.iam" within this command?

 

Thanks in advance,

 

 

Arnold

 

 

 

 

 

 

6 REPLIES 6
Message 2 of 7
MegaJerk
in reply to: Arnold82

I feel like this blog post might hold the solution to this problem : http://adndevblog.typepad.com/manufacturing/2013/01/provide-command-parameters-using-postprivateeven... 

 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 3 of 7
Arnold82
in reply to: Arnold82

I haven't had time to try this yet

But it looks promising, thanks!

Message 4 of 7
Arnold82
in reply to: Arnold82

Thanks for helping me so far.

 

I manage to get a component placed using iLogic

 


oPath = ThisDoc.Path & "\"

oFile = "part.ipt"

Dim cm As CommandManager
cm = ThisApplication.CommandManager
cm.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oPath & oFile)
Dim cd As ControlDefinition

cd = cm.ControlDefinitions("iLogic.PlaceComponent")
'cd = cm.ControlDefinitions("AssemblyPlaceComponentCmd")

cd.Execute

 

But when I enter the place ilogic component window, the code continues to run while still in the ilogic dialog.

 

I wish the user to first select OK button, and place the part (only once) in the assembly.

 

Is this possible to 'delay' the rule till the user has placed a part in the assembly?

Secondly: Is it possible to cancel placing another occurrence? (like user pressing escape after placing first)

 

Thanks in advance,

 

Arnold

 

 

Message 5 of 7
adam.nagy
in reply to: Arnold82

Hi Arnold,

 

I think you're starting to run into the limitations of iLogic.

 

Using Execute2(True) you can run a command synchronously, however, I think because there is too much going on in case of the iLogic Place command (a new document and a dialog pop up) it will still run asychronously.

 

"AssemblyPlaceComponentCmd" on the other hand can be run synchronously using Execute2(True)

What exactly is it that you really need from the iLogic Place command? - showing the part document that is being placed or showing the parameters? 

Maybe there would be some other way to do it. 

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 6 of 7
Arnold82
in reply to: adam.nagy

Sorry for my late response, this is a side project of mine.

 

im trying to create an environment where you can easily add ladders and catwalks copies.

 

icopy and place ilogic components both create a new instance of the assembly (like copy design)

 

But they have some limitations in my situation, I will try "AssemblyPlaceComponentCmd" but have to figure out how to make new instances. That will be a lot of programming i guess.

 

Thx for the tips so far

Message 7 of 7
adam.nagy
in reply to: Arnold82

Hi Arnold,

 

You can copy the files with new names/new locations using the .NET API or Inventor's FIleManager, and then update the references in the files using ReplaceReference: http://adndevblog.typepad.com/manufacturing/2012/08/replace-the-file-reference-by-inventor-api.html

 

I hope this helps.

 

Cheers,



Adam Nagy
Autodesk Platform Services

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

Post to forums  

Autodesk Design & Make Report