Example #1
0
    def onChanged(self,prop,attach=False):
        #FreeCAD.Console.PrintMessage("onChanged  %s, %s, %s\n"%(self,prop,attach))

        #FIXME workaroud for arg # problem
     try:
        op=prop
        if attach:
            prop=attach

        if prop == "Coordinates":
            self.setCoords()
            for e in self.getMyEdges():
                e.Proxy.createGeometry()
            for f in self.getMyFaces():
                f.Proxy.createGeometry()
        elif prop == "Visibility":
            #FreeCAD.Console.PrintMessage("V= %s\n"%(self.Visibility))
            if self.Visibility:
                self.show()
            else:
                self.hide()
        else:
            DocumentObject.onChanged(self,op,attach)
     except:
        prtb()
Example #2
0
    def onChanged(self,prop,attach=False):
        #FreeCAD.Console.PrintMessage("onChanged  %s, %s, %s\n"%(self,prop,attach))

        #FIXME workaroud for arg # problem
     try:
        op=prop
        if attach:
            prop=attach

        if prop == "Coordinates":
            self.setCoords()
            for e in self.getMyEdges():
                e.Proxy.createGeometry()
            for f in self.getMyFaces():
                f.Proxy.createGeometry()
        elif prop == "Visibility":
            FreeCAD.Console.PrintMessage("V= %s\n"%(self.Visibility))
            if self.Visibility:
                self.show()
            else:
                self.hide()
        else:
            DocumentObject.onChanged(self,op,attach)
     except:
        prtb()
Example #3
0
 def __init__(self,layer,points):
         DocumentObject.__init__(self)
         FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Face",self,self)
         self.addProperty("App::PropertyLinkList","Edges","Base","End point")
         #self.addProperty("App::PropertyLink","Layer","Base", "The layer this point is in")
         #self.Layer=layer.getobj()
         layer.registerFace(self)
         edges = self.getOrCreateEdges(points)
         if not edges:
             raise UnimplementedError, "Cannot add a face by noncircular edgeset"
         self.Edges = map(lambda x: x.getobj(), edges)
         self.createGeometry()
Example #4
0
 def __init__(self,layer,vect=None):
         DocumentObject.__init__(self)
         FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Point",self,self)
         self.addProperty("App::PropertyVector","Coordinates","Base","Coordinates")
         #self.addProperty("App::PropertyLinkList","Edges","Base", "Edges using this point")
         #self.addProperty("App::PropertyLink","Layer","Base", "The layer this point is in")
         layer.registerPoint(self)
         if vect is None:
             vect=FreeCAD.Base.Vector(0,0,0)
         self.activate()
         self.Coordinates=vect
         self.show()
         self.createGeometry()
Example #5
0
 def __init__(self,layer,vect=None):
         DocumentObject.__init__(self)
         FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Point",self,self)
         self.addProperty("App::PropertyVector","Coordinates","Base","Coordinates")
         #self.addProperty("App::PropertyLinkList","Edges","Base", "Edges using this point")
         #self.addProperty("App::PropertyLink","Layer","Base", "The layer this point is in")
         layer.registerPoint(self)
         if vect is None:
             vect=FreeCAD.Base.Vector(0,0,0)
         self.activate()
         self.Coordinates=vect
         self.show()
         self.createGeometry()
 def __init__(self,mesh,name=None):
         DocumentObject.__init__(self)
         if name == None:
             name = self.getDefaultName()
         FreeCAD.ActiveDocument.addObject("App::FeaturePython","Layer",self,self)
         self.addProperty("App::PropertyLinkList","Edges","Base", "Edges")
         self.addProperty("App::PropertyLinkList","Points","Base", "Points")
         self.addProperty("App::PropertyLinkList","Faces","Base", "Faces")
         self.addProperty("App::PropertyLinkList","Layers","Base", "Faces")
         #self.addProperty("App::PropertyLink","Mesh","Base", "The mesh this point is in")
         #self.Mesh=mesh.getobj()
         mesh.registerLayer(self)
         self.Label = name
Example #7
0
 def __init__(self, mesh, name=None):
     DocumentObject.__init__(self)
     if name == None:
         name = self.getDefaultName()
     FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Layer", self,
                                      self)
     self.addProperty("App::PropertyLinkList", "Edges", "Base", "Edges")
     self.addProperty("App::PropertyLinkList", "Points", "Base", "Points")
     self.addProperty("App::PropertyLinkList", "Faces", "Base", "Faces")
     self.addProperty("App::PropertyLinkList", "Layers", "Base", "Faces")
     #self.addProperty("App::PropertyLink","Mesh","Base", "The mesh this point is in")
     #self.Mesh=mesh.getobj()
     mesh.registerLayer(self)
     self.Label = name
 def __init__(self,layer,start,end,crease=None):
         DocumentObject.__init__(self)
         FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Edge",self,self)
         self.addProperty("App::PropertyLink","Start","Base","Start point")
         self.addProperty("App::PropertyLink","End","Base","End point")
         #self.addProperty("App::PropertyLink","Layer","Base", "The layer this point is in")
         self.addProperty("App::PropertyEnumeration","Creased","Base","Creased?").Creased=["Creased","Normal"]
         #self.addProperty("App::PropertyLinkList","Faces","Base", "Faces using this edge")
         #self.Layer=layer.getobj()
         layer.registerEdge(self)
         self.Start=start.getobj()
         self.End=end.getobj()
         self.setCreased(crease)
         self.createGeometry()
Example #9
0
 def attach(self,obj=None):
     DocumentObject.attach(self,obj)
Example #10
0
 def __setstate__(self,state):
     self.p0=None
     DocumentObject.__setstate__(self,state)
     self.activate()
 def __init__(self):
         DocumentObject.__init__(self)
         History.__init__(self)
         FreeCAD.ActiveDocument.addObject("App::FeaturePython","Mesh",self,self)
         self.addProperty("App::PropertyLinkList","Layers","Base", "Layers")
Example #12
0
 def attach(self,obj=None):
     DocumentObject.attach(self,obj)
Example #13
0
 def __setstate__(self,state):
     self.p0=None
     DocumentObject.__setstate__(self,state)
     self.activate()
Example #14
0
 def __init__(self):
     DocumentObject.__init__(self)
     History.__init__(self)
     FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Mesh", self,
                                      self)
     self.addProperty("App::PropertyLinkList", "Layers", "Base", "Layers")
Example #15
0
 def onChanged(self,prop,attach=False):
     if prop == "Creased":
         self.creaseColor()
     else:
         DocumentObject.onChanged(self,prop,attach)