1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-07-25 09:51:15 +02:00

Restored explode lines to yellow.

Now keeps track of STL bounds and uses them to force a large assembly view when large.
This commit is contained in:
Chris Palmer
2019-06-11 12:38:00 +01:00
parent 00c6914e23
commit 85e1985f1a
17 changed files with 70 additions and 31 deletions

View File

@@ -85,6 +85,8 @@ class STL:
sys.exit(1)
def write(self, fname):
mins = [float('inf'), float('inf'), float('inf')]
maxs = [float('-inf'), float('-inf'), float('-inf')]
with open(fname,"wt") as f:
print('solid OpenSCAD_Model', file=f)
for facet in self.facets:
@@ -92,13 +94,18 @@ class STL:
print(' outer loop', file=f)
for vertex in facet.vertices:
print(' vertex %s %s %s' % (vertex.x, vertex.y, vertex.z), file=f)
for i in range(3):
ordinate = vertex.key[i]
if ordinate > maxs[i]: maxs[i] = ordinate
if ordinate < mins[i]: mins[i] = ordinate
print(' endloop', file=f)
print(' endfacet', file=f)
print('endsolid OpenSCAD_Model', file=f)
return mins, maxs
def canonicalise(fname):
stl = STL(fname)
stl.write(fname)
return stl.write(fname)
if __name__ == '__main__':
if len(sys.argv) == 2: