Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
snichols
716 Views, 5 Replies

Zoom all for silent drawing

I have the code below that opens a drawing "silently" and adds a sheet with a border and title block to it. I need to do a zoom all on the sheet but can't figure out how to do it when the drawing is silent. There are no views on the sheet yet, it is just a blank sheet. Can anybody point me in the right direction? Thanks in advance!

 

'Open the drawing template silently
dwgFile = ThisDoc.Path() & "\Dwgs\Musco Pole.dwg" '<- Change Drawing name here
Dim oDrawDoc as DrawingDocument = ThisApplication.Documents.Open(dwgFile, False)
Dim oSheet2 As Sheet
oSheet2 = oDrawDoc.Sheets.Add 
oSheet2.Activate
oSheet2.Name ="Layout2"
oSheet2.ExcludeFromPrinting = False
oSheet2.ExcludeFromCount = False

'get current size
Dim Size As DrawingSheetSizeEnum
Size = oSheet2.Size

'set new size
oSheet2.Size = DrawingSheetSizeEnum.kBDrawingSheetSize

Dim oBorder As Border = oSheet2.Border
Dim borderDef As BorderDefinition
oSheet2.AddBorder("PiRod Border") '<- Change Border name here

Dim oTitleBlock As TitleBlock = oSheet2.TitleBlock
Dim TitleBlockDef As TitleBlockDefinition
oSheet2.AddTitleBlock("Plymouth") '<- Change Title Block name here'ThisApplication.ActiveView.Fit '<- This doesn't work because the drawing is not the active document

'update sheet to see results
oSheet2.Update