Example #1
0
    def execute(self, obj):
        if isDerivedFrom(obj, "Part::FeaturePython"):
            obj.Shape = Shapes.compound(s.Shape for s in obj.Sources)
            obj.Placement = FreeCAD.Placement()

            obj.Outfaces = trace(obj) if P.autotrace else []

        elif isDerivedFrom(obj, "Mesh::FeaturePython"):
            obj.Mesh = Meshes.compound(meshOf(s) for s in obj.Sources)
            obj.Placement = FreeCAD.Placement()

        else:
            raise TypeError
Example #2
0
    def execute(self, obj):
        if isDerivedFrom(obj, "Part::FeaturePython"):
            obj.Shape = Shapes.reshape(obj.Source.Shape)
            obj.Placement = spexpr2fcexpr(self.getSymPyTransformation(obj))

            obj.Outfaces = trace(obj) if P.autotrace else []

        elif isDerivedFrom(obj, "Mesh::FeaturePython"):
            obj.Mesh = meshOf(obj.Source, remeshed=True)
            obj.Placement = spexpr2fcexpr(self.getSymPyTransformation(obj))

        else:
            raise TypeError
Example #3
0
    def execute(self, obj):
        if isDerivedFrom(obj, "Part::FeaturePython"):
            obj.Shape = shape_absoluteComplement(obj.Source.Shape, reshaped=True)
            obj.Placement = FreeCAD.Placement()

            obj.Outfaces = trace(obj) if P.autotrace else []

        elif isDerivedFrom(obj, "Mesh::FeaturePython"):
            obj.Mesh = Meshes.complement(meshOf(obj.Source), remeshed=True)
            obj.Placement = FreeCAD.Placement()

        else:
            raise TypeError
Example #4
0
    def execute(self, obj):
        if isDerivedFrom(obj, "Part::FeaturePython"):
            obj.Shape = Shapes.common([obj.Origin.Shape, obj.Masker.Shape])
            obj.Placement = FreeCAD.Placement()

            obj.Outfaces = trace(obj) if P.autotrace else []

        elif isDerivedFrom(obj, "Mesh::FeaturePython"):
            obj.Mesh = Meshes.common([meshOf(obj.Origin), meshOf(obj.Masker)])
            obj.Placement = FreeCAD.Placement()

        else:
            raise TypeError
Example #5
0
    def execute(self, obj):
        if obj.Origin is None:
            obj.Shape = Part.Shape()
            return

        if isDerivedFrom(obj.Origin, "Part::Compound"):
            ftrs = obj.Origin.Links
        elif isDerivedFrom(obj.Origin, Compound):
            ftrs = obj.Origin.Sources
        else:
            raise TypeError

        if isDerivedFrom(obj, "Part::FeaturePython"):
            shapes = []
            for ftr in ftrs:
                shape = Shapes.reshape(ftr.Shape)
                center = Shapes.center(shape)
                if center is None:
                    R = FreeCAD.Vector(0,0,0)
                else:
                    R = center - obj.Base
                shift = R*obj.Ratio - R
                shape.Placement = FreeCAD.Placement(shift, FreeCAD.Rotation())
                shapes.append(shape)
            obj.Shape = Shapes.compound(shapes)

            obj.Outfaces = trace(obj) if P.autotrace else []

        elif isDerivedFrom(obj, "Mesh::FeaturePython"):
            meshes = []
            for ftr in ftrs:
                mesh = meshOf(ftr, remeshed=True)
                center = Meshes.center(mesh)
                if center is None:
                    R = FreeCAD.Vector(0,0,0)
                else:
                    R = center - obj.Base
                shift = R*obj.Ratio - R
                mesh.translate(*shift)
                meshes.append(mesh)
            obj.Mesh = Meshes.compound(meshes)

        else:
            raise TypeError