Added a label instance attribute to each of the shapes so that they can be identified separately.

This commit is contained in:
Jeremy Mack Wright 2015-11-24 15:45:12 -05:00
parent b1a6187d3e
commit 007725a28c

View File

@ -62,6 +62,9 @@ class Shape(object):
self.wrapped = obj self.wrapped = obj
self.forConstruction = False self.forConstruction = False
# Helps identify this solid through the use of an ID
self.label = ""
@classmethod @classmethod
def cast(cls, obj, forConstruction=False): def cast(cls, obj, forConstruction=False):
"Returns the right type of wrapper, given a FreeCAD object" "Returns the right type of wrapper, given a FreeCAD object"
@ -356,6 +359,9 @@ class Vertex(Shape):
self.Y = obj.Y self.Y = obj.Y
self.Z = obj.Z self.Z = obj.Z
# Helps identify this solid through the use of an ID
self.label = ""
def toTuple(self): def toTuple(self):
return (self.X, self.Y, self.Z) return (self.X, self.Y, self.Z)
@ -381,6 +387,9 @@ class Edge(Shape):
FreeCADPart.Circle: 'CIRCLE' FreeCADPart.Circle: 'CIRCLE'
} }
# Helps identify this solid through the use of an ID
self.label = ""
def geomType(self): def geomType(self):
t = type(self.wrapped.Curve) t = type(self.wrapped.Curve)
if self.edgetypes.has_key(t): if self.edgetypes.has_key(t):
@ -476,6 +485,9 @@ class Wire(Shape):
""" """
self.wrapped = obj self.wrapped = obj
# Helps identify this solid through the use of an ID
self.label = ""
@classmethod @classmethod
def combine(cls, listOfWires): def combine(cls, listOfWires):
""" """
@ -546,6 +558,9 @@ class Face(Shape):
FreeCADPart.Cone: 'CONE' FreeCADPart.Cone: 'CONE'
} }
# Helps identify this solid through the use of an ID
self.label = ""
def geomType(self): def geomType(self):
t = type(self.wrapped.Surface) t = type(self.wrapped.Surface)
if self.facetypes.has_key(t): if self.facetypes.has_key(t):
@ -602,6 +617,9 @@ class Shell(Shape):
""" """
self.wrapped = wrapped self.wrapped = wrapped
# Helps identify this solid through the use of an ID
self.label = ""
@classmethod @classmethod
def makeShell(cls, listOfFaces): def makeShell(cls, listOfFaces):
return Shell(FreeCADPart.makeShell([i.obj for i in listOfFaces])) return Shell(FreeCADPart.makeShell([i.obj for i in listOfFaces]))
@ -614,6 +632,9 @@ class Solid(Shape):
""" """
self.wrapped = obj self.wrapped = obj
# Helps identify this solid through the use of an ID
self.label = ""
@classmethod @classmethod
def isSolid(cls, obj): def isSolid(cls, obj):
""" """
@ -915,6 +936,9 @@ class Compound(Shape):
""" """
self.wrapped = obj self.wrapped = obj
# Helps identify this solid through the use of an ID
self.label = ""
def Center(self): def Center(self):
return self.Center() return self.Center()