592 | | from OCC.Utils.DataExchange.STL import STLExporter |
593 | | from OCC.BRepPrimAPI import * |
594 | | my_sphere_shape = BRepPrimAPI_MakeSphere(1).Shape() # Izdelava krogle |
595 | | my_stl_exporter = STLExporter("krogla.stl", ASCIIMode=False) |
596 | | my_stl_exporter.set_shape(my_sphere_shape) |
597 | | my_stl_exporter.write_file() |
598 | | }}} |
599 | | Da bi ta primer deloval je potrebno popraviti datoteko |
600 | | "C:\Python26\lib\site-packages\OCC\Utils\DataExchange\STL.py" tako, |
601 | | da v SLTExporter-ju komentiramo nastavitev imena datoteke na |
602 | | {{{ |
603 | | #!python |
604 | | def set_filename(self, filename): |
605 | | # if not os.path.isfile(filename): |
606 | | # print "STLImporter initialization Error: file %s not found."%filename |
607 | | # self._filename = None |
608 | | # else: |
609 | | self._filename = filename |
610 | | }}} |
611 | | |
| 592 | from OCC.StlAPI import * |
| 593 | from OCC.BRepPrimAPI import * |
| 594 | my_sphere_shape = BRepPrimAPI_MakeSphere(1).Shape() |
| 595 | stl_writer = StlAPI() |
| 596 | stl_writer.Write(my_sphere_shape, "krogla.stl", False) |
| 597 | }}} |