Add iProperties value, print values and then before document save, remove values

Add iProperties value, print values and then before document save, remove values

jmcgookin
Explorer Explorer
531 Views
2 Replies
Message 1 of 3

Add iProperties value, print values and then before document save, remove values

jmcgookin
Explorer
Explorer

Hello there.

I have the need to create a project # and project name value and place it on my title block. These values should only appear on a printed PDF file and not be saved on the drawing file. I need to have a global iProperty that allows me to enter the project # and project name and then any drawings I open after this is set, would populate these values on the drawing and remove them (suppress perhaps) before the drawing saves. Then for the next project, I would change these values and repeat the process. I know this can be done with coding, I am just to knew to iLogic and have only written basic code and forms to drive my skeletal models.

 

You may be asking yourselves, why do I want this "typically required" title block data to disappear before saving and not be stored with the detail drawing?? Reason is we have a library of parts that are not tied to any customer or project as they reside in our library. We print the clean document (without ties to customer or project data) and then hand write in the qty's and project data.

 

Any help and steps in the right direction would be greatly appreciated!

 

Thanks in advance to all of you,

Jeremy

 

 

0 Likes
Accepted solutions (2)
532 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

You could make a text file with the data that you want to set to the iproperties. For example you create a text file with  2 lines. the first for the "Description" and the second for the "Part Number".  then you could make an iLogic rule that looks like this and use the trigger "After Open Documet" and "After Save Document".

Dim path As String = "C:\temp\projectdata.txt"
Dim lines As IEnumerable(Of String) = IO.File.ReadLines(path).ToArray()
iProperties.Value("Project", "Description") = lines(0)
iProperties.Value("Project", "Part Number") = lines(1)

then add a 2e rule that looks like this and use the trigger "Before Save Document"

iProperties.Value("Project", "Description") = ""
iProperties.Value("Project", "Part Number") = ""

  

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

jmcgookin
Explorer
Explorer
Accepted solution

This worked out great! Thank you. Had to make a minor change for my application as follows:

1st rule:

Dim path As String = "C:\temp\projectdata.txt"

Dim lines As IEnumerable(Of String) = IO.File.ReadLines(path).ToArray()

iProperties.Value("Custom", "Project Number") = lines(0)

iProperties.Value("Custom", "Project Name") = lines(1) 

 

The "Custom" field change was required as the "Project" field pulls data from existing iProperties. This took me a few minutes to figure out why I was getting the errors I was.

 

Jeremy

0 Likes