Skip to content

Copy Name and Colour

KaiUR edited this page May 21, 2026 · 4 revisions

Copy Name and Colour

File: Any_Document_Scripts/Copy_Name_and_Colour.py
Version: 1.1
Document Type: Part, Product, or Process


Description

Copies the name, colour, line weight, line type, opacity and point symbol type from a single source element to one or more target elements. Useful for quickly applying a consistent visual style and naming convention across a set of related geometry.


Requirements

Requirement Value
Python >= 3.10
pycatia >= 0.8.3
Open document Part, Product, or Process

Usage

  1. Open a Part, Product, or Process document
  2. Run the script
  3. A CATIA selection prompt appears — select all the target elements (the ones that will receive the properties), then click OK
  4. A second selection prompt appears — click a single source element to copy properties from
  5. The name, colour, line weight, line type and opacity of the source are applied to all target elements

Properties Copied

Property Notes
Name Applied to all targets as a literal string
Colour (RGB) Applied via SetRealColor
Line weight Index 1–63 as configured in Tools > Options > Display
Line type Index 1–63 as configured in Tools > Options > Display
Opacity / Transparency 0 (transparent) to 255 (fully opaque)
Point symbol type Index 1–13 (cross, plus, circle, star, dot, etc.) — applied to point elements

Notes

  • The second selection uses a single-click prompt — only one source element can be chosen
  • If a boundary reference (Selection_) is returned (e.g. clicking a surface edge in the viewport), the script automatically uses its parent feature for both name and properties
  • Properties are read using GetRealColor, GetRealWidth, GetRealLineType and GetRealOpacity. If a property is undefined on the source (status catVisPropertyUnDefined), it is not copied
  • Applying line weight or line type to an element type that does not support them (e.g. certain surface types) is attempted and silently skipped on failure — name and colour are always copied regardless of element type
  • Point symbol type has no inheritance mechanism in CATIA — SetSymbolType sets the value directly with no inheritance flag
  • All targets receive the same name; CATIA will append .1, .2 etc. to disambiguate duplicates automatically

Home


Getting Started


Contributing


Any Document Scripts


Drawing Document Scripts


Part Document Scripts


Shape Generation Scripts


Process Document Scripts


Product Document Scripts


Utility Scripts


Legal

Clone this wiki locally