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

Sadly, I cannot get this to work.

dleesuk_0-1710103805550.png

And as many, many times before, I don't know where to go with this error.

Sub Main()
Dim oDoc As Document
oDoc = ThisDoc.Document
Dim Doctype As String = "Drawing"

Dim oNote As GeneralNote
Dim xTextPos As Double
Dim yTextPos As Double
Dim yTextPosDXF As Double
Dim MyTextStyle As TextStyle
MyTextStyle = oNote.TextStyle.Name

If oDoc.DocumentType = kDrawingDocumentObject Then
	Select SheetSize
		Case "A3"
			oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize
			xTextPos = 1.5
			yTextPos = xTextPos
			yTextPosDXF = 28.25
			MyTextStyle = "Note Text LARGE (ISO)"
		Case "A2"
			oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize
			xTextPos = 1.5
			yTextPos = xTextPos
			yTextPosDXF = 40.5
			MyTextStyle = "Note Text LARGE (ISO)"
		Case "A1"
			oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA1DrawingSheetSize
			xTextPos = 2.75
			yTextPos = xTextPos
			yTextPosDXF = 56.75
			MyTextStyle = "Note Text (ISO)"
		Case "A0"
			oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA0DrawingSheetSize
			xTextPos = 2.75
			yTextPos = xTextPos
			yTextPosDXF = 81.5
			MyTextStyle = "Note Text (ISO)"
	End Select
End If

MoveText(xTextPos, yTextPos, yTextPosDXF, MyTextStyle)

End Sub

Function MoveText(xPOS, yPOS, yPOSDXF, SetTextStyle)
	Dim oNote As GeneralNote
	If ActiveSheet.Size = "A1" Or ActiveSheet.Size = "A0" Then
		For Each oNote In ThisDoc.Document.ActiveSheet.DrawingNotes.GeneralNotes
			If oNote.Text.Contains("NOTES:") Then
				oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOS)
				oNote.Position = oPoint
				oNote.TextStyle = oNote.Item(1).TextStyle(SetTextStyle)
			End If
			If oNote.Text.Contains("PACK REVISION") Then
				oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOSDXF)
				oNote.Position = oPoint
			End If
		Next
	Else
		For Each oNote In ThisDoc.Document.ActiveSheet.DrawingNotes.GeneralNotes
			If oNote.Text.Contains("NOTES:") Then
				oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOS)
				oNote.Position = oPoint
				oNote.TextStyle = SetTextStyle
			End If
			If oNote.Text.Contains("PACK REVISION") Then
				oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOSDXF)
				oNote.Position = oPoint
			End If
		Next
	End If
End Function

 

Not a programmer and never will be!!!   :slightly_smiling_face:


Regards

Darren