Skip to content

Export Sketch Constraints To CSV

KaiUR edited this page May 28, 2026 · 2 revisions

Export Sketch Constraints To CSV

File: Part_Document_Scripts/Export_Sketch_Constraints_To_CSV.py
Version: 1.0
Document Type: Part


Description

Exports all sketch constraints and dimensions from the active CATPart to a CSV file. Sketches are found in two locations: inside solid bodies and inside geometric sets (including nested geometric sets). Each row contains the sketch name, constraint name, constraint type, satisfaction status, and the dimensional value where applicable.

Dimensional constraint types (Distance, Length, Angle, Radius, etc.) include the value in document units. Non-dimensional constraints (Tangency, Parallelism, Coincidence, etc.) are exported with an empty value column.


Requirements

Requirement Value
Python >= 3.10
pycatia >= 0.8.3
wxPython Not required
Open document Part

Usage

  1. Open a CATPart document
  2. Run the script — no user input is required
  3. The CSV file is saved in the same folder as the part

Output

A CSV file named PartName_Sketch_Constraints.csv:

Sketch Name,Constraint Name,Type,Status,Value
"Sketch.1","Constraint.1","catCstTypeDistance","catCstSatisfied","50.0"
"Sketch.1","Constraint.2","catCstTypeTangency","catCstSatisfied",""
"Sketch.2","Constraint.1","catCstTypeRadius","catCstSatisfied","12.5"

Notes

  • Searches both solid body sketches and geometric set hybrid sketches, including all nested geometric sets
  • Constraint type and status are exported as pycatia enum names (e.g. catCstTypeDistance, catCstSatisfied)
  • Dimensional value is rounded to 6 decimal places
  • If the active document is not a CATPart, the script exits with an error message
  • If the output file is already open in another application, a permission error is printed and the script exits

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