Пример #1
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
Пример #2
0
    def execute(self, obj):
        V = getattr(obj, "ViewBox", None)
        mbb = boundBoxOf(V) if V is not None else None
        expr = self.getSymPyExpression(obj)

        if isDerivedFrom(obj, "Part::FeaturePython"):
            shape = Shapes.construct(expr, mbb)
            obj.Shape = Shapes.reshape(shape)

        elif isDerivedFrom(obj, "Mesh::FeaturePython"):
            mesh = Meshes.construct(expr, mbb)
            obj.Mesh = Meshes.remesh(mesh)

        else:
            raise TypeError
Пример #3
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