MoI discussion forum
MoI discussion forum

Full Version: Export nurbs curve details

From: miquik
10 Sep 2021   [#1]
Hi all,

I check javascript API and it seems there is only a generic Curve object that represent every curve?
Is it possible to obtain nurbs representation (control points, degree, knot vector) of a curve in geometrydatabase?

Thanks
From: Michael Gibson
10 Sep 2021   [#2] In reply to [#1]
Hi miquik ,

re:
> Is it possible to obtain nurbs representation (control points, degree,
> knot vector) of a curve in geometrydatabase?

Sorry no that low level NURBS information is not currently set up to be accessed by script. What is it that you're trying to do that you need this level of data?

- Michael
From: miquik
10 Sep 2021   [#3] In reply to [#2]
Thanks Michael,
I am try to create a script to export geometry to SVG. I’m not really interested in nurbs informations, it will be suffice to have curve tessellation points
From: Michael Gibson
10 Sep 2021   [#4] In reply to [#3]
Hi miquik, there is an evaluator available to scripts, see the "scripting" section here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=8814.1

Or also you can use the factory for the "ArrayCurve" command to generate points at equal distances along a curve, see the ReconstructCurve command for an example:
http://kyticka.webzdarma.cz/3d/moi/#ReconstructCurve

There will likely be SVG support coming for MoI v5.

- Michael
From: miquik
13 Sep 2021   [#5] In reply to [#4]
Thanks Michael,
I would like to implement SVG export anyway now. I almost done, just one thing is missing: can I obtain viewport width/height? I need to create the projection matrix but these properties seem hidden.

Thanks
From: Michael Gibson
13 Sep 2021   [#6] In reply to [#5]
Hi miquik,

re:
> I would like to implement SVG export anyway now. I almost done, just one thing is missing: can
> I obtain viewport width/height? I need to create the projection matrix but these properties seem hidden.

There are .pixelWidth and .pixelHeight properties on a viewport object, so something like:
var width = moi.ui.mainWindow.viewpanel.getViewport('3D').pixelWidth;

- Michael