From: Karsten (KMRQUS) 10 Apr 2014  (1 of 5)
 Hello, I try to create a script for curvature-calculations (porcupine-analysis) based on the ReconstructCurve-script. So I try first to calculate the center of an arc given by a sequence of three points. The distance from the center to the 2nd point is the radius - the inverse is approx. curvature at this point. The csp function in the script should calculate the centerpoint laboriously (and not really tested). My problem is to get the components of the curvepoints - best case as an array of moi.vectorMath.createPoint-s. I tried a lot of things, but nothing works (I`m not a prorammer and especially not in java-script). The script is only a draft in try-and-error-spaghetti-java-sript and a lot of things have to do e.g. calculate the curvature representing line, change the layer for these, update, curvature of the start and endpoint???, ...,etc.. I hope someone will have a look on it and can explain me how to get access to the components of these curvepoints (if possible). thanks in advance! Karsten Attachments:

 From: Michael Gibson 10 Apr 2014  (2 of 5)
 6622.2 In reply to 6622.1 Hi Karsten, so it looks like you almost have it - to get the components of a point you should use the .x .y .z properties just like you are doing currently. I think the problem is on line 216, where you're trying to extract points from the result of the arraycurve: var nx=moi.vectorMath.createPoint(arrayed_pts.item(iPts).pt); The vectorMath.createPoint() function only expects to take 3 coordinates as its input - here it's being passed another point object instead of coordinates and so it's probably generating garbage out. Try doing this on this line instead: var nx=arrayed_pts.item(iPts).pt; Also it looks like a proper array point of points is being assembled in the "pts" array, so you could try using that instead of ptx. One of the things that's kind of confusing about these points is that there are 2 kinds of points being worked with here - one is a "point object" which is the type of thing that can be created in MoI under Draw curve > More > Point, and it can have all kinds of properties same as curves or solids like hidden, locked, name, style assignment, selection, etc... - then the second kind of point is a "point data structure" which is much more basic and only has .x .y .z properties and none of that other stuff with it. When you have a "point object" you can retreive the "data structure point" from it by the .pt property. Hope this helps! - Michael
 6622.4 In reply to 6622.3 Hi Karsten, yeah it looks like you're missing one thing on the array curve factory - you need to set the number of items for the factory to build. The ReconstructCurve command that you're based off does this in an "Update()" function, like this: Factories[i][0].setInput( 3, NumItems ); So before you call .calculate() on the arraycurve factory to generate the arrayed points, you need to set that input index 3 to have the number of points you want to generate, something like this (the >>>>>> <<<<< indicates the added line): code:``` var Factory = moi.command.createFactory( 'arraycurve' ); //arraycurve erzeugt ein array entlang einer Kurve - Eingabe ist in der naechsten ZEile der Startpunkt der Kurve Factory.setInput( 0, startPtObject ); // object (list) Factory.setInput( 1, originalCrv ); // path Factory.setInput( 2, 'NumItems' ); // array mode >>>>>> Factory.setInput( 3, 20 ); // Make 20 arrayed items <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Factories[i][0] = Factory; // in Factory sind die Punkte var arrayed_pts = Factories[i][0].calculate(); ``` Does that help? - Michael