Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Pineapple2024
in reply to: leebrg

Sheet don't have scale.  View does.

Sub Main()
Dim oDoc As Document
Dim oIDWFile As DrawingDocument
Dim oSheet As Sheet
Dim oDrawingView As DrawingView
Dim oScale As String
Dim oTime As String

oTime = Now.ToShortDateString
iProperties.Value("Project", "Creation Date") = oTime

oScale = "1 / 10"
oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
	oIDWFile = TryCast(oDoc, DrawingDocument)
	oSheet = oIDWFile.ActiveSheet
	For Each oDrawingView In oSheet.DrawingViews
		Logger.Info(oDrawingView.ScaleString)
		If (oDrawingView.ViewType = DrawingViewTypeEnum.kStandardDrawingViewType) Or
			(oDrawingView.ViewType = DrawingViewTypeEnum.kProjectedDrawingViewType)
			'Assignment fail if same scale
			If oDrawingView.ScaleString <> oScale
				oDrawingView.ScaleString = oScale
			End If
		End If
	Next
	oSheet.Update
End If
End Sub