Hello all,
I am able to create FT&A 3D Annotations in a macro, but how do I do things like change font size, add frames, change text type, etc?
Thanks!
Hi.
3D annotations are basically 2D texts based on 3D plane or surface. To retrieve underlying text interface you call:
Dim drwText as DrawingText
Set drwText = oAnnotation.Text().Get2dAnnot()
Interesting...would I then use SetFontSize like Ferdo used in this post? http://www.coe.org/p/fo/st/thread=28300
Any idea on how to set the rectangular frame?
You can call ActivateFrame or SetFontName right on retrieved drwText and observe propetries to change as expected.
BUT! In order to visualize changes you must somehow make annotation graphics to update. I struggled a lot with this in the past and come with solution based on reactivating annotation set that contains annotation being modified:
' turn off
CATIA.ActiveDocument.Selection.Add oAnnotation.Parent.Parent
CATIA.StartCommand "CATTPSSetVisuHdr" ' "Annotation set switch on/switch off" command
' turn on
CATIA.ActiveDocument.Selection.Add oAnnotation.Parent.Parent
CATIA.StartCommand "CATTPSSetVisuHdr"
Thank you very much for your help, this works very well! I used a trick to resize the active window to force the refresh. Here is a generic example of how I applied this.
Dim oAnnotation As Annotation
Dim oText As DrawingText
oAnnotation.Text.Text = sPartName & vbCrLf & sPartNumber
& vbCrLf & sRevision
oAnnotation.Name = "Part_Info"
k = Len(sSectionName) +
Len(sSectionPartName) + Len(sLocation) + 2 'add 2 for 2 vbCrLf
Set oText =
oAnnotation.Text.Get2dAnnot
oText.SetFontSize 1, k, 10 'First
character to apply size, last character to apply size, size
oText.ActivateFrame catRectangle
'Resize window to force refresh
iWidth = CATIA.ActiveWindow.Width
CATIA.ActiveWindow.Width = iWidth - 2
CATIA.ActiveWindow.Width = iWidth
oPart.UpdateObject oAnnotationSet