Fix testSTL
On branch cq1_pythonocc zmodyfikowany: cadquery/occ_impl/shapes.py Untracked files: cq.testbench.task no changes added to commit (use "git add" and/or "git commit -a")
This commit is contained in:
@ -88,6 +88,7 @@ from OCC.ShapeFix import ShapeFix_Wire, ShapeFix_Face
|
|||||||
|
|
||||||
from OCC.STEPControl import STEPControl_Writer, STEPControl_AsIs
|
from OCC.STEPControl import STEPControl_Writer, STEPControl_AsIs
|
||||||
|
|
||||||
|
from OCC.BRepMesh import BRepMesh_IncrementalMesh
|
||||||
from OCC.StlAPI import StlAPI_Writer
|
from OCC.StlAPI import StlAPI_Writer
|
||||||
|
|
||||||
from OCC.TopTools import TopTools_DataMapOfShapeListOfShape, TopTools_ListIteratorOfListOfShape
|
from OCC.TopTools import TopTools_DataMapOfShapeListOfShape, TopTools_ListIteratorOfListOfShape
|
||||||
@ -211,8 +212,11 @@ class Shape(object):
|
|||||||
#
|
#
|
||||||
def exportStl(self, fileName, precision = 1e-5):
|
def exportStl(self, fileName, precision = 1e-5):
|
||||||
|
|
||||||
|
|
||||||
|
mesh = BRepMesh_IncrementalMesh(self.wrapped,precision,True)
|
||||||
|
mesh.Perform()
|
||||||
|
|
||||||
writer = StlAPI_Writer()
|
writer = StlAPI_Writer()
|
||||||
writer.SetDeflection(precision)
|
|
||||||
|
|
||||||
return writer.Write(self.wrapped,fileName)
|
return writer.Write(self.wrapped,fileName)
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class TestExporters(BaseTest):
|
|||||||
exporters.exportShape(p,eType,s,0.1)
|
exporters.exportShape(p,eType,s,0.1)
|
||||||
|
|
||||||
result = s.getvalue()
|
result = s.getvalue()
|
||||||
#print result
|
|
||||||
for q in stringsToFind:
|
for q in stringsToFind:
|
||||||
self.assertTrue(result.find(q) > -1 )
|
self.assertTrue(result.find(q) > -1 )
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user