Import/Export & File Formats
Relevant source files
The following files were used as context for generating this wiki page:
Parashell facilitates interoperability with external CAD systems and data exchange standards through a modular architecture of specialized readers and writers. The system supports a wide range of formats including standard neutral formats (STEP, IGES), industry-specific formats (IFC, JT), and vector-based formats (DXF, DWG, SVG).
The architecture relies on a combination of C++ compiled modules for heavy geometry processing (e.g., STEP via OpenCASCADE) and Python-based modules for flexible parsing of data-heavy or semi-structured formats (e.g., DXF, JSON). Metadata management is handled through a standardized XML-based packaging system that ensures data integrity and dependency tracking across imported components.
Core Import/Export Architecture
The core import functionality is initialized via the Import module, which serves as a container for various specialized geometry readers.
STEP Format Handling
STEP (Standard for the Exchange of Product model data) files are processed using the StepReader class. This component leverages the OpenCASCADE STEPControl_Reader to interpret BRep (Boundary Representation) data.
- Initialization: The reader registers resource parameters such as
read.step.resource.nameandread.step.sequenceto configure the OpenCASCADE translation sequence. - Unit Management: The reader interprets unit definitions within the STEP file to ensure accurate scaling within the Parashell internal coordinate system.
Sources: Mod/Import/App/ReaderStep.cpp:44-55, Mod/Import/App/AppImport.cpp:43-50
JT Format Handling
The JtReader module provides specialized support for the Jupiter Tessellation (JT) format, common in Siemens PLM environments. It implements functions for both reading JT data and integrating it into the Parashell document structure.
Sources: Mod/JtReader/App/JtReader.cpp:33-50
Import Execution Flow
The following diagram illustrates the typical sequence for importing a neutral CAD format into the application:
This diagram shows the flow from a user request through the specialized reader and kernel processing to final document integration.
Sources: Mod/Import/App/ReaderStep.cpp:44-70, Mod/Import/App/AppImport.cpp
Metadata and Packaging System
Parashell utilizes a package.xml format to manage metadata for complex assemblies and modular components. This system handles versioning, authorship, and licensing.
Metadata Structure
The App::Metadata class is responsible for parsing and writing XML-based package definitions. It supports a structured schema that includes:
| Field | Description |
|---|---|
name | The internal identifier of the package. |
version | Semantic versioning (Major.Minor.Patch). |
maintainer | Contact information for the package owner. |
license | Licensing terms (e.g., LGPL, MIT). |
depend | List of package dependencies with version constraints. |
Sources: src/App/Metadata.cpp:115-180, src/App/Metadata.cpp:780-820
Package Parsing Logic
The parser implements specific logic for different format versions. For version 1, it recursively traverses the DOM to extract attributes such as version_lt (less than), version_gte (greater than or equal), and conditional requirements.
The parsing logic ensures that only supported metadata versions are processed, preventing data corruption during import.
Sources: src/App/Metadata.cpp:123-145, src/App/Metadata.cpp:746-775
Specialized Vector and BIM Formats
Parashell handles non-BRep formats through specialized Python modules. The configuration for these imports is often managed through preference dialogs, as revealed in the translation resources.
DXF and DWG Import Modes
The DXF/DWG importer supports four distinct modes, allowing users to balance between editability and performance:
- Draft Objects: Highest fidelity; creates fully parametric objects.
- Part Primitives: High fidelity; creates standard Part components.
- Part Shapes: Balanced mode; creates non-parametric BRep shapes.
- Fused Shapes: Fastest performance; merges all geometry per layer into a single shape.
Sources: src/Mod/Draft/Resources/translations/Draft.ts:lines 117-123
SVG and Vector Support
SVG (Scalable Vector Graphics) import includes specific settings for handling coordinate precision and unit scaling.
- Precision: Essential for detecting closed paths during the conversion to wires.
- Style Mapping: Option to use original SVG styles or apply internal Parashell default styles.
- Automation: Ability to automatically join coincident geometry objects into unified wires.
Sources: src/Mod/Draft/Resources/translations/Draft.ts:lines 140-166
Import Configuration Parameters
Configuration for various file formats is stored in the application preferences. The following table summarizes key parameters for common formats:
| Format | Parameter | Purpose |
|---|---|---|
| STEP | ExportSingleObjectPlacement | Preserves placement info for single objects. |
| DXF | UseLegacyImporter | Toggles between C++ and Python-based parsers. |
| SVG | ApplyCuts | Applies even/odd fill rules to the resulting shapes. |
| IFC | ImportFullParametric | Recreates full parametric definitions from stored properties. |
Sources: src/Mod/Draft/Resources/translations/Draft.ts:lines 30-49, src/Mod/Draft/Resources/translations/Draft.ts:lines 120-140
Conclusion
The Parashell Import/Export system is designed to provide high-fidelity data translation while maintaining system performance. By utilizing the OpenCASCADE kernel for standard CAD formats like STEP and flexible Python modules for vector and BIM data, the system ensures that complex geometric information is accurately preserved and integrated into the project's parametric environment.