MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / createMesh

Method createMesh

src/Face.cc:178–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178v8::Local<v8::Object> Face::createMesh(double factor, double angle, bool qualityNormals)
179{
180 Nan::EscapableHandleScope scope;
181 const unsigned argc = 0;
182 v8::Local<v8::Value> argv[1] = { };
183
184 v8::Local<v8::Object> theMesh = makeInstance(Mesh::_template);
185
186 Mesh *mesh = Mesh::Unwrap<Mesh>(theMesh);
187
188 const TopoDS_Shape& shape = this->shape();
189
190 try {
191
192 TopLoc_Location loc;
193 occHandle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(this->face(), loc);
194 if (triangulation.IsNull()) {
195 BRepMesh_IncrementalMesh MSH(shape,factor,Standard_True,angle,Standard_True);
196 }
197
198
199 // this code assume that the triangulation has been created
200 // on the parent object
201 mesh->extractFaceMesh(this->face(), qualityNormals);
202 mesh->optimize();
203
204 } CATCH_AND_RETHROW_NO_RETURN("Failed to mesh solid ");
205 return scope.Escape(theMesh);
206}
207
208
209void Face::InitNew(_NAN_METHOD_ARGS)

Callers 6

shape.jsFile · 0.45
test_meshSolid.jsFile · 0.45
test_withFunction · 0.45
NAN_PROPERTY_GETTERFunction · 0.45
NAN_METHODFunction · 0.45

Calls 3

makeInstanceFunction · 0.85
extractFaceMeshMethod · 0.80
optimizeMethod · 0.80

Tested by

no test coverage detected