Code: Select all
import sys, Mesh, string, json,os
from FreeCAD import Base
filename = sys.argv[2]
name_arr = filename.split('.')
mesh = Mesh.Mesh(filename)
obj["area"] = mesh.Area
obj["volume"] = mesh.Volume
But now I want to use occ , and the c++ code is bellow:
Code: Select all
int main(int argc, char *argv[]){
if(argc <= 1){
std::cout<<"occstl wrong arguments count!"<<std::endl;
return -1;
}
Standard_CString aFileName = argv[1];
TopoDS_Shape shape;
StlAPI_Reader reader;
reader.Read(shape,aFileName);
GProp_GProps system;
BRepGProp::VolumeProperties(shape, system);
Standard_Real volume = system.Mass();
std::cout<<"volume:"<<std::to_string(volume)<<std::endl;
BRepGProp::SurfaceProperties(shape, system);
Standard_Real area = system.Mass();
std::cout<<"Area:"<<std::to_string(area)<<std::endl;
}
Forgive me but I don't use c++ very well , can anyone explain why the difference of speed is so big?