- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I have been working on my drawing template and so far I have been able to set up the sheet formats correctly and a few other things but my issue is we have 2 different title blocks dependant on what the drawing is for. This is easily determined by the file type of the object in that sheets drawing view. Basically .ipt gets one title block and .iam gets the other type. Below is the iLogic I have created so far however I am getting the error code as follows.
Error on Line 26 : Property 'TitleBlock' is 'ReadOnly'.
If I erase the code I can easily double click the titleblock and manually add it but I would like this to be automated.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
' Get the file extension of the active drawing view
Dim drawingView As DrawingView = oDoc.ActiveSheet.ActiveView
Dim drawingViewExtension As String = System.IO.Path.GetExtension(drawingView.ReferencedFileDescriptor.FullFileName).ToLower()
' Define the title block names
Dim titleBlockIPT As String = "Production Drawing Title Block"
Dim titleBlockIAM As String = "Assembly Drawing Title Block"
Dim defaultTitleBlock As String = "DefaultTitleBlock"
' Assign the appropriate title block based on the file extension
Dim titleBlockName As String = defaultTitleBlock ' Default title block
Select Case drawingViewExtension
Case ".ipt"
titleBlockName = titleBlockIPT
Case ".iam"
titleBlockName = titleBlockIAM
End Select
' Set the title block for the active sheet
oDoc.ActiveSheet.TitleBlock = titleBlockName
Solved! Go to Solution.