- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have an interesting quandry. I have searched the forums and the general web for an answer for this to no avail.
The dialogue box below shows some general notes we use in our templates. The highlighted text is 3.5mm high and the rest is 2.5mm high (i.e. 1mm less than the NOTES: text).
What I can't find the answer to is, if I change the sheet size to, say, A1 from A2, I'd like that text size to increase to 4.5mm and 3.5mm respectively. I know that notes can be added and formatted via a rule and this would work fine if through the process of creating the drawing the notes didn't change. However, through the drawing process the notes will grow to contain more specific items pertaining to the part/fabrication being drawn. Occasionally, the sheet size may need to increase or decrease whilst the drawing process is underway and the notes have changed from the original template notes.
Notes on a finished drawing may look like this....
So, by using a rule to add the notes, I fear this may revert it back to the original notes if I decide to change the sheet size.
I do use a form to change the sheet size as this is the only way I can 'trigger' any iLogic rules I'll need.
So, my question is, how can I format text 'on the fly' without affecting the actual text within the notes?
I hope I've put that in an understandable way.
Thanks in advance ![]()
Regards
Darren
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HEllo @dleesuk ,
What are your thoughts on this : Instead of a text annotation, why not simply creating a user sketched symbol with prompted entries for each lines ? This way you could have something where you can add/delete lines by filling or not the extra entries. Then, for the scale, you could simply change the size of the sketched symbol on the sheet with a greater / lesser scale factor. This way you wouldn't go around touching the text itself.
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi FINET_Laurent,
Thank you for this potential solution. It's good in practice when you know what you want to ask.
However, we can never really know what entries we require until we're well into the drawing stage, so we aren't likely to know what 'prompted entry' questions to ask. Not all fabrication drawings are created equal ![]()
This may be something we look at in the future as I think it's a really good idea.
Thanks again!!
Regards
Darren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @dleesuk
One method you could use is to check the text note contents for key words such as NOTES: If found then change the general text style to match the sheet size. This will avoid overwriting the text. Following a style should be easier than trying to overwrite text size directly by code.
SyntaxGeneralNote.TextStyle() As TextStyle
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In the link to the general note text style supplied earlier there is a vba sample to add note from scratch and set the style. Here is the link again.
https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GeneralNote_TextStyle
Also your not looping through general notes collection.
Instead of this
For Each oNote In ThisDoc.Document.ActiveSheet.DrawingNotesIt should be
For Each oNote In ThisDoc.Document.ActiveSheet.DrawingNotes.GeneralNotesAnd when your setting the style you should use the variable you declared for the object
So instead of this
GeneralNote.TextStyle = "....."It should be
oNote.TextStyle = '......
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sadly, I cannot get this to work.
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!!! ![]()
Regards
Darren
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @dleesuk
Your error message is your referencing an object without telling the program where to source the object. And further more. The sample I supplied earlier was just looking at note 1 to pick up the style. What you need to do is look at the styles Manager to pick up your standard list of styles( the drop down list in the drawing when you select the note).
Here is a link to the start point of that the drawingdocumentstyles manager.
You would need to follow the objects down to an item within notes collection. Or you can do the opposite and follow it back from general note.style and check the accessed from collection at the bottom, see image.
Syntax DrawingDocument.StylesManager() As DrawingStylesManager
Syntax
DrawingStylesManager.TextStyles() As TextStylesEnumerator
Dim oStlMgr As DrawingStylesManager = oDoc.StylesManager
Dim oTextStyle as TextStyle = oStlMgr.TextStyles.Item(1)
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks again for your reply.
Sadly, this is beyond my understanding.
The examples you show don't make sense to me. I've looked through the VBA samples and I don't know what objects I need to point to, etc.
I need to learn more of the object model to be able to progress with this.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @darren.lees
Yes this can be tricky if you haven't debugged your own work extensively.
1/2. On Line 10 you declare an object as a style Then in line 11 set it as a string which is incorrect. Additionally the oNote object is only created in the function MoveText so this is also the incorrect position. What you wanted to do was to select a style object from the user interface drop down and this is sourced from the Drawing Document Text Styles collection.
Here is the code with the objects in the right place. I haven't tested it as you have it constructed but the style is being sourced from the right place and changed in a simple example I tried.
Sub Main()
Dim oDoc As Document
oDoc = ThisDoc.Document
Dim oNote As GeneralNote
Dim xTextPos As Double
Dim yTextPos As Double
Dim yTextPosDXF As Double
Dim oStlMgr As DrawingStylesManager = oDoc.StylesManager
Dim MyTextStyle As TextStyle
If oDoc.DocumentType = kDrawingDocumentObject Then
Select SheetSize
Case "A3"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize
xTextPos = 1.5
yTextPos = xTextPos
yTextPosDXF = 28.25
MyTextStyle = oStlMgr.TextStyles.Item("Note Text LARGE (ISO)")
Case "A2"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize
xTextPos = 1.5
yTextPos = xTextPos
yTextPosDXF = 40.5
MyTextStyle = oStlMgr.TextStyles.Item("Note Text LARGE (ISO)")
Case "A1"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA1DrawingSheetSize
xTextPos = 2.75
yTextPos = xTextPos
yTextPosDXF = 56.75
MyTextStyle = oStlMgr.TextStyles.Item("Note Text (ISO)")
Case "A0"
oDoc.ActiveSheet.Size = DrawingSheetSizeEnum.kA0DrawingSheetSize
xTextPos = 2.75
yTextPos = xTextPos
yTextPosDXF = 81.5
MyTextStyle = oStlMgr.TextStyles.Item("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 = 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.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Nailed it.
Thank you so much for this, @A.Acheson
It helps solve, what is actially only a small issue, but an issue nontheless.
You're a star. ![]()
Regards
Darren