By David Gate
This blog explains how to extract a title block prompted entry value and make it an iProperty in both the drawing and the model.
The Inventor environment has many tools to make your drawing creation easier. Many people utilise the method of automatically populating their title block with the model iProperties. But sometimes the good old fashion prompted entry for populating your title block is the quickest and easiest option.
The one downside of the prompted entry is once filled in the text cannot easily be used elsewhere. Until now.
Attached is a little bit of illogic code that will extract any named prompted entry values, from any number sheet and copy it into any iProperties. I have also tagged on the end the code to write this code back into the referenced drawing model (part or assembly). It will only write back to the first original reference model (i.e. the first model referenced in the first drawing view) and it will only write to the top level assembly if applicable and not into all the sub parts and sub-assemblies.
The bits of code that you will maybe want to adapt are the following. Edit the “DRAWING NUMBER” case with the name of your prompted entry.
Change the i value to the sheet in question. I have left it as 1 as most people this will suffice.
Edit the iProperties.Value field if you want it writing back to a different one.
Case "DRAWING NUMBER"
oPromptEntry = oTitleBlock.GetResultText(oTextBox)
iProperties.Value("Project", "Part Number")=oPromptEntry
Duplicate this section of code if you want it to write back more than one prompted entry. ie
Case "DRAWING NUMBER"
oPromptEntry = oTitleBlock.GetResultText(oTextBox)
iProperties.Value("Project", "Part Number")=oPromptEntry
Case "APPROVED BY"
oPromptEntry = oTitleBlock.GetResultText(oTextBox)
iProperties.Value("Status", "Checked By")=oPromptEntry
The last bit of code to adapt will be the writing of properties back into the referenced model. I have given 2 choices but these lines can be duplicated the left-hand side are the iproperties you want updated in the referenced model and the right-hand side is the property in the drawing which is equal to the prompted entries.
iProperties.Value(ddoc, "Custom", "Drawing No") = iProperties.Value("Project", "Part Number")
This rule would probably be best set to run on save.
I have to say thanks to Curtis Waguespack for his initial code which I have adapted.
Comments
0 comments
Please sign in to leave a comment.