MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / write_obj

Method write_obj

src/exterior-shell-extractor/main.py:889–903  ·  view source on GitHub ↗
(ofn, *, elem=None, item=None)

Source from the content-addressed store, hash-verified

887
888 @staticmethod
889 def write_obj(ofn, *, elem=None, item=None):
890 s = ifcopenshell.geom.settings(USE_WORLD_COORDS=True, WELD_VERTICES=False)
891 if item:
892 geom = item.Triangulate(s)
893 else:
894 geom = elem.geometry
895
896 vs_fs = geom.verts, geom.faces
897 vs, fs = map(lambda tup: numpy.array(tup).reshape((-1, 3)), vs_fs)
898
899 with open(ofn, "w") as obj:
900 for v in vs:
901 print('v', *v, file=obj)
902 for f in fs + 1:
903 print('f', *f, file=obj)
904
905 @utils.trace
906 def evaluate_st(self, data):

Callers 2

innerMethod · 0.95
evMethod · 0.95

Calls 3

printFunction · 0.85
openFunction · 0.50
TriangulateMethod · 0.45

Tested by

no test coverage detected