×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Switch/Enable annotation set on/off

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

RE: Switch/Enable annotation set on/off

(OP)
Thank you Ferdo. I will try your way and let you know.

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

(OP)
Hi Ferdo, Follow the first thread above and your guidance, below is my VBA code but it seems not working properly.

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

Hi,

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

(OP)
Hi Ferdo,

"...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

when you put your mouse over the icon of a function, the catia name of that function is displayed at the bottom of the screen. use that name in the startcommand line

Eric N.
indocti discant et ament meminisse periti

RE: Switch/Enable annotation set on/off

(OP)
Hi Itsmyjob,

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

did you select the object in the tree before you start the commandline?

Eric N.
indocti discant et ament meminisse periti

RE: Switch/Enable annotation set on/off

(OP)
In my VBA code below, does this line of code mean I pick the object in the tree "AnnoSet1.Name"?
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

check Selection examples in v5automation.chm

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources