BrepBody.copyToComponent creates an open model from a closed model

BrepBody.copyToComponent creates an open model from a closed model

Anonymous
Not applicable
359 Views
1 Reply
Message 1 of 2

BrepBody.copyToComponent creates an open model from a closed model

Anonymous
Not applicable

I'm copying bodies from one component to a new component to do destructive calculations on the new body. When I copy one body (which is closed) it coppies and is no longer closed. Note that I'm not sure what the correct term is but see the picutres below.

This makes the inteference calcuations I'm performing invalid as the the API cannot detect interference with an unclosed body.

 

What is causing this error and can it be remidied. My copying code is below, but it has not caused this issue on any other design.

def createCopyComponent(self, modelBool, copyBool, component):
        copy = createNewComponent(self.model)#todo change to rwoh component and check for code validation
        occurencesOfCopy = self.design.rootComponent.allOccurrencesByComponent(copy)
        bodies = getModelBodies(component)
#        string = ""
#        for body in bodies:
#            string+=body.parentComponent.name+"."+body.name+", "
        for body in bodies:
            if copyBool:
                occ =occurencesOfCopy.item(0)
                body.copyToComponent(occ)
            elif not self.copyBody(body):
                if not modelBool:
#                    self.ui.messageBox("copyying: "+body.parentComponent.name+"."+body.name)
                    occ =occurencesOfCopy.item(0)
#                    self.ui.messageBox("occ: "+occ.component.name)
                    body.copyToComponent(occ)
                elif not self.rwohBody(body):
#                    self.ui.messageBox("copyying: "+body.parentComponent.name+"."+body.name)
                    occ =occurencesOfCopy.item(0)
#                    self.ui.messageBox("occ: "+occ.component.name)
                    body.copyToComponent(occ)
        return copy

Capture.PNGCapture.PNGPalm(861) is the copy

 

0 Likes
360 Views
1 Reply
Reply (1)
Message 2 of 2

ekinsb
Alumni
Alumni

Can you provide the code for getModelCopies and what should the values of the input arguments be?  Can you also provide a simple design that demonstrates the problem?  You can attached the .f3d file.  Thanks.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes