Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic code for opening any files

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

iLogic code for opening any files

Hi

I have an external rule to fill my title block.

I use a different rule for each project.

I use a simple TXT files

I'm looking for a rule wich allows me to look for my rules anywhere on our server.

 

What should be the code?

 

Thanks

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

Why don't you just use a single rule with end user input to fill the titleblocks?

 

Are the rules set up to a trigger?

 

If so, just set a flag based on each project for when the rule gets triggered so it knows what to run....

 

Seems to me like this would likely be much easier than managing a gazillion different text files...


--------------------------------------
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
Curtis_Waguespack
in reply to: Anonymous

Hi Sprocket107,

 

I think a lot more information is needed, can you post the rule that looks for the file, etc.

 

Maybe a better way would be an excel file with each project listed by project number along with the other info, then we'd just look up the info by project number, from a single file, that you would update with each new project? Just a thought.

 

Excel Project List.PNG

 

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

Message 4 of 6
Anonymous
in reply to: Curtis_Waguespack

Hi Curtis

 

Here is the kind of rule I want to use.

 

TITLE-BLOCK-INFO.txt

 

iProperties.Value("Summary", "Company") = "COMPANY"
iProperties.Value("Summary", "Subject") = "SUBJECT"
iProperties.Value("Summary", "Category") = "CATEGORY"

ETC...

 

I will fill those infos for each project.

I will copy and place this file into the client directory.

I want to use the same IDW template for all our project.

 

I will place a rule in the template wich allows the user to get the "TITLE-BLOCK-INFO.txt" in the client directory and it will fill the title block automaticaly, each time he create a new drawing.

I want the user to run the rule manualy, because I dont want to change my template for each project.

 

Maybe the rule can keep the last directory in mind so we don't have to click so much directory back and forth.

 

You know, I think this is a good idea for our kind of job but maybe there is a better way to do this.

 

Thanks again.

Message 5 of 6
Curtis_Waguespack
in reply to: Anonymous

Hi Sprocket107,

 

 

Something like this could work, see attached Inventor 2015 file.

 

This expects the text file to be in the same folder as the drawing file, so it knows where to look.

 

Example:

C:\TEMP\72145-\72145-001.idw

C:\TEMP\72145-\Title Block Info.txt

 

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

 

'get the text file
'expects to find text file in same folder as 
'the current file
oFile = ThisDoc.Path & "\" & "Title Block Info.txt"

'read the file
oRead = System.IO.File.OpenText(oFile)
EntireFile = oRead.ReadToEnd()
oRead.Close()

'create aray from text info
'splitting at that comma
oSplit = Split(EntireFile,",")

iProperties.Value("Summary", "Company") = oSplit(0)
iProperties.Value("Summary", "Subject") =  oSplit(1)
iProperties.Value("Summary", "Category") =  oSplit(2)

InventorVb.DocumentUpdate()
Message 6 of 6
Anonymous
in reply to: Curtis_Waguespack

Hi Curtis

This is absolutely good.

 

Thank you very much.

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

Post to forums  

Autodesk Design & Make Report