Skip to content

Fix: support Fusion documents created with Part design intent - #1

Open
paulJordaan wants to merge 1 commit into
cowboy:mainfrom
paulJordaan:fix/part-design-intent
Open

Fix: support Fusion documents created with Part design intent#1
paulJordaan wants to merge 1 commit into
cowboy:mainfrom
paulJordaan:fix/part-design-intent

Conversation

@paulJordaan

Copy link
Copy Markdown

Problem

Running the panel generator in a Fusion document created with the newer Part design intent (as opposed to Assembly/Hybrid) fails with:

RuntimeError: 3 : Failed to create component: Part Design documents can only
contain one component, please add this Part to an Assembly to add multiple
components.

This comes from generatePanel() in lib/panelUtils/panel_command.py, which unconditionally calls Occurrences.addNewComponent() on the root component to create a sub-component for the panel geometry. Fusion's newer document-creation flow lets a document be created with a Part, Assembly, or Hybrid design intent (Design.designIntent); a Part-intent document is restricted to a single component, so addNewComponent() on the root always throws there.

Fix

Only create a new sub-component when des.designIntent == HybridDesignIntentType; otherwise generate the panel geometry directly in the root component, since that's the only component a Part-intent document supports. Timeline grouping is adjusted to compare des.timeline.count before/after generation instead of relying on the now-optional new occurrence's timelineObject.

This is the same approach used to fix the identical error in another Fusion add-in that hit this exact issue: Le0Michine/FusionGridfinityGenerator#181, fixed in commit 8a113b9.

Test plan

  • python3 -m py_compile lib/panelUtils/panel_command.py
  • Manually verified in Fusion against a Part-intent document (reporter's environment)
  • Manually verified no regression against existing Hybrid/legacy documents

🤖 Generated with Claude Code

https://claude.ai/code/session_01AgGpgrEGYVZbzoqi5D2X8m

Fusion's newer document types can be created with a "Part" design
intent, which only supports a single component. Calling
Occurrences.addNewComponent() on the root component in that case
raises: "Failed to create component: Part Design documents can only
contain one component, please add this Part to an Assembly to add
multiple components."

Only create a new sub-component when the design intent is Hybrid
(the common case for pre-existing/legacy documents); otherwise
generate the panel geometry directly in the root component. Timeline
grouping is adjusted to use timeline counts before/after generation
instead of relying on the now-optional new occurrence.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AgGpgrEGYVZbzoqi5D2X8m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant