Repository navigation
Reference Data Geometry
Relevant source files
The following files were used as context for generating this wiki page:
Kit provides bidirectional translation between CAD-neutral B-rep models and vendor-specific geometry formats, primarily focusing on Parasolid (used by SOLIDWORKS) and OpenCASCADE (used by FreeCAD). The system handles the extraction, transformation, and re-injection of B-rep data into proprietary containers.
Parasolid translation manages the extraction and encoding of .x_t (text) and .x_b (binary) geometry data within SOLIDWORKS .SLDPRT and .SLDASM files.
Kit identifies Parasolid payloads by scanning compound stream records for specific magic numbers or headers. It identifies native Parasolid content within raw-deflate streams. The decoder extracts compressed Parasolid transmit blobs and converts them into neutral BrepModel structures.
The following diagram illustrates the flow of Parasolid data during a SOLIDWORKS part read:
flowchart TD
A[SLDPRT Archive] --> B{Scan Records}
B -->|Match Magic| C[Extract Partition Stream]
C --> D[Decompress Zlib Blob]
D --> E[Parse Parasolid Transmit File]
E --> F[Neutral BrepModel]
The system identifies Contents/Config-0-Partition as the primary Parasolid body cache in SOLIDWORKS files.
Kit can drop the Parasolid geometry cache entirely in SOLIDWORKS files. If the cache is absent, SOLIDWORKS rebuilds the identical solid geometry from the feature history records (Contents/Config-0-ResolvedFeatures) and XML metadata.
OpenCASCADE translation facilitates B-rep interchange for FreeCAD .FCStd files, typically using the BREP format.
The system converts neutral B-rep models into OpenCASCADE-compatible ASCII BREP strings. These strings start with the standard header: CASCADE Topology V1, (c) Matra-Datavision.
FreeCAD adapters handle geometry through Part::PropertyPartShape properties. Kit manages primary .brp (BREP) files and associated sidecar files like .Map.txt (Element Maps) to preserve topological naming and entity mappings.
| Format | Native CAD | Storage Method | Neutral Representation |
|---|---|---|---|
| Parasolid | SOLIDWORKS | Compressed blobs in streams |
BrepModel / ParasolidPayload
|
| OpenCASCADE | FreeCAD | ASCII .brp files in ZIP |
BrepModel / ProvenAsciiBrep
|
Conversion between formats utilizes a central neutral model.
sequenceDiagram
participant S as SOLIDWORKS (.SLDPRT)
participant K as Kit Neutral (BrepModel)
participant F as FreeCAD (.FCStd)
S->>K: Extract Parasolid Blob
Note over K: Convert to Neutral Topology
K->>F: Serialize to OCC BREP (.brp)
Note over F: Insert into FCStd ZIP
- Stale Caches: Stale derived caches (like bounding boxes or Parasolid face blobs) are generally safe to leave in the document; the vendor application recomputes them on load.
- Incorrect Caches: Writing plausible but mathematically incorrect geometry caches often leads to application crashes or zero-volume bodies.
-
Feature Identity: SOLIDWORKS identifies bodies via a
final_feature_idwhich must correlate with the B-rep bodies stored in the Parasolid partition.
The BrepPayload object for Parasolid data includes specific attributes used for reconstruction:
| Attribute | Type | Description |
|---|---|---|
format_id |
string | Set to "parasolid"
|
kind |
string | e.g., "partition" or "shape"
|
wrapper_offset |
integer | Byte offset of the vendor wrapper |
compressed_size |
integer | Size of the zlib-compressed payload |
Kit validates OpenCASCADE ASCII BREP strings by checking for the structural header.
Consult the linked source file for the exact implementation; this reference does not duplicate executable code.
Published from repository revision 1149072d · PR #50 is awaiting merge · Maintenance guide
- Home
- Getting started
- API reference
- Architecture
- Conversion engine
- Contributing
- Change entries
- Gotchas
- Maintaining the wiki
- Assembly & Constraints Model
- Boundary Representation (B-Rep)
- Neutral Document Model
- Parametric Features Model