replacing a border and title block in an existing drawing ilogic

Not applicable
07-05-2017
08:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have found an ilogic that works for me but when the drawing border and title block is the same name..it doesn't update!! probably because it thinks that its the same even though I have done the modification in our template file.
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 7995 StartFragment: 314 EndFragment: 7963 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
'delete sheet formats ThisDrawing.ResourceFileName = "K:\Mech\INVENTOR2016\Inventor Resources\Templates\RAUTE_2016.dwg" ThisDrawing.KeepExtraResources = True Dim oDoc As DrawingDocument oDoc = ThisApplication.ActiveEditDocument Dim oCurrentNumber As Sheet oCurrentNumber = oDoc.ActiveSheet ' Iterate through the sheets, and delete the title blocks and symbols Dim oSheet As Sheet For Each oSheet In oDoc.Sheets oSheet.Activate Try oSheet.TitleBlock.Delete Catch 'catch error if no border found End Try 'set new border ActiveSheet.TitleBlock = "RAUTE A TITLE BLOCK" Try oSheet.Border.Delete Catch 'catch error if no border found End Try 'set new border ActiveSheet.Border = "RAUTE A-SIZE BORDER" Next 'set back to original sheet oCurrentNumber.Activate
what I end up doing is running this code first to rename the old blocks, what I want to do is to combine them... and delete the RAUTE A-SIZE BORDER-OLD
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 14307 StartFragment: 314 EndFragment: 14275 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
oDoc = ThisDoc.Document Dim oSheets As Sheets Dim oSheet As Sheet Dim oTitleBlock As TitleBlock oSheets = oDoc.Sheets For Each oSheet In oSheets 'handle errors 'such as a sheet with no title block present On Error Resume Next 'look at title blocks oTitleBlock = oSheet.TitleBlock For Each oTitleBlock In oDoc.TitleBlocks If oTitleBlock.Name = "RAUTE A TITLE BLOCK" Then 'rename the instance of the sheet oTitleBlock.Name = "RAUTE A TITLE BLOCK-OLD" 'also rename the definition in the Drawing Resources folder oTitleBlock.Definition.Name = "RAUTE A TITLE BLOCK-OLD" Else If oTitleBlock.Definition.Name = "RAUTE A TITLE BLOCK" Then 'rename the definition in the Drawing Resources folder oTitleBlock.Definition.Name = "RAUTE A TITLE BLOCK-OLD" Else End If Next oBorder = oSheet.Border For Each oBorder In oDoc.Border If oBorder.Name = "RAUTE A-SIZE BORDER" Then 'rename the instance of the sheet oBorder.Name = "RAUTE A-SIZE BORDER-OLD" 'also rename the definition in the Drawing Resources folder oBorder.Definition.Name = "RAUTE A-SIZE BORDER-OLD" Else If oBorder.Definition.Name = "RAUTE A-SIZE BORDER" Then 'rename the definition in the Drawing Resources folder oBorder.Definition.Name = "RAUTE A-SIZE BORDER-OLD" Else End If Next Next
Thanks in advance for the help!