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 title block customization

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
128848
1416 Views, 5 Replies

iLogic title block customization

Good day!

 

Earlier I`ve used a simple code from Rob Cohee to update the title blocks and it works like a charm, however, now I would like to try to kick it up a notch.

If (ThisDrawing.ModelDocument Is Nothing) Then Return

modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

iProperties.Value("Project", "Part Number") = iProperties.Value(modelName, "Project", "Part Number")
iProperties.Value("Custom", "Client") = iProperties.Value(modelName, "Custom", "Client")


I`m working with several similar projects where the Inventor models and IDW`s is copied from one project to another. A typical project can consist of 50-75 drawings and the only properties needed to change is Client, project number and drawing number (consisting of the project number and a suffix, ex 123456789-125).

 

I would like to try to make an .ini file with these 3 properties in the root of the project folder so they can be changed and updated easily.

 

I`ve got a few ideas how it can be done, but I have to get back to them later due to the amount of work.

 

Kind regards

 

5 REPLIES 5
Message 2 of 6
jdkriek
in reply to: 128848

File would look like this, can be .txt, .ini ect

 

Project,Client

 Put this in an iLogic rule:

 

Dim FileName As String = "C:\Setup.ini" 
Dim objReader As New System.IO.StreamReader(FileName)
LineOfText = objReader.ReadLine()
Aryline = LineOfText.Split(",")
Dim Project As String = Aryline(0)
Dim Client As String = Aryline(1)
iProperties.Value("Project", "Part Number") = Project
iProperties.Value("Custom", "Client") = Client
objReader.Close()
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 6
128848
in reply to: jdkriek

Well this code is much more sophisticated then the one I`m working on.

Is there a library of some sort where I can search for functions like Aryline and objReader, cause thats the type of code Ì`m looking for but dosent know what it is.

 

The configuration file will be in the same folder as the .idw, so I edited the first line of the code. Works like a charm! Thank you 🙂  

 

Dim FileName As String = ThisDoc.Path & "\Project configuration.ini" 
Message 4 of 6
jdkriek
in reply to: 128848

Keep in mind that iLogic is watered down VB.NET so that's what I'm using 😉

 

http://msdn.microsoft.com/en-us/library/system.io.streamreader_methods.aspx

 

Glad that worked for you.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 5 of 6
Jez_Rowe
in reply to: jdkriek

Hi Jonathan,

 

I came across your post today and have tried your code which seems to work well. Thank you.  I would appreciate your help if possible.

I have a similar problem of a number of clients having the same drawings for a design. I wish to share the design so that any updates are referenced in all the drawing sets for each client. Each client drawing file would have their details on each drawing as per the ini file in each client file.

 

I need to change the following in my drawing:

 

1: Title which is the design Title and mapped to the iproperty Title

2: Company which is my company detail mapped to iproperty company

3: Project Prefix which is for example 03-DWG- mapped to iproperty Part Number

4: Project which is the name of the client and mapped to iproperty Project

 

I have not coded before, just cut and paste!

 

I need to combine two other values into the Part Number:- a Project Prefix & iproperties Revision Number & a custom drawing number. It should look like 03-DWG-A001. The revision number and custom drawing number would be changed via a global Form. This should then update the iproperty drawing part number before save. The rule should also be able to be applied to existing files to ensure they will update as per new files. Is there anyway of launching the global form from this external rule?

 

The code I have is:

 

SyntaxEditor Code Snippet

Dim FileName As String = ThisDoc.Path & "D:\Rowe Data 2015\Autodesk 2016\Templates\Title Block Project Details.ini"
Dim objReader As New System.IO.StreamReader(FileName)
LineOfText = objReader.ReadLine()
Aryline = LineOfText.Split(",")
Dim Title As String = Aryline(0)
Dim Company As String = Aryline(1)
Dim ProjectPrefix As String = Aryline(2)
Dim Project As String = Aryline(3)
iProperties.Value("Summary", "Title") = Title
iProperties.Value("Summary", "Company") = Company
iProperties.Value("Custom", "Project Prefix") = ProjectPrefix
iProperties.Value("Project", "Project") = Project
objReader.Close()

DWGNumber = Parameter("DWGNumber")
iProperties.Value("Custom", "Drawing Number") = DWGNumber
iProperties.Value("Project", "Part Number") = ProjectPrefix & iProperties.Value("Project", "Revision Number") & DWGNumber
iLogicVb.UpdateWhenDone = True

 

Message 6 of 6
jdkriek
in reply to: Jez_Rowe

Hi Jez,

Just got your recent PM - see my full reply there.


@Jez_Rowe wrote:

Is there anyway of launching the global form from this external rule?

 

To launch a global form, just use the following code in the rule:

 

 

iLogicForm.ShowGlobal("Form Name")
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


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

Post to forums  

Autodesk Design & Make Report