Skip to content

Export Component Positions To CSV

KaiUR edited this page May 21, 2026 · 3 revisions

Export Component Positions To CSV

File: Product_Document_Scripts/Export_Component_Positions_To_CSV.py
Version: 1.0
Document Type: Product


Description

Recursively traverses the active CATProduct assembly tree and exports the full position matrix of every component instance to a CSV file. Each row records the assembly path, instance name, part number, the nine direction cosines of the orientation matrix, and the X/Y/Z translation vector. Useful for downstream analysis, assembly reports, or importing positions into other tools.


Requirements

Requirement Value
Python >= 3.10
pycatia >= 0.8.3
Open document Product

Usage

  1. Open a CATProduct in CATIA
  2. Run the script
  3. The CSV is saved next to the CATProduct file (or to ~/Downloads if unsaved)

Output

CSV file: <ProductName>_ComponentPositions.csv

Column Content
Level Depth in the assembly tree (1 = direct child of root)
Path Full assembly path (e.g. TopAssy/SubAssy/Part)
Instance Name Instance name of the component
Part Number Part number of the reference product
Xx, Xy, Xz X-axis direction cosines
Yx, Yy, Yz Y-axis direction cosines
Zx, Zy, Zz Z-axis direction cosines
TX_mm, TY_mm, TZ_mm Translation vector in mm

Notes

  • Positions are given in the assembly coordinate system relative to the parent component
  • The matrix is the 4×3 position matrix returned by product.position.get_components()
  • All terminal nodes (leaf parts) are activated and the assembly is put into Design Mode before reading positions
  • Components with no valid position matrix are skipped with a console warning

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