cad3d-ir-edrawings
cad3d-ir-edrawings imports eDrawings parts (.eprt) and assemblies
(.easm) into cad3d-ir through
edrawings-kit. An eDrawings
file is a HOOPS Stream File (HSF), on its own or inside a ZIP container
(sometimes behind a short preamble). edrawings-kit reads it with bounded
resources and returns a display bundle: every body once as packed buffers,
every placement of a body with its estimated matrix, name and colour, the saved
configuration that is shown, and the preview image. The adapter writes that
bundle as one glTF binary with the same conventions as the STEP adapter and
describes it as products, occurrences and bodies.
The geometry is the tessellation eDrawings saved; there is no B-Rep in these
files. Placements are estimates: they follow the stored segment tree, modelling
matrices, includes and repeat instances, and eDrawings' own arrangement is not
guaranteed to match (EDRAWINGS_PLACEMENT_ESTIMATED). On the project's own
fixtures (a box written in millimetres, metres and inches, and the reference
assembly of cad3d-ir-step) the bounds and placements match the STEP sources
to within a micrometre.
The distribution depends on cad3d-ir and edrawings-kit (MIT / Apache-2.0,
an independent implementation of the public HSF specification); the core
distribution does not depend on this adapter.
Usage
from pathlib import Path
from cad3d_ir import DirectoryResourceWriter
from cad3d_ir.importers import ImportOptions
from cad3d_ir_edrawings import EdrawingsImporter
result = EdrawingsImporter().import_file(
Path("frame.easm"),
options=ImportOptions(include_visualization_mesh=True, include_brep=False),
resources=DirectoryResourceWriter("converted"),
)
visualization = result.package.visualizations[0] # geometry/<slug>-<key>.glb
print(visualization.statistics["triangles"], visualization.statistics["placements"])
for diagnostic in result.diagnostics:
print(diagnostic.code, diagnostic.message)
cad3d-ir-edrawings frame.easm converted/ # manifest + GLB + preview image
cad3d-ir-edrawings part.eprt converted/ --no-mesh # metadata and preview only
cad3d-ir-edrawings frame.easm converted/ --configuration Beta # another saved configuration
cad3d-ir-edrawings frame.easm converted/ --include-hidden # keep hidden components as invisible occurrences
cad3d-ir-edrawings sheet.edrw converted/ --accept-drawings # 3D bodies of a drawing, sheets ignored
cad3d-ir-edrawings frame.easm converted/ --diagnostics report.json
Units and axes
Coordinates keep the model's own axes. The model_units option of the stream
(millimetres per model unit: 1 mm, 1000 m, 25.4 inch) scales positions
and translations to package millimetres; SOLIDWORKS-written files omit the
option and store metres, which is the default. Matrices are converted from the
kit's row-vector convention to cad3d-ir's column-vector matrices. Node 0 of
the GLB converts millimetres and Z-up to glTF conventions exactly as the STEP
adapter does, so an eDrawings file and the STEP exported from the same model
land in the same place.
What the package contains
- one
SourceDocument(format="edrawings",version= the writer string such asSWeModels-30.4.0.0045-2022207) whosepropertiescarry the container kind, HSF version, writer, writer year hint, mount path, model name,model_units, the container entries and the saved configurations; - a root product (
assemblyfor.easm,partfor.eprt) with one configuration named after the shown saved configuration; - one
partproduct per set of bodies that is placed together: the kit's instances are grouped by component name, path and matrix into placements, and placements of the same bodies share a product (SCR083-9andSCR083-10become two occurrences ofSCR083). Each product has one configuration with its bodies; a body carries the most common saved colour as its appearance; - one
Occurrenceper placement under the root configuration, with the matrix in package millimetres andvisible=Falsefor components eDrawings hides (only withinclude_hidden=True; by default they are left out); - one package
Visualizationpointing at the GLB withtriangles(placed),mesh_triangles(unique),line_segments,vertices,nodes,meshes,placementsandbodiesstatistics; - the saved preview image as a resource (
preview/<slug>-<key>.jpg,properties.role="preview-image"), referenced frommetadata.preview_resource_id.
The GLB writes each kit body once as a vertex set in millimetres (stored
normals kept). A glTF mesh exists per distinct (bodies, colours) of a
placement, with one TRIANGLES primitive per body (extras.ranges =
[[pick_id, 0, index_count]], the pick id being the 1-based kit body index)
and one LINES primitive per body for the stored outline edges. One node per
placement carries the occurrence id in extras.id and the converted matrix;
placements of the same product with the same colours share the mesh.
Options
ImportOptions (core): include_visualization_mesh writes the GLB (without it
the package carries products, occurrences, bodies and the preview);
mesh_include_edges controls the outline primitives; strict turns a document
without 3D bodies and without a preview image into EdrawingsReadError;
validate runs the package graph validation. The tessellation options do not
apply: the mesh is the one eDrawings saved.
EdrawingsImporter(accept_drawings=False, include_preview=True, configuration=None, display_state=None, include_hidden=False, limit_profile="service", limits=None):
accept_drawings=Truereads the 3D bodies stored with.edrwdrawings; the 2D sheets are not read (EDRAWINGS_DRAWING_SHEETS_IGNORED). By default drawings raiseUnsupportedDocumentKindError.configurationshows a saved configuration (itsconfig nameorconfigNsegment) instead of the file's active one;display_stateapplies a saved display state (dispNor its name) of it. Unknown names raiseUnknownSelectionError.include_hidden=Truekeeps components eDrawings hides as invisible occurrences; they stay out of the GLB.limit_profileis the edrawings-kit resource profile:servicekeeps the kit's traversal, vertex and instance caps for shared servers but lifts the container and XML sizes production assemblies reach (a 2 MBmaterials.xmlholds more than the kit's default 20,000 elements);desktopallows larger inputs.limitspasses an explicitedrawings_kit.Limits. Exceeding a limit raisesEdrawingsLimitError.
Diagnostics
| Code | Severity | Meaning |
|---|---|---|
EDRAWINGS_DISPLAY_MESH_ONLY |
info | Geometry is the saved tessellation; no exact surfaces exist in the file. |
EDRAWINGS_PLACEMENT_ESTIMATED |
info | Placements follow the stored scene graph; details.withheld_by lists the kit codes that keep the result partial. |
EDRAWINGS_CONFIGURATION_SELECTED |
info | Which saved configuration and display state are shown and how they were selected. |
EDRAWINGS_HIDDEN_COMPONENTS_SKIPPED |
info | Components eDrawings hides are left out of the GLB (and of the occurrences unless include_hidden). |
EDRAWINGS_UNPLACED_BODIES |
warning | Bodies without a placement in the shown configuration are not drawn. |
EDRAWINGS_LINE_ONLY_BODIES_SKIPPED |
info | Placements that carry only line geometry are left out. |
EDRAWINGS_APPEARANCE_NOT_SAVED |
info | No colour is stored for the shown bodies; the default face colour is used. |
EDRAWINGS_COLOR_FROM_MATERIALS |
info | Colours come from materials.xml or component options rather than the HSF stream. |
EDRAWINGS_RENDER_SETTINGS_IGNORED |
info | Stored render settings (lighting, display modes, line styles) are not evaluated. |
EDRAWINGS_MATERIALS_UNREADABLE |
warning | materials.xml could not be read; colours fall back to the stream. |
EDRAWINGS_STOPPED_AT |
warning | The stream could not be read to its end; bodies read before the stop are kept (details.record_id). |
EDRAWINGS_READER_DIAGNOSTICS |
info | Counts of the further edrawings-kit diagnostics (details.codes). |
EDRAWINGS_VERSION_UNSUPPORTED |
error | edrawings-kit could not read the display bundle of this HSF version; metadata and preview only. |
EDRAWINGS_PREVIEW_ONLY |
warning | No 3D body could be read; only the preview image and metadata are available. |
EDRAWINGS_PREVIEW_UNREADABLE |
warning | The saved preview image could not be extracted or decoded. |
EDRAWINGS_NO_GEOMETRY |
error | Neither 3D bodies nor a preview image exist; only metadata was read. |
EDRAWINGS_DRAWING_SHEETS_IGNORED |
warning | The file is a drawing; its 2D sheets are not read. |
Current boundary
- Parts and assemblies written by eDrawings (SOLIDWORKS
SWeModels-*writers, HOOPS Exchange based writers such as eDrawings 2026, and older Pro/ENGINEER publishers down to HSF 8.05 in the corpus) yield bodies and placements. Drawings yield only the 3D bodies they may carry; their sheets are a later stage. - Placements are estimated from the scene graph (see above). One saved configuration and one display state are shown per import.
- Colours follow the kit's precedence (inherited HSF colour,
materials.xmlentity, componentdefaultcolor); textures are not read. - The adapter is byte-faithful to the kit apart from the unit scale: normals and indices go into the GLB without conversion.
Tests
The test suite builds minimal HSF streams and containers in memory with the
grammar edrawings-kit's own tests use, and ships five self-authored eDrawings
2026 files (see tests/fixtures/README.md). Set CAD3D_IR_EDRAWINGS_SAMPLES to
a directory of local .eprt/.easm files to run the optional sample check.
License
MIT, like cad3d-ir and cad3d-ir-step.
Metadata
Release files for cad3d-ir-edrawings 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cad3d_ir_edrawings-0.3.0.tar.gz | 47.0 kB | Without provenance | Details for cad3d_ir_edrawings-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cad3d_ir_edrawings-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for cad3d_ir_edrawings-0.3.0-py3-none-any.whl |
Total release size: 74.9 kB
Release files / cad3d_ir_edrawings-0.3.0.tar.gz
| Download URL | cad3d_ir_edrawings-0.3.0.tar.gz |
|---|---|
| Size | 47.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d76da4d93f6b8363e94d4c73045dc8309930030a6131a2ebb494059163f494bf
|
|
BLAKE2b-256 checksum How to use checksums |
ca467f39d6d37d21f16452abbaed846656a7009ea23b7a60a83c7ee839643635
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cad3d_ir_edrawings-0.3.0-py3-none-any.whl
| Download URL | cad3d_ir_edrawings-0.3.0-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc2c76a180fe75332bc0f32f770e2961df111d2d0b76ecccfa578ee5ec36e7c9
|
|
BLAKE2b-256 checksum How to use checksums |
c59585f13312dfd43ba75fa2d3daf12acf74af5e6c8b449e0ba54aee0c70ef00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for cad3d-ir-edrawings 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.