I have a Mesh[ ]
object that I want to save as an obj file, as shown in the API FileObj.Write Method (String, Mesh[], FileObjWriteOptions)
However in the python docs I can’t find this. There is one FileObj
→ Write
option, which is a different writer FileObj.Write Method (StreamWriter, RhinoDoc, FileObjWriteOptions)
I don’t want to save the entire doc. Am I missing something obvious?
p.s. I am really only able to find python docs in the python editor, so if there is a better place please let me know.
dale
(Dale Fugier)
2
Best to use the RhinoCommon API.
import Rhino
import System
def test_write_obj():
plane = Rhino.Geometry.Plane.WorldXY
radius = 5.0
sphere = Rhino.Geometry.Sphere(plane, radius)
mesh = Rhino.Geometry.Mesh.CreateQuadSphere(sphere, 3)
arr = System.Array[Rhino.Geometry.Mesh]([mesh])
path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop)
filename = System.IO.Path.Combine(path, 'test_write_obj.obj');
fwo = Rhino.FileIO.FileWriteOptions()
options = Rhino.FileIO.FileObjWriteOptions(fwo)
rc = Rhino.FileIO.FileObj.Write(filename, arr, options)
if __name__ == "__main__":
test_write_obj()
– Dale
Hi Dale,
This is what I was trying to say, the python API doesn’t seem to have that overload. I get the same error with your code:
dale
(Dale Fugier)
4
Hi @umcadop,
The API I referenced is for Rhino 7. What version of Rhino do you have?
– Dale
Ah, Rhino 6. So that overload was added in 7?
Well, sorry about that. Time to upgrade I guess.
I could delete this post, if you think.