MoI discussion forum
MoI discussion forum

Full Version: exporting points

From: probotix
30 Dec 2019   [#1]
I want to write a script that would allow me to export all of the X/Y/Z coordinates of points and control handles on a curve. Would this be easy to do with the Javascript API?
From: Michael Gibson
30 Dec 2019   [#2] In reply to [#1]
Hi probotix, it's not really simple to do that currently because the API does not currently expose the control points to script. But it is possible to do it in a kind of round about fashion by using clipboard copy/paste functionality since it is built in to the clipboard copy function that if points are turned on and all selected it will convert them into point objects in the clipboard.

There is a command here that does it that way:
http://moi3d.com/forum/index.php?webtag=MOI&msg=9614.5

Also check out the SavePointFile script here:
http://kyticka.webzdarma.cz/3d/moi/#SavePointFile

Get the version of SavePointFile that works also with Mac OSX that is linked there, that's the one that uses the cross platform file handling which will work with v3 or v4. The original version of SavePointFile that uses an ActiveX object only works with MoI v2 I think.

One other thing to note is that the shape of a NURBS curve is not only defined by control point locations alone as a Bezier curve is. NURBS curves also have additional properties like a "knot vector", degree value, and weight values that also define the curve. When you draw a control point curve these additional properties are not used, so for that case just the control points do actually define the curve but if you obtain the curve through some other means like if it's a conic section then that is not the case anymore.

- Michael
From: probotix
2 Jan 2020   [#3] In reply to [#2]
Thanks Michael, I'll check those out. I'd be happy right now if I even had to limit any curved portions to semi-circles in my drawings.

What I ultimately want to do is draw 3 dimensional curves that I convert to g-code to control a machine - a sort of different approach to CAM where I have control over all of the tool paths exactly, rather than having them generated algorithmic-ally like current CAM programs do. Right now I hand code most of my production parts because I need total tool path control. But the drawing tools in Moi3D are freaking awesome, better than CorelDraw even, and I'd like to be able to harness that.