Hi, I’m currently working at mesh exporting in Rhino6 by C++ and encountered same problem.
How to export a selected mesh as wavefront .obj file to target path?
Currently I’m using code below to import single OBJ file as mesh and export selected mesh as OBJ file.
Import OBJ
CString objFileName = thirdPartyWriteObj();
script.Format(L"_-Import \"%ls\" _Enter", static_cast<const wchar_t*>(objFileName ));
RhinoApp().RunScript(RhinoApp().ActiveDoc()->RuntimeSerialNumber(), static_cast<const wchar_t*>(script), 0);
RunScript() sometimes start excuting before thirdPartyWriteObj() finished, resulting in imported OBJ file errors.
- Is there any way to control the excuting sequence when there are RhinoScripts in code?
- is there any way to import OBJ files without using scripts?
Export selected mesh as OBJ
pMeshObj->Select(true, true, true);
ON_wString script2 = L"_-Export testExport.obj";
RhinoApp().RunScript(RhinoApp().ActiveDoc()->RuntimeSerialNumber(), static_cast<const wchar_t*>(script2), 0);
By script2, I can only export pMeshObj at Desktop with selecting exporting parameters manually in command line.
- How to export file without command line parameter selection?
- How to export file to target path?
- Is there any way to export a simplest OBJ file? (Say, only vertex coordinates and face connectivitys without normals and uvs). If not, how to access mesh data to implement a custom WriteOBJ method?