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
thread560-172343: HIDING DATUMS in Catia





RE: Combined VBscript
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
RE: Combined VBscript
RE: Combined VBscript
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
RE: Combined VBscript
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
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.
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