The module pycatia must already be installed.
Get the center of gravity for the part body ‘PartBody’.
Get all the points in the geometrical set ‘Points’ and output co-ordinate to console.
Create your own CATPart with a Geometrical Set called construction_points. Add some points to the Geometrical Set.
Find all points in the CATPart and print to console and export to csv.
Loop through a CATProduct and find if sub component is a CATPart or CATProduct.
Reads a csv file containing point data and adds to the new catia part.
Formatting of csv data should be:
<point_name>,<x coordinate>,<y coordinate>,<z coordinate>
Open a catia file.
Export catia file to igs.
Close a catia file.
Use the context manager to open CATIA documents and close.
Open all CATParts in source directory and save to IGS in target directory.
Get the position matrix of products (CATPart or CATProduct) in product.
Loop through a CATProduct and analyse children if CATPart.
Only goes two levels deep.
Move the first child in product.
Access the CATIA COM object with a .CATPart open and and display each parameter along with its name, value and its associated parameter set.
# todo: need to create a source part to support this example.
3D Points, Spline, Extrusion and Generate Thickness.
Draw a line between two points.
Creates a square in a sketch and fully constrains it. Sketch then used to pad.
Drafting: create a border template in the background view of the currently opened A0 landscape CATDrawing.
With regards to pycatia this example only shows how to select the root product. The rest is handled by pywinauto. _https://pywinauto.github.io/
You will need to manually install package pywinauto to run this script. Also, the placement of from pywinauto import Desktop is important.
Assembly Design: Reorder a Product tree alphabetically. The Product shall already be loaded.
Searching and changing visual properties. Find all Red points and make them Pink.
This creates a message box with the buttons abort, retry ignore and displays the Warning Query icon.
Sequentially rename all points in geometric set (hybrid body) Points in the geometric set MasterGeometry.
Loops through the items in hybrid body “Lines” and determine the object type using selection.
Once determined create an object from it and find it’s parent(s)
Requires an active part document open with a geometrical set called “construction_geometry” containing points generated using HybridShapePtCoord and line generated using HybridShapeLinePtPt
Fix the first Sub Product in Product using constraints. The Sketch examples also show further usage of constraints.
Basic license checking.
Write the contents of a product to a html file.
Prompt the user to select a product and get it’s bounding box parameters
Currently there must be NO other existing Measure Inertias saved ANYWHERE in your product tree as these may be returned and not product you have selected.
Loop through all the CATParts in a directory and save PLAN VIEW, SIDE VIEW, END VIEW and ISO pngs for each part.
The tree is turned off and the background turned white for the screen capture and then turned back on.
Add new bodies to part. Create a cylinder in an added body. Do Intersection operations between two bodies..