Switch/Enable annotation set on/off
Switch/Enable annotation set on/off
(OP)
Hello All,
I can turn the annotation captures on/off but not able to figure out how to switch/enable annotation set on and off with a VBA/VBScript code such as you use CATIA with mouse-right click on the annotation set itself?
Please see image below to understand my question.

Please help if you can.
Thank you in advance
Quin
I can turn the annotation captures on/off but not able to figure out how to switch/enable annotation set on and off with a VBA/VBScript code such as you use CATIA with mouse-right click on the annotation set itself?
Please see image below to understand my question.

Please help if you can.
Thank you in advance
Quin





RE: Switch/Enable annotation set on/off
First select your Annotation Set (by search or with user interaction) then use
CATIA.StartCommand ("Annotation Set Switch On/Switch Off")
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Switch/Enable annotation set on/off
Ah....for ENOVIA/DMU license only), ENOVIA does not have Command "Annotation Set Switch On/Switch Off", but it only has "3D visualization" command button (I see from command tip if you hover the mouse cursor on the command button). See image below for more info.
What is the right syntax for the macro or CATIA Command to switch/enable annotation set on/off?
Thank you again
Quin
RE: Switch/Enable annotation set on/off
After running below VBA code, no annotation or captures. However, if I left click (one time with the mouse) on the "CATPart 3D Annotations", the annotation appear successfully.
1) What does it mean? Do I miss something? It seems the screen needs to be refreshed after running the code in order to see the captures/annotations. Does it relate to CATIA.RefreshDisplay command at all and how to use this command?
2) How can I emulate the mouse-right click to trigger command: CATIA.StartCommand ("Annotation Set Switch On/Switch Off")?
-------------------- VBA CODE -----------------------
Option Explicit
Sub CATMain()
'//// Returns or sets the application ability to display file alerts. "True" is the default
CATIA.DisplayFileAlerts = False
'//// Access the active document
Dim PartDoc As Document
Set PartDoc = CATIA.ActiveDocument
'//// Set PartRoot part from the PartDoc part document
Dim PartRoot
Set PartRoot = PartDoc.Part
'//// Set user's annotation collection = PartRoot annotation sets, which has multiple annotation sets
Dim myAnnotCollection
Set myAnnotCollection = PartRoot.AnnotationSets
' myAnnotCollection.Clear
'//// Get first annotation set from annotation collection, myAnnotCollection
Dim AnnoSet1
Set AnnoSet1 = myAnnotCollection.Item(1)
'//// Search oSelection set for actual name of the Annotation Set.
'//// Common name is "CATPart 3D Annotations" but it may be different name
MsgBox AnnoSet1.Name '//// Display actual name of the annotation set
' oSelection.Search ("Name = AnnoSet1.Name, all") need this ???
'//// Enable CATPart annotation set
CATIA.StartCommand "Annotation Set Switch On/Switch Off"
End Sub
Thank you
Quin
RE: Switch/Enable annotation set on/off
Not all commands are available in different workbenches. First you need to switch to the right workbench then apply what I said. Do not simply copy/paste code, this will not help you. Think before do something...
Read some examples (even if they are related to somehow similar subjects and not exactly currently yours), try to record first some manual actions (maybe, but not always, they will be recorded) and not at last, read carefully documentation and samples. As I said, you need to select first "CATPart 3D Annotations" searching by name or by type or by user selection then launch the command.
And by the way, nobody will create a CATPart to test what you are trying to do, is always better to have a sample CATPart in order to test code.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Switch/Enable annotation set on/off
"...you need to select first "CATPart 3D Annotations" searching by name or by type or by user selection then launch the command." This is what I got the annotation set'name displayed at the code line: MsgBox AnnoSet1.Name in my VBA code above.
The code displays name of annotation set successfully but I am not quite sure how to relate name of the annotation set to CATIA.StartCommand "Annotation Set Switch On/Switch Off".
Any help is much appreciated.
Quyen
RE: Switch/Enable annotation set on/off
indocti discant et ament meminisse periti
RE: Switch/Enable annotation set on/off
Yes, hovering the mouse cursor on the CATPart 3D Annotations and it displays "CATPart 3D Annotations". So,
here is my command: CATIA.StartCommand ("CATPart 3D Annotations") and CATIA says unknown command.
In fact, CATIA.StartCommand ("Annotation Set Switch On/Switch Off") works, but somehow the annotated captures do not show up on the screen. I need to physically left-click "CATPart 3D Annotations" on the spec tree and then the annotation appear.
What is your suggestion?
QUin
RE: Switch/Enable annotation set on/off
indocti discant et ament meminisse periti
RE: Switch/Enable annotation set on/off
If not, what could the code/syntax be to pick up the object?
-----------------------
Option Explicit
Sub CATMain()
'//// Returns or sets the application ability to display file alerts. "True" is the default
CATIA.DisplayFileAlerts = False
'//// Access the active document
Dim PartDoc As Document
Set PartDoc = CATIA.ActiveDocument
'//// Set PartRoot part from the PartDoc part document
Dim PartRoot
Set PartRoot = PartDoc.Part
'//// Set user's annotation collection = PartRoot annotation sets, which has multiple annotation sets
Dim myAnnotCollection
Set myAnnotCollection = PartRoot.AnnotationSets
' myAnnotCollection.Clear
'//// Get first annotation set from annotation collection, myAnnotCollection
Dim AnnoSet1
Set AnnoSet1 = myAnnotCollection.Item(1)
'//// Search oSelection set for actual name of the Annotation Set.
'//// Common name is "CATPart 3D Annotations" but it may be different name
MsgBox AnnoSet1.Name '//// Display actual name of the annotation set
'//// Enable CATPart annotation set
CATIA.StartCommand "Annotation Set Switch On/Switch Off"
End Sub
Thanks for your help
Quin
RE: Switch/Enable annotation set on/off
indocti discant et ament meminisse periti