Hi
The title blocks that we use have prompted entries in them and I would like to find a way using iLogic to copy the entries from one title block to another within the same drawing; i.e.. if the user decides to change from an A2 to A1 drawing.
I already have an iLogic rule which allows the user to change the active border, title block and sheet size based on a form selection but would like it to capture the prompted entries already entered and re-use them after the change.
Any ideas?
Mike
This is an interesting problem. I will take a look and see if I can come up with something.
Maybe you already know this, but if you use custom iProperties to populate your title blocks instead of prompted entry, then the values would be preserved when switching title blocks. Another advantage of iProperties is that if you add more sheets to a drawing, you don't have to fill in the info again and again for each sheet. It automatically fills in each title block from the iProperties.
It will take a little work to switch your title blocks to the iPropery method, but it's something to think about...
Cameron Whetten
Inventor 2012
Hi Cameron
Thanks for the reply. I personally prefer to use the iProperties method for the reasons that you have already said but unfortunately the title blocks that we have to use on this project belong to the customer and we are unable to change their templates unfortunately. Curiously, some fields are populated from custom iProperties but others are prompted entries.
Mike
One more thing, the number of prompted entries is different on each sheet size as follows
A0 - 27 entries
A1 - 21 entries
A2 - 15 entries
A3 - 15 entries
For some unknown reason they have setup the mod revision blocks as part of the title block prompted entries
Mike
str1 = GetPromptedText(oSheet.TitleBlock, "<Name of Field Text 1>") str2 = GetPromptedText(oSheet.TitleBlock, "<Name of Field Text 2>") str3 = GetPromptedText(oSheet.TitleBlock, "<Name of Field Text 3>") Private Function GetPromptedText(TitleBlock As TitleBlock, Prompt As String) As String ' Initialize the return value. GetPromptedText = "" ' If there are < or > signs in the prompt replace them with the xml equivalent. If InStr(Prompt, "<") <> 0 Then Prompt = Replace(Prompt, "<", "<") End If If InStr(Prompt, ">") <> 0 Then Prompt = Replace(Prompt, ">", ">") End If Dim oTextBox As Inventor.TextBox For Each oTextBox In TitleBlock.Definition.Sketch.TextBoxes ' Check to see if this text box defines a prompted string. If Left$(oTextBox.FormattedText, 7) = "<Prompt" Then ' Extract the prompt string, which is used as the ' unique identifier for this text box. Dim strPrompt As String strPrompt = Right$(oTextBox.FormattedText, Len(oTextBox.FormattedText) - InStr(oTextBox.FormattedText, ">")) strPrompt = Left$(strPrompt, InStr(strPrompt, "<") - 1) ' Check to see if this is the specified prompted text. If strPrompt = Prompt Then ' Get the current value of the prompt for this title block. GetPromptedText = TitleBlock.GetResultText(oTextBox) Exit Function End If End If Next End Function Private Function SetPromptedText(TitleBlock As TitleBlock, Prompt As String, NewValue As String) As Boolean ' Initialize the return value. SetPromptedText = False ' If there are < or > signs in the prompt replace them with the xml equivalent. If InStr(Prompt, "<") <> 0 Then Prompt = Replace(Prompt, "<", "<") End If If InStr(Prompt, ">") <> 0 Then Prompt = Replace(Prompt, ">", ">") End If Dim oTextBox As Inventor.TextBox For Each oTextBox In TitleBlock.Definition.Sketch.TextBoxes ' Check to see if this text box defines a prompted string. If Left$(oTextBox.FormattedText, 7) = "<Prompt" Then ' Extract the prompt string, which is used as the ' unique identifier for this text box. Dim strPrompt As String strPrompt = Right$(oTextBox.FormattedText, Len(oTextBox.FormattedText) - InStr(oTextBox.FormattedText, ">")) strPrompt = Left$(strPrompt, InStr(strPrompt, "<") - 1) ' Check to see if this is the specified prompted text. If strPrompt = Prompt Then ' Set the value of the prompt for this title block. Call TitleBlock.SetPromptResultText(oTextBox, NewValue) SetPromptedText = True Exit Function End If End If Next End Function
I think this should work for what your trying to do. This is a piece of a larger macro that I wrote to change sheet sizes for our templates. Not sure how it will do swapping between the different counts of prompted text since all of ours have three prompted text for each size, but I think it answers your question.
Cameron,
I have been using the Prompted Entry method since I first started learning this program (2 years ago) and have always wondered if there was a better way of creating new sheets within the same drawing without having to enter the title block information over and over. Now that I have some free time to do some spring cleaning on drawings, templates, etc... could you please give a brief outline or point me in the direction of how to utilize the iProperties in a drawing sheet in order to allow me to enter Title Block information (drawing title, client name, address, etc....) and not have to repeatedly enter it as I make new drawing sheets.
Sorry to the OP for hijacking the thread.
Attached a sample, just edit the definition and check how the fields are defined, etc. Took out company logo.
All the values are in the dwg iproperties. You can even make your own custom fields as we did if you want.
Dan--
Steven's example is great, take a look at it.
Placing the property fields into your title block is very similar to placing prompted entry fields. However, instead of picking Prompted Entry from the Type drop-down, choose a property set. Usually, you will choose from Properties - Drawing or Custom Properties - Drawing, but you can also choose from any of the property sets. (Choosing any of the Model property sets will get the properties from the model in the first view that is placed on the sheet. This is handy for detailing parts if your parts already have part numbers set up.)
Then you pick a property from the next drop-down to the right, then you push the insert button to place the field in the text box. See the image.
Cameron Whetten
Inventor 2012
Thanks Cameron, I'll have a look at it tomorrow morning when I'm back in work
Mike
Once you start you will figure out how simple it really is. You can design all custom fields if you want so they are all in one spot, or use predefined fields, or as most do a combination of both. The good thing is that all sheets will share the same information so you wont have to keep typing everything again. Of course if like some you put a single part on a sheet, then the title might have to remain a propmpted entry, or any field requiring a unique entry from sheet to sheet.
Just remember the text block you place may not fit, but that does not mean the text entry will not. For example my sheet size textblock looks like it doesn't fit in the spot provided, but the entry is set for centered within the text block confines.
Hey mrattray,
Wasn't aware of that, but am using 2011, would be nice tho, as digging thru the iproperties is a pain sometimes, but know where all my entry fields are 🙂
Thanks for the code, I haven't been able to check it out since you sent it over as I've been busy the last couple of days with work; annoying how work gets in the way of interesting projects. Anyway, I think I understand what you have done and I'll certainly let you know how I get on once I get back on to it.
Cheers
Mike