예제 #1
0
def meshOf(obj, precision=0.01, remeshed=True):
    if obj is None:
        return Mesh.Mesh()
    elif isDerivedFrom(obj, "Part::Feature"):
        return Meshes.asMesh(obj.Shape, precision=precision)
    elif isDerivedFrom(obj, "Mesh::Feature"):
        if remeshed:
            return Meshes.remesh(obj.Mesh)
        else:
            return obj.Mesh
    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