03-10-2024
08:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-10-2024
08:40 AM
HI @A.Acheson,
I have generated a new style (Note Text Large (ISO)), but, sadly I can't get this to work as I don't know the full syntax of how to change swap it out.
I keep getting errors like "Reference to a non-shared member requires an object reference." and " 'TextStyle' is a type and cannot be used as an expression."
This is my code. I am moving some text around based on the sheet size as well as attempting to change the style.
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
If oDoc.DocumentType = kDrawingDocumentObject Then
Select SheetSize
Case "A3"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize
xTextPos = 1.5
yTextPos = xTextPos
yTextPosDXF = 28.25
Case "A2"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize
xTextPos = 1.5
yTextPos = xTextPos
yTextPosDXF = 40.5
Case "A1"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA1DrawingSheetSize
xTextPos = 2.75
yTextPos = xTextPos
yTextPosDXF = 56.75
GeneralNote.TextStyle() = TextStyle("Note Text LARGE (ISO)")
Case "A0"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA0DrawingSheetSize
xTextPos = 2.75
yTextPos = xTextPos
yTextPosDXF = 81.5
GeneralNote.TextStyle() = TextStyle("Note Text LARGE (ISO)")
End Select
End If
MoveText(xTextPos, yTextPos, yTextPosDXF)
End Sub
Function MoveText(xPOS, yPOS, yPOSDXF)
Dim oNote As GeneralNote
'MessageBox.Show("xPOS = " & xPOS & vbcrlf & "yPOS = " & yPOS , "XY POS")
If ActiveSheet.Size = "A1" Or ActiveSheet.Size = "A0" Then 'DrawingSheetSizeEnum.kA1DrawingSheetSize Then
For Each oNote In ThisDoc.Document.ActiveSheet.DrawingNotes
If oNote.Text.Contains("NOTES:") Then
oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOS)
oNote.Position = oPoint
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
If oNote.Text.Contains("NOTES:") Then
oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOS)
oNote.Position = oPoint
End If
If oNote.Text.Contains("PACK REVISION") Then
oPoint = ThisApplication.TransientGeometry.CreatePoint2d(xPOS, yPOSDXF)
oNote.Position = oPoint
End If
Next
End If
End FunctionI know I haven't set something regarding the GeneralNotes, but not sure what.
Any help is appreciated ![]()
Regards
Darren