×
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

Combined VBscript

Combined VBscript

Combined VBscript

(OP)
Is there a way to combine a hide / show operation for points, lines, planes, axis systems, basically all ref geometry into one script so all i have to do is create one icon? The script in the ref thead helped me considerably and I thank all that contributed.

thread560-172343: HIDING DATUMS in Catia

RE: Combined VBscript

I'll start by noting that I am a complete novice to scripting, but I do have a working solution to what you describe. This is a catvbs script that switches off axis systems, planes, and assembly constraints in one click.


Language="VBSCRIPT"

Sub CATMain()

Set productDocument1 = CATIA.ActiveDocument

Set selection1 = productDocument1.Selection

selection1.Search "CATProductSearch.MfConstraint.Visibility=Shown,all"

Set visPropertySet1 = selection1.VisProperties

visPropertySet1.SetShow 1

selection1.clear

Set selection1 = productDocument1.Selection

selection1.Search "CATPrtSearch.AxisSystem.Visibility=Shown,all"

Set VisPropSet1 = Selection1.VisProperties

VisPropSet1.SetShow catVisPropertyNoShowAttr

selection1.clear

Set selection1 = productDocument1.Selection

selection1.Search "CATPrtSearch.Plane.Visibility=Visible,all"

Set VisPropSet1 = Selection1.VisProperties

VisPropSet1.SetShow catVisPropertyNoShowAttr

selection1.clear

End Sub

I only worked the script to a point that it works, but along the way I discovered a few things. There are shown/hidden attributes, as well as visible/invisible. You can set the show attribute to 0 / 1, or to catVisPropertyNoShowAttr / catVisPropertyShowAttr. I haven't dug deep enough to really understand the implications of all this.

I have been told by a coworker that modifying the script to select only elements that are on the screen, rather than searching for all shown, speeds the process considerably. That would be to change the search criteria from "all" to "scr." But, I haven't gotten around to updating the script.

I would welcome any suggested improvements to this :)

Cheers,

Mark

RE: Combined VBscript

(OP)
Thanks Mark...Just before you replied I found an earlier thread from 2006 that had the script. I too am new to this but adapting very quickkly. thanks again.

RE: Combined VBscript

(OP)
Now Ive got a new problem...I create the macro..then create my tool bars. When i close catia and start a new session..all of my scripts are gone and all of my created toolbars are gone from the screen and in the toolbar list. anyone know why?

RE: Combined VBscript

Well, there are a lot of things to tell about this subject...

Maybe in your network is existing a maintenance script which delete all CATSettings (CATIA will create new ones at the next start-up automatically). In this case, for sure you lost all your new created toolbar and assigned icons.

Where did you save the macros? If your administrator decided to delete all "unauthorized" folders,they are gone also.

You know how it is, each company with own rules...

Regards
Fernando

RE: Combined VBscript

(OP)
I think I found the problem after my major loss of scripts...I think they were being saved to a local temp directory and when restarted the temp directory is cleared. So i created a folder on my C: drive to store my scripts and it seems to be working ok for now but...we will see when i come in on monday.  

RE: Combined VBscript

(OP)
Ok it seems to be working after shut down and startup also after a reboot. Does it really matter where you store your script folder? I guess it doesnt have to be within the catia folders as long as catia can read from it. Well anyway...problem solved for now.  

RE: Combined VBscript


It doesn't matter where you store the settings, so long as you don't put them somewhere that gets regularly deleted.

Also, it is important to note that some companies create (as part of the startup) a script which deletes CATSettings upon each start, or otherwise points the user to a pre-defined CATSetting directory.  This is especially true for SmarTeam and Enovia users.  The workaround is just to create your own environment that points to the same place, but without the extra code.

-----------------------------------------------------------
Catia Design|Catia Design News|Catia V5 blog

RE: Combined VBscript

I would have some reserve on what Solid7 said:
Also, it is important to note that some companies create (as part of the startup) a script which deletes CATSettings upon each start, or otherwise points the user to a pre-defined CATSetting directory.  This is especially true for SmarTeam and Enovia users.  The workaround is just to create your own environment that points to the same place, but without the extra code.
You should talk to your CATIA team and see with them what is the best way to have your code available. If you by pass your default environment you might create parts that might not be in the company standard.

Eric N.
indocti discant et ament meminisse periti

RE: Combined VBscript


I'm not suggesting that my method is for everyone - but I also didn't say to bypass the default environment.  I have a tendency to clip any scripting which wants to delete my user settings, while still pointing to the default environment. (or I create a new target to the standard environment)  While it is handy for IT and admins to delete settings, on the premise that they MAY corrupt, and cause unnecessary phone calls, I still believe that the greater evil is restricting a user's preferences which may lead to gains in proficiency and/or productivity.  It is overkill to default back to the original CATSettings, just for the sake of doing so, on every fresh start. (and highly annoying)

When I have problems, I just delete my CATSettings and try again before I make the phone call.  There are never any issues beyond that.
 

-----------------------------------------------------------
Catia Design|Catia Design News|Catia V5 blog

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