/ BLOG / CATSCRIPT - PLANE + 'AXIS SYSTEM' OBJECTS TO NO-SHOW

Purpose

Catia Macro to automatically select all Plane and ‘Axis System’ geometry and set to no-show.

Usage

After calling up a CatProduct (in design mode) Planes and ‘Axis System’ objects are shown all over the place (in case they are not hidden in each individual CATPart).

In such a scenario, this macro might be helpful so that these unwanted objects can be removed in one go.

In Catia the build-in geometry search function <CTRL + F> is very powerful and the designer can achieve the same result. On the other hand the macro makes the task even more straight forward and there is also the possibility to extended the search query if required.

A Closer Look

Looks like the task is a bit more complex as thought initially.

When hiding objects the macro logic should distinguish between the current CATParts (where the actual design is taken place) and the rest of the components (usually CATParts which are not under full control of the designer, standard parts, released supplemental parts, etc…).

This is why the actual implementation is more a good guess than a final solution and only applicable initially after calling up a CATProduct. When calling up the macro in between an ongoing design task the result is that more objects are hidden than wanted.

In fact the logic should eventually look like the following (design scenario):

  • remember the actual CATPart (if selected)
  • start from the root CATProduct node and retrieve each individual CATPart of the actual CATProduct …
    • if the CATPart is in representation mode -do nothing
    • if the CATPart is in design mode:
      • if there is CATPart is the actual CATPart - do nothing
      • else hide basic planes and ‘Axis System’ objects, hide all root-geometry sets
  • finally set the actual CATPart back to active and finish

For hiding all unwanted wireframe (parts and axis systems) the approach shown down below might be sufficient though.

Source code

' --- Set-Axis+Planes-to-noshow.CATScript
' -----------------------------------------------------------------------------
' (c) 2022, Johann Oberdorfer - Engineering Support | CAD | Software
'     johann.oberdorfer [at] gmail.com
'     www.johann-oberdorfer.eu
' -----------------------------------------------------------------------------
' This source file is distributed under the BSD license.
'   This program is distributed in the hope that it will be useful,
'   but WITHOUT ANY WARRANTY; without even the implied warranty of
'   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
'   See the BSD License for more details.
' -----------------------------------------------------------------------------
' -----------------------------------------------------------------------------
' Purpose: set 'axis system' and plane objects to no-show
' Usage: The macro works in assembly and parts.
' -----------------------------------------------------------------------------
' Revision History:
'  22-09-08: J.Oberdorfer, Initial Release
' -----------------------------------------------------------------------------
' Option Explicit
Language="VBSCRIPT"

Sub CATMain()

	Dim doc As Document
	Dim sel As Selection

	Set doc = CATIA.ActiveDocument
	Set sel = doc.Selection

	CATIA.Caption = "Set  of all 'Axis Systems' and Planes to no-show ..."

	sel.Clear
	
	' disclaimer: the search query is still flagged as "work in progress"
	' here are a few suggestions which might be worth to try:
	' 
	' simple search query (works for CATParts only):
	'   sel.Search "('Part Design'.'Axis System' + 'Part Design'.Plane) & Visibility=Visible;all"
	'   note: to avoid side-effects on machines with an unusual configuration
	'   (country code specific) we use comma instead of the semi-column

	' this is a more elaborated search-query suggested by using the
	' native <CTR+ F> Catia search dialog
	' (not sure if this works for both: CATPart and CATProduct... )

	sel.Search "((" _
	+	"'Part Design'.Plane + 'Part Design'.'Axis System' + "_
	+	"FreeStyle.Plane + FreeStyle.'Axis System' +" _
	+	"'Generative Shape Design'.Plane + 'Generative Shape Design'.'Axis System' +" _
	+	"'Functional Molded Part'.Plane + 'Functional Molded Part'.'Axis System')" _
	+	"& Visibility=Visible),all"

	' might work for both CATPart and CatProduct (?):
	'  	sel.Search "CatPrtSearch.AxisSystem,All"
	'   sel.Search "CatPrtSearch.AxisSystem.Name=Axis' 'System*,All"


	Set vis = sel.VisProperties 
	vis.SetShow catVisPropertyNoShowAttr

	sel.Clear
	CATIA.Caption = ""

End Sub