FT&A Change 3D Annotation Size and Add Frames in Macro

Matthew Lamberson

FT&A Change 3D Annotation Size and Add Frames in Macro

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!

Little Cthulhu

RE: FT&A Change 3D Annotation Size and Add Frames in Macro
(in response to Matthew Lamberson)

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()

Matthew Lamberson

RE: FT&A Change 3D Annotation Size and Add Frames in Macro
(in response to Little Cthulhu)

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?

Little Cthulhu

RE: FT&A Change 3D Annotation Size and Add Frames in Macro
(in response to Matthew Lamberson)

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"

Matthew Lamberson

RE: FT&A Change 3D Annotation Size and Add Frames in Macro
(in response to Little Cthulhu)

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