Removed core which isn't used anymore; some debugging info to figure out the save/restore issus.
This commit is contained in:
parent
b26a7ad794
commit
1635d73b1b
|
@ -104,9 +104,14 @@ class Tag:
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def toString(self):
|
||||||
|
return str((self.x, self.y, self.width, self.height, self.angle, self.enabled))
|
||||||
|
|
||||||
def __init__(self, x, y, width, height, angle, enabled=True, z=None):
|
def __init__(self, x, y, width, height, angle, enabled=True, z=None):
|
||||||
|
print("Tag(%.2f, %.2f, %.2f, %.2f, %.2f, %d, %s)" % (x, y, width, height, angle/math.pi, enabled, z))
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
|
self.z = z
|
||||||
self.width = math.fabs(width)
|
self.width = math.fabs(width)
|
||||||
self.height = math.fabs(height)
|
self.height = math.fabs(height)
|
||||||
self.actualHeight = self.height
|
self.actualHeight = self.height
|
||||||
|
@ -115,9 +120,6 @@ class Tag:
|
||||||
if z is not None:
|
if z is not None:
|
||||||
self.createSolidsAt(z)
|
self.createSolidsAt(z)
|
||||||
|
|
||||||
def toString(self):
|
|
||||||
return str((self.x, self.y, self.width, self.height, self.angle, self.enabled))
|
|
||||||
|
|
||||||
def originAt(self, z):
|
def originAt(self, z):
|
||||||
return FreeCAD.Vector(self.x, self.y, z)
|
return FreeCAD.Vector(self.x, self.y, z)
|
||||||
|
|
||||||
|
@ -135,27 +137,21 @@ class Tag:
|
||||||
height = self.height
|
height = self.height
|
||||||
if self.angle == 90 and height > 0:
|
if self.angle == 90 and height > 0:
|
||||||
self.solid = Part.makeCylinder(r1, height)
|
self.solid = Part.makeCylinder(r1, height)
|
||||||
self.core = self.solid.copy()
|
|
||||||
elif self.angle > 0.0 and height > 0.0:
|
elif self.angle > 0.0 and height > 0.0:
|
||||||
tangens = math.tan(math.radians(self.angle))
|
tangens = math.tan(math.radians(self.angle))
|
||||||
dr = height / tangens
|
dr = height / tangens
|
||||||
if dr < r1:
|
if dr < r1:
|
||||||
r2 = r1 - dr
|
r2 = r1 - dr
|
||||||
self.core = Part.makeCylinder(r2, height)
|
|
||||||
else:
|
else:
|
||||||
r2 = 0
|
r2 = 0
|
||||||
height = r1 * tangens
|
height = r1 * tangens
|
||||||
self.core = None
|
|
||||||
self.actualHeight = height
|
self.actualHeight = height
|
||||||
self.r2 = r2
|
self.r2 = r2
|
||||||
self.solid = Part.makeCone(r1, r2, height)
|
self.solid = Part.makeCone(r1, r2, height)
|
||||||
else:
|
else:
|
||||||
# degenerated case - no tag
|
# degenerated case - no tag
|
||||||
self.solid = Part.makeSphere(r1 / 10000)
|
self.solid = Part.makeSphere(r1 / 10000)
|
||||||
self.core = None
|
|
||||||
self.solid.translate(self.originAt(z))
|
self.solid.translate(self.originAt(z))
|
||||||
if self.core:
|
|
||||||
self.core.translate(self.originAt(z))
|
|
||||||
|
|
||||||
def filterIntersections(self, pts, face):
|
def filterIntersections(self, pts, face):
|
||||||
if type(face.Surface) == Part.Cone or type(face.Surface) == Part.Cylinder:
|
if type(face.Surface) == Part.Cone or type(face.Surface) == Part.Cylinder:
|
||||||
|
@ -536,6 +532,8 @@ class ObjectDressup:
|
||||||
edge = None
|
edge = None
|
||||||
t = 0
|
t = 0
|
||||||
|
|
||||||
|
for cmd in commands:
|
||||||
|
print(cmd)
|
||||||
return Path.Path(commands)
|
return Path.Path(commands)
|
||||||
|
|
||||||
|
|
||||||
|
@ -549,6 +547,10 @@ class ObjectDressup:
|
||||||
if not obj.Base.Path.Commands:
|
if not obj.Base.Path.Commands:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if obj.Path:
|
||||||
|
for cmd in obj.Path.Commands:
|
||||||
|
print(cmd)
|
||||||
|
|
||||||
pathData = self.setup(obj)
|
pathData = self.setup(obj)
|
||||||
if not pathData:
|
if not pathData:
|
||||||
print("execute - no pathData")
|
print("execute - no pathData")
|
||||||
|
@ -572,6 +574,7 @@ class ObjectDressup:
|
||||||
|
|
||||||
print("execute - %d tags" % (len(tags)))
|
print("execute - %d tags" % (len(tags)))
|
||||||
tags = pathData.sortedTags(tags)
|
tags = pathData.sortedTags(tags)
|
||||||
|
self.setTags(obj, tags, False)
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
tag.createSolidsAt(pathData.minZ)
|
tag.createSolidsAt(pathData.minZ)
|
||||||
|
|
||||||
|
@ -591,8 +594,12 @@ class ObjectDressup:
|
||||||
|
|
||||||
obj.Path = self.createPath(pathData.edges, tags)
|
obj.Path = self.createPath(pathData.edges, tags)
|
||||||
|
|
||||||
def setTags(self, obj, tags):
|
def setTags(self, obj, tags, update = True):
|
||||||
|
print("setTags(.....)")
|
||||||
|
for t in tags:
|
||||||
|
print(" .... %s" % t.toString())
|
||||||
obj.Tags = [tag.toString() for tag in tags]
|
obj.Tags = [tag.toString() for tag in tags]
|
||||||
|
if update:
|
||||||
self.execute(obj)
|
self.execute(obj)
|
||||||
|
|
||||||
def getTags(self, obj):
|
def getTags(self, obj):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user