SourceBody from "SplitBody" SplitFeature

SourceBody from "SplitBody" SplitFeature

J-Camper
Advisor Advisor
447 Views
4 Replies
Message 1 of 5

SourceBody from "SplitBody" SplitFeature

J-Camper
Advisor
Advisor

I've been spinning my wheels for a little bit on this one.  I want to find the SourceBody used in a SplitFeature of SplitType "SplitBody".  The SurfaceBodies Property only returns resulting bodies.

 

What is the fastest way to get the sourcebody?  Do I have to dig through the BrowserNodes Under the SurfaceBodies BrowserFolder to check to find a body with an AffectedByFeatures Item that has the same name as my SplitFeature?

 

Anyone have any insight to a quick workflow?

0 Likes
448 Views
4 Replies
Replies (4)
Message 2 of 5

nmunro
Collaborator
Collaborator

Since the original surface body is "deleted" when you split it into two or more surface bodies using this tool you could try the following.

 

1. Get a list of the surface body names in the model after the split feature.

2. Suppress the split feature (which does not suppress the surface body browser nodes for the bodies created by the split feature, but does suppress the associated surface bodies in ComponentDefinition.SurfaceBodies)

3. Get a list of the surface body names and capture the one(s) not in the first list.

 

Of course this surface body will disappear again when you unsuppress the split feature.

        


https://c3mcad.com

0 Likes
Message 3 of 5

J-Camper
Advisor
Advisor

@nmunro,

 

Thanks for the reply, I never really thought of the sourcebody being "Deleted" by the feature but that does kind of make sense.

 

I was hoping not to make model changes, but that does seem like a straight forward workflow. I can probably avoid model changes in the actual part file by saving a copy as a temporary part file.

 

I don't need the body itself, I just need to determine it's CreatedByFeature, so this might work.

 

I'm going to leave the forum post open for more suggestions while I work out when I can try this workflow.

0 Likes
Message 4 of 5

nmunro
Collaborator
Collaborator

If you don't want to dirty the document you can wrap the code in a transaction. Once you have the data you need you can abort the transaction.  

        


https://c3mcad.com

0 Likes
Message 5 of 5

J-Camper
Advisor
Advisor

@nmunro,

 

That is a better way to handle it.  I use transactions to bundle API operations into undo blocks for end user management, and only use Abort in error handling.  I never think of the Abort Method as an intentional workflow strategy.

0 Likes