pycatia

repository·master·Indexed 43 days ago

https://github.com/evereux/pycatia

A Python library designed to interface with the CATIA V5 COM interface on Windows for automating CATIA tasks. It provides programmatic access to the CATIA Automation Object model, including modules for Mechanical Modeler (mec_mod_interfaces), Part Design (part_interfaces), Manufacturing (manufacturing_interfaces), Knowledge-based engineering (knowledge_interfaces), and Abaqus automation (abq_automation_interfaces).

Tokens
6.7K
Snippets
32
Records
49
Agent score
57%

What's inside pycatia

  1. Explore pycatia.part_interfaces API

    master

    The pycatia.part_interfaces module provides access to various Part Design interfaces in CATIA. This module is organized into sub-modules, each corresponding to a specific geometric or part-design operation.

    Common categories of operations available through these interfaces include:

    • Feature Creation: pad, pocket, shaft, rib, shell, hole, loft, sweep, revolution.
    • Patterns & Repartitions: circ_pattern, rect_pattern, linear_repartition, angular_repartition, user_pattern.
    • Fillets & Chamfers: edge_fillet, face_fillet, chamfer, auto_fillet, tritangent_fillet.
    • Boolean & Transformations: boolean_shape, solid_combine, mirror, translate, rotate, scaling.
    • Surface & Shape Operations: sew_surface, thick_surface, trim, split, dress_up_shape.
    • Defeaturing: Various filters such as defeaturing_filter, defeaturing_hole_filter, and defeaturing_fillet_filter to simplify geometry.

    To use a specific interface, you will typically navigate through the part_interfaces hierarchy to find the relevant operation module.

  2. Explore pycatia.manufacturing_interfaces API

    master

    The pycatia.manufacturing_interfaces module provides access to CATIA's manufacturing automation interfaces. It contains a wide range of sub-modules for controlling various aspects of the manufacturing process, including machining, tool management, manufacturing activities, and resource factories.

    Key functional areas include:

    • Machining & Processes: machining_process, manufacturing_process, manufacturing_operation.
    • Tooling: manufacturing_tool, manufacturing_tool_assembly, manufacturing_tool_corrector, manufacturing_tool_motion.
    • Manufacturing Setup & Activities: manufacturing_setup, manufacturing_activities, manufacturing_activity.
    • Geometry & Features: manufacturing_feature, manufacturing_hole, manufacturing_insert, manufacturing_machinable_area.
    • Generators & Outputs: manufacturing_apt_generator, manufacturing_output_generator, manufacturing_program.
  3. Explore Abaqus Automation Interfaces

    master

    The pycatia.abq_automation_interfaces module provides programmatic access to Abaqus automation objects. This module is organized into specific interfaces for managing Abaqus jobs, analysis models, steps, loads, boundary conditions, and output requests.

    Key functional areas include:

    • Job Management: Controlling abq_job and abq_jobs.
    • Analysis Setup: Configuring abq_analysis_model, abq_analysis_case, and abq_analysis_cases.
    • Step Configuration: Defining various step types such as abq_general_static_step, abq_explicit_dynamics_step, abq_frequency_step, and abq_heat_transfer_step.
    • Physics & Constraints: Applying abq_load, abq_boundary_condition, abq_interaction, and various connection properties (e.g., abq_spring_connection_property, abq_gasket_property).
    • Data & Output: Managing abq_output_request, abq_field_output_request, and abq_history_output_request to extract simulation results.
  4. Explore pycatia knowledge interfaces

    master
    The pycatia.knowledge_interfaces module provides access to CATIA's knowledge-based engineering features. This includes interfaces for managing parameters (Boolean, Integer, Real, String, Enum, etc.), constraints, formulas, rules, optimizations, and design tables. Use these interfaces to automate the manipulation of design intent and mathematical relationships within CATIA models.
  5. Explore pycatia.mec_mod_interfaces API

    master

    The pycatia.mec_mod_interfaces module provides Python interfaces for interacting with CATIA Mechanical Modeler (Mec Mod) objects. This module is organized into specific sub-modules corresponding to different geometric and mechanical entities.

    Key categories of interfaces available include:

    • Part & Document Management: part, part_document, factory.
    • Geometric Elements: axis_system, axis_systems, body, bodies, hybrid_body, hybrid_bodies, shape, shapes, vertex, edge, face.
    • Constraints & Relations: constraint, constraints, fix_together, fix_togethers.
    • Complex Geometries: hybrid_shape, hybrid_shapes, ordered_geometrical_set, ordered_geometrical_sets.
    • Feature-Specific Edges/Vertices: Various interfaces for dimension-specific features like bi_dim_feat_edge, mono_dim_feat_edge, tri_dim_feat_edge, and rectilinear variations.
  6. Understand the pycatia Automation Object hierarchy

    master

    The pycatia library follows the CATIA Automation Object model. Understanding the hierarchical relationship between these objects is essential for navigating the API. The hierarchy starts from the Application object and branches into documents, windows, and system services.

    Core Hierarchy Path:

    • Application
      • Documents
        • Document
          • Part
          • Product
          • DrawingRoot
      • Selection
        • SelectedElement
      • Windows
        • Window
          • SpecsAndGeomWindow
            • SpecsViewer
      • Viewers
        • Viewer
          • Viewer2D / Viewer3D
      • FileSystem
        • Folder / Files
      • SystemService
      • SettingControllers
  7. Automate Specs and Geometry window captures

    master

    Automate the generation of technical views. You can loop through all CATParts in a directory and save specific views (PLAN VIEW, SIDE VIEW, END VIEW, and ISO) as PNG files.

    Typical workflow involves:

    1. Turning off the specification tree.
    2. Setting the background to white for clean screen captures.
    3. Capturing the views.
    4. Restoring the tree and background settings.
  8. Run a script from the command line

    master

    Once your script is written and your virtual environment is active, run the script by calling the python executable followed by the filename.

    Example workflow:

    # Navigate to the directory
    cd c:\Users\<username>\python\pycatia-scripts
    
    # Activate the virtual environment
    env\Scripts\activate
    
    # Run the script
    python catia_details.py
    cd c:\Users\<username>\python\pycatia-scripts
    env\Scripts\activate
    python catia_details.py
  9. Manage CATIA documents using context managers

    master

    Use Python context managers to safely open and close CATIA documents. This ensures that resources are properly released even if errors occur during processing.

    Common document tasks include:

    • Opening and closing documents via context managers.
    • Batch processing: Opening all CATPart files in a source directory and exporting them to IGS in a target directory.
    • File conversion: Opening a CATIA file, exporting it to STP, and then closing it.
    # Example: Using context manager for documents
    # Example: Batch export CATPart to IGS
    # Example: Open, Export to STP, and Close