Fix: support Fusion documents created with Part design intent - #1
Open
paulJordaan wants to merge 1 commit into
Open
Fix: support Fusion documents created with Part design intent#1paulJordaan wants to merge 1 commit into
paulJordaan wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running the panel generator in a Fusion document created with the newer Part design intent (as opposed to Assembly/Hybrid) fails with:
This comes from
generatePanel()inlib/panelUtils/panel_command.py, which unconditionally callsOccurrences.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 aPart,Assembly, orHybriddesign intent (Design.designIntent); aPart-intent document is restricted to a single component, soaddNewComponent()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 comparedes.timeline.countbefore/after generation instead of relying on the now-optional new occurrence'stimelineObject.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🤖 Generated with Claude Code
https://claude.ai/code/session_01AgGpgrEGYVZbzoqi5D2X8m