in a rhino script, I do batch export of objects into obj files.
Some geometries are over simplified.
Left shows object in Rhino, Right is exported OBJ file :
I saw that there are several export options (detailed and advanced) for OBJ format.
Should I change some of them to get same geometries in exported files ?
Can you post parts of your mesh ? If it is not a mesh but a nurbs object, please show the mesh settings you use.
If your object is in meters, seeing the coordinate it seems either very large or very far from the origin. What happens if you move it closer to the orgin and then export ?
btw. 15 seems to be the maximum digits i can export.
the obj export settings usually pop up if you export manually. In case of a nurbs object, there are options to define the mesh density settings. If you export your obj geometry via a batch export script, you might control them from there as well. Lets first check the data itself.
you were right : It seems that the problem is related my coordinates ranges. If I move the model to 0,0 in X,Y, it works fine.
In a post processing chain, this is what I do ( I recenter each output model, creating a 3D GIS point file allowing to place model in the final 3D scene).
Now, I have to figure out how to - in the script - recenter each model before saving - and writing out a text file (for example) allowing to place them afterward.
Hi Fred, ok. I guess you can just select the objects, find their boundingbox and use the bottom center of that box as first point. Then use rs.MoveObjects to move them to the World origin. below is an example script.
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def MoveToOrigin():
# select surfaces, polysurfaces and meshes
obj_ids = rs.ObjectsByType(8+16+32, True, 1)
if not obj_ids: return
# get their bounding box
bb = rs.BoundingBox(obj_ids, None, True)
# get boundingbox center at bottom face
center = Rhino.Geometry.Point3d.Unset
center.Interpolate(bb[0], bb[2], 0.5)
# move from center to origin
translation = Rhino.Geometry.Plane.WorldXY.Origin - center
rs.MoveObjects(obj_ids, translation)
# do the export
if __name__=="__main__":
MoveToOrigin()
you can try this by pasting in the python script editor. (_EditPythonScript)