Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
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: 

Open a file from Assembly with iLogic

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
1299 Views, 5 Replies

Open a file from Assembly with iLogic

Hi,

 

is there a iLogic rule to open a part froma the assembly browser?

I tried this code but it doesent work 😞

 

compo = Component.InventorComponent("Obere Rahmen:1")
compo.Open

5 REPLIES 5
Message 2 of 6
MechMachineMan
in reply to: Anonymous

Try delving deeper into the API Help, and going through some examples rather than posting 10 million times on the forums trying to get other people to do your work for you.

Also, the "SEARCH THIS BOARD" feature is superb. I suggest you give it a try.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 6
nbarbars
in reply to: MechMachineMan

So helpful... Maybe you're doing the small amount of work for them (if you know API and iLogic, this would take you less than 5 minutes), but you're helping countless people years later dealing with the same issue. These few lines you could've posted would have been great help to further learn this coding, as most of us will learn by trial and error.

Message 4 of 6
MechMachineMan
in reply to: nbarbars

1. Do you think I was magically born with all of this knowledge, or did I perhaps go through the same struggles of trial and error with this?

 

2. You're not entitled to anyone's help. Maybe reconsider your perspective. Would helping people be the "nice" thing to do? Yes. Is helping people a requirement/owed to people? No.

 

3. Read and learn. It's a sloppy mix of iLogic and vb.net, but it works.

Sub Main()
	OpenDocByBrowserName("PartB:1")
End Sub

Sub OpenDocByBrowserName(oBrowserName)
	Dim compOcc As Inventor.ComponentOccurrence
	Try
		compOcc = Component.InventorComponent(oBrowserName)
	Catch
		MsgBox("Issue finding browser name." & vbLf & vbLf & Chr(34) & oBrowserName & Chr(34))
		Exit Sub
	End Try
	
	Dim oDoc As Inventor.Document
	oDoc = compOcc.Definition.Document
	oDocName = oDoc.FullDocumentName
	
	Try
		ThisApplication.Documents.Open(oDocName, True)
	Catch
		MsgBox("File has not been saved or other issue opening file occurred" & vbLf & vbLf & Chr(34) & oBrowserName & Chr(34))
		Exit Sub
	End Try
End Sub

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 5 of 6
nbarbars
in reply to: MechMachineMan

These few lines you posted has been great help to further learn this coding, as I mostly learn by trial and error. Thank you.

Message 6 of 6
Curtis_Waguespack
in reply to: Anonymous

Hi everyone,

 

here is another example for doing this, that I use... 

 

oOcc = "PartA:1"

Try 
	ThisDoc.Launch(Component.InventorComponent(oOcc).Definition.Document.FullFileName)
Catch
End Try

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
 

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

Post to forums  

Autodesk Design & Make Report