orbingol / rw3dm

Rhino/OpenNURBS importer and exporter for NURBS-Python (geomdl)
MIT License
32 stars 11 forks source link

json2on.exe and json file format #14

Closed rvallance closed 4 years ago

rvallance commented 4 years ago

It looks like the output from json2on.exe is wrong when you use the current json file format. The current json file format records the control points without multiplying coordinates by the weights. It seems that json2on.exe needs the control points with the weights applied. If you simply multiple the coordinates of the control points by the weight, then json2on.exe will produce the correct output.

To Reproduce

  1. Run the fiberInGroove.py script. This will output json file that should contain a cylindrical NURBS surface named fiberSurface.json.
  2. Run json2on.exe fiberSurface.json to produce fiberSurface.3dm
  3. Launch Rhino. Import fiberSurface.3dm and see that geometry is distorted because control points are not located correctly.
  4. Import fiberSurfaceMod3_Correct.json and see that it is semi-cylindrical surface. The control points in this .json file have been multiplied by the weights listed at the end of the .json file.

These screen snapshots illustrate the differences between the two json files. RhinoScreenSnapshots.zip

Maybe you want to think about adding a switch to the export json function that allows you to select which version of control points to export?

orbingol commented 4 years ago

Thanks @rvallance! It should be fixed in v2.1.2.