Extracting info from TitleBlock

Extracting info from TitleBlock

Anonymous
Not applicable
291 Views
3 Replies
Message 1 of 4

Extracting info from TitleBlock

Anonymous
Not applicable
I am extracting information from my TitleBlock (see code below), but I have some concerns... All information in the TitleBlock is being stored in a collection of TextBoxes, from 1 to TextBoxes.Count. I can extract the information, e.a. "MsgBox oTB.GetResultText(oTB.Definition.Sketch.TextBoxes(26))" is my Project Name. But what happens if one day the TitleBlock is being edited and someone deletes a TextBox that has become obsolete? That kinda messes with my program :-( Can I prevent that? ***** Sub ExtractInfoFromTitleBlock() Dim oDoc As DrawingDocument Set oDoc = ThisApplication.ActiveDocument Dim oTB As TitleBlock Set oTB = oDoc.ActiveSheet.TitleBlock Dim i As Integer For i = 1 To oTB.Definition.Sketch.TextBoxes.Count MsgBox i & " = " & oTB.GetResultText(oTB.Definition.Sketch.TextBoxes(i)) Next i End Sub
0 Likes
292 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I'm not sure how reliable using the index of the text box is anyway. If it appears to be working, then I guess it's ok. The only other potential solution I can see at this time is to look at the position of the text box. Instead of relying on it's index within the TextBoxes collection you could look for a specific text box based on it's position within the title block. This would also let you handle when a text box is deleted. You could approach this in a couple of different ways. One way is to look for a text box that has a specific origin. Another is to be a bit more flexible use the various other properties (origin, width, height, and possible justifications) to determine which text box is within a certain area of the title block. -- Brian Ekins Developer Technical Services, Autodesk Discussion Q&A: http://www.autodesk.com/discussion "Teun Ham" wrote in message news:404c9711$1_1@newsprd01... > I am extracting information from my TitleBlock (see code below), but I have > some concerns... > > All information in the TitleBlock is being stored in a collection of > TextBoxes, from 1 to TextBoxes.Count. > I can extract the information, e.a. "MsgBox > oTB.GetResultText(oTB.Definition.Sketch.TextBoxes(26))" is my Project Name. > > But what happens if one day the TitleBlock is being edited and someone > deletes a TextBox that has become obsolete? > > That kinda messes with my program :-( > > Can I prevent that? > > ***** > Sub ExtractInfoFromTitleBlock() > > Dim oDoc As DrawingDocument > Set oDoc = ThisApplication.ActiveDocument > > Dim oTB As TitleBlock > Set oTB = oDoc.ActiveSheet.TitleBlock > > Dim i As Integer > For i = 1 To oTB.Definition.Sketch.TextBoxes.Count > MsgBox i & " = " & > oTB.GetResultText(oTB.Definition.Sketch.TextBoxes(i)) > Next i > End Sub > > >
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks Brian, I will write a "TextBox Locator"-routine :-) Teun "Brian Ekins (Autodesk)" wrote in message news:404e0b7f$1_1@newsprd01... > I'm not sure how reliable using the index of the text box is anyway. If it > appears to be working, then I guess it's ok. The only other potential > solution I can see at this time is to look at the position of the text box. > Instead of relying on it's index within the TextBoxes collection you could > look for a specific text box based on it's position within the title block. > This would also let you handle when a text box is deleted. You could > approach this in a couple of different ways. One way is to look for a text > box that has a specific origin. Another is to be a bit more flexible use > the various other properties (origin, width, height, and possible > justifications) to determine which text box is within a certain area of the > title block. > -- > Brian Ekins > Developer Technical Services, Autodesk > Discussion Q&A: http://www.autodesk.com/discussion > > > > "Teun Ham" wrote in message > news:404c9711$1_1@newsprd01... > > I am extracting information from my TitleBlock (see code below), but I > have > > some concerns... > > > > All information in the TitleBlock is being stored in a collection of > > TextBoxes, from 1 to TextBoxes.Count. > > I can extract the information, e.a. "MsgBox > > oTB.GetResultText(oTB.Definition.Sketch.TextBoxes(26))" is my Project > Name. > > > > But what happens if one day the TitleBlock is being edited and someone > > deletes a TextBox that has become obsolete? > > > > That kinda messes with my program :-( > > > > Can I prevent that? > > > > ***** > > Sub ExtractInfoFromTitleBlock() > > > > Dim oDoc As DrawingDocument > > Set oDoc = ThisApplication.ActiveDocument > > > > Dim oTB As TitleBlock > > Set oTB = oDoc.ActiveSheet.TitleBlock > > > > Dim i As Integer > > For i = 1 To oTB.Definition.Sketch.TextBoxes.Count > > MsgBox i & " = " & > > oTB.GetResultText(oTB.Definition.Sketch.TextBoxes(i)) > > Next i > > End Sub > > > > > > > >
0 Likes
Message 4 of 4

Anonymous
Not applicable
I don't know if this is exactly what you're looking for. I had a similar (potential) problem with our title blocks. Our title blocks have the drawing scale in them, and since multiple sheets can exist in one idw file with different scales, I decided to make the drawing scale a prompted entry in the title block. In my code I find the prompted entry in the following way: For Each objTextBox In objActiveSheet.TitleBlock.Definition.Sketch.TextBoxes If objTextBox.FormattedText = "SCALE" Then Set objScale = objTextBox Next objTextBox This way, no matter what is added or deleted from the title block, my code will still find the "scale" prompted entry. HTH
0 Likes