Skip to main content

cad3d-ir-fusion

cad3d-ir-fusion imports Autodesk Fusion designs (.f3d) and design packages (.f3z) into cad3d-ir through buildf3d and cq-acis. buildf3d reads the component tree and places every occurrence, with the linked designs of an F3Z expanded in place. cq-acis converts the ASM bodies of the shown components into exact OCCT solids. The adapter writes one glTF binary with the same conventions as the STEP adapter, and because the solids are exact B-Rep, the same design can be written as a STEP assembly (export_step).

A Fusion design stores lengths in centimetres; the package is in millimetres.

Colours follow the appearances of the design. A placed body takes the appearance applied to the body, else the one applied to the nearest occurrence above it, else the one of its physical material. A face with an appearance of its own keeps it. The GLB and the STEP file carry these colours (FUSION_APPEARANCE_COLOURS). In the STEP file every colour sits on a solid or a face: a placement that an occurrence appearance colours differently from the other placements of its body is written as a shape of its own.

Canvases, the images a design places on a plane of a component (the artwork on the two sides of a board, a reference picture), are kept as pictures: the image files are resources of the package and metadata.pictures lists where they lie (FUSION_CANVASES_SHOWN). They are not geometry. The GLB of the package, the BREP resources and the STEP file hold the bodies only; cad3d_ir_fusion.pictures.show_pictures returns the GLB with the pictures for display:

from cad3d_ir_fusion import show_pictures

glb = read(package.visualizations[0].resource_id)
shown, count = show_pictures(glb, package, read)  # read(resource_id) -> bytes

What the adapter does not do:

  • It reads the bodies the design stores for its current state. Nothing is recomputed from the timeline.
  • Of an appearance it reads the colour only: no textures, no transparency and no other material properties.
  • Whether a canvas is hidden is not read: a canvas of a shown component is listed.
  • Hidden occurrences and hidden bodies are left out of the visualization (FUSION_HIDDEN). A hidden occurrence stays in the package with visible: false.
  • Bodies whose faces do not close a volume (surface bodies) are left out (FUSION_BODY_SHEET), and so is a body with geometry the converter does not build (FUSION_BODY_UNSUPPORTED, FUSION_BODY_FAILED).
  • Components of linked designs that are not in the file, as in an F3D saved without its references, are left out (FUSION_LINK_UNRESOLVED).
  • A record stored in a layout buildf3d does not read is skipped and reported (FUSION_DESIGN_PARTIAL).
  • Mesh bodies, sketches, joints and the timeline are not read.

The distribution depends on cad3d-ir, cad3d-ir-step (tessellation and the STEP writer), buildf3d and cq-acis[occt]; the core distribution does not depend on this adapter. buildf3d and cq-acis need Python 3.11 or later: on Python 3.10 the package installs without them and reading raises FusionImportError.

Usage

from pathlib import Path

from cad3d_ir import DirectoryResourceWriter
from cad3d_ir.importers import ImportOptions
from cad3d_ir_fusion import FusionImporter, export_step

result = FusionImporter().import_file(
    Path("assembly.f3z"),
    options=ImportOptions(
        strict=False, include_visualization_mesh=True, include_brep=False
    ),
    resources=DirectoryResourceWriter("converted"),
)
print(result.statistics["bodies_converted"], result.statistics["triangles"])
for item in result.diagnostics:
    print(item.code, item.message)

export_step(Path("assembly.f3z"), Path("assembly.step"), schema="AP214")
cad3d-ir-fusion assembly.f3z converted --step assembly.step

read_source returns the design and its converted bodies once, so one read can feed both map_source and export_step.

Package layout

  • One ProductDefinition per component that is placed, part, assembly or hybrid (bodies and occurrences). The root product is named after the root component, or after the file when the design was never saved.
  • One Occurrence per child of a component configuration, with the placement relative to its parent. Instances of one component share a Configuration when their children sit at the same places; a path pose that places the children of two instances differently gives each its own configuration. A hidden occurrence has visible: false and an empty configuration.
  • One Body per converted body, named as in the design, with a brep representation when include_brep is set (one OCCT BREP resource per body, in the frame of its component; approximate when stored fits stand in).
  • One package Visualization (GLB, millimetres, Z up): one glTF node per shown occurrence, nested like the occurrences, and one node per placed body. Placements of a body share one mesh; a placement that an occurrence appearance colours differently has a mesh of its own. Node extras.id names the occurrence or the body.
  • The preview image the design stores, when it has one, as a resource with properties.role == "preview-image"; metadata.preview_resource_id names it. It is written even when no body converts, so a caller can show it.
  • The image of each canvas that a shown component places, as a resource with properties.role == "picture-image" (PNG or JPEG, with width, height and alpha). metadata.pictures lists each place: name, resource_id, occurrence_path (the occurrence IDs from the root design to the component, empty for the root component), corners (lower left, lower right, upper left and upper right corner of the image in the frame of the component, millimetres) and opacity. show_pictures adds them to a copy of the GLB as nodes with extras.picture, each a rectangle with the image as an unlit texture, 0.01 mm in front of its plane.
  • For an F3Z, one SourceDocument for the package and one per design in it that is placed.

Diagnostics

Code Meaning
FUSION_UNIT_CM Lengths are converted from centimetres to millimetres (info)
FUSION_EXACT_BREP Geometry is the B-Rep the design stores, converted to OCCT (info)
FUSION_APPEARANCE_COLOURS Bodies and faces carry the colour of their appearance, with counts (info)
FUSION_APPEARANCE_NOT_READ No appearance colour was read; default colour (info)
FUSION_CANVASES_SHOWN Canvas images are listed as pictures of the visualization, with counts (info)
FUSION_CANVAS_SKIPPED Canvas images that are missing, of another kind or too large, with reasons
FUSION_HIDDEN Hidden occurrences and bodies are left out of the visualization (info)
FUSION_APPROXIMATED_GEOMETRY Stored B-spline fits stand in for procedural curves and surfaces (info)
FUSION_BODY_SHEET Bodies whose faces do not close a volume are left out (info)
FUSION_DESIGN_PARTIAL Part of the design is in a layout buildf3d does not read
FUSION_LINK_UNRESOLVED Components of linked designs that are not in the file are left out
FUSION_BODY_UNSUPPORTED Bodies with geometry that is not converted, with reasons
FUSION_BODY_FAILED Bodies that could not be built, with reasons
FUSION_BODY_MISSING Bodies without a readable ASM body in the file
FUSION_MESH_FAILED Bodies that could not be tessellated
FUSION_PREVIEW_ONLY No shape can be displayed; the stored preview image is available
FUSION_NO_GEOMETRY No body yielded a displayable shape (error)
FUSION_DESIGN_UNSUPPORTED The component tree could not be read (error)
FUSION_KERNEL_MISSING cq-acis's occt extra is not installed (error)
FUSION_LIMIT buildf3d stopped at a resource limit (error)
FUSION_READ_FAILED The archive could not be read (error)

statistics carries the source format (f3d or f3z), buildf3d's status of the design, counts of documents, components, shown instances and hidden occurrences, body counts by outcome (bodies_converted, bodies_open_shell, bodies_unsupported, bodies_failed, bodies_missing), the reasons by converter code, the counts of approximated curves and surfaces with the largest fit tolerance, the coloured placements and faces (coloured_placements of body_placements, coloured_faces), the canvases (canvases, canvases_skipped, and pictures for the places listed), triangle counts and the read and conversion times, so a caller can show what was and was not read.

License

MIT, like cad3d-ir, buildf3d and cq-acis. Autodesk and Fusion are trademarks of Autodesk, Inc.; this adapter reads the saved files and ships no Autodesk software.

Metadata

Release files for cad3d-ir-fusion 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cad3d-ir-fusion 0.1.2
File Size Uploaded Provenance Actions
cad3d_ir_fusion-0.1.2.tar.gz 73.4 kB Without provenance Details for cad3d_ir_fusion-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cad3d-ir-fusion 0.1.2
File Interpreter ABI Platform Actions
cad3d_ir_fusion-0.1.2-py3-none-any.whl Python 3 none any Details for cad3d_ir_fusion-0.1.2-py3-none-any.whl

Total release size: 109.0 kB

Release files / cad3d_ir_fusion-0.1.2.tar.gz

Download URL cad3d_ir_fusion-0.1.2.tar.gz
Size 73.4 kB
Tags Source
SHA-256 checksum
How to use checksums
047e257fe0afa493cc14442b11d3911c02caa097e72060a57144a435072c382f
BLAKE2b-256 checksum
How to use checksums
8fbafb5ff04b57426b1d4292f047860701f1e686bb6cc92712c4494cb5fb51f4
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_fusion-0.1.2-py3-none-any.whl

Download URL cad3d_ir_fusion-0.1.2-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
383ca48712abf59e13f629840c2a8461626b7c1a84bff9b4de5ed248f6d4f6f3
BLAKE2b-256 checksum
How to use checksums
d8026e0ca2f92b6001cc704475db269cc467bbc539ae32faf59304586c0226d1
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-fusion 0.1.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page