SOLVED: Common Face when one object is a Linked Copy.

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

SOLVED: Common Face when one object is a Linked Copy.

Post by keithsloan52 »

I am trying to write code to find a common face.

I have a challenge in that one Object2 is a Linked copy of Object1 with a different Placement (Base), otherwise the Shape of the two objects are the same. If I try and create a new shape from the objects with something like

Code: Select all

def adjustShape(part):
    # Shape is immutable so have to copy somehow?
    shape = part.Group[0].Shape
    return shape.translate(part.Placement.Base)
I get an error <class 'ReferenceError'>: This object is immutable, you can not set any attribute or call a non const method

Okay the following works

Code: Select all

def adjustShape(part):
    # Shape is immutable so have to copy somehow?
    shape = part.Group[0].Shape.copy()
    return shape.translate(part.Placement.Base)
Post Reply