Parametric modeling (Closed linear curves for start)
Plugins linking to this thread: (hide)
ICE Curve Creation
Pedro Cabrera a.k.a. Pedrito shares this plugin that allows the dynamic creation of
curve objects using ICE. Unlike point cloud and polygon mesh creation, curve creation
isn't supported natively by ICE.
The author works around this by using a vbs scripted operator that reads data written
by an ICE tree further down the operator stack.
From here: [..] it allows linear and cubic curves, open and closed, and also subcurves, so »create curves from strands« for example is as easy as plug a »build array from set« of the strandpositions, and a »build array from set« of the strand count [..] These compounds are also provided: PC_Archimedean Spirals: different types of spirals PC_Curve By Nulls: uses a group of transforms to create a curve PC_Loxodrome: creates a loxodrome spiral with parameters PC_Spiral Points: very basic Spiral
local backup:PC_IceCv.xsiaddon PC_ICeCV_sample.scn (sample scene)
From here: [..] it allows linear and cubic curves, open and closed, and also subcurves, so »create curves from strands« for example is as easy as plug a »build array from set« of the strandpositions, and a »build array from set« of the strand count [..] These compounds are also provided: PC_Archimedean Spirals: different types of spirals PC_Curve By Nulls: uses a group of transforms to create a curve PC_Loxodrome: creates a loxodrome spiral with parameters PC_Spiral Points: very basic Spiral
local backup:PC_IceCv.xsiaddon PC_ICeCV_sample.scn (sample scene)

 Posts: 358
 Joined: 28 Sep 2011, 10:33
Re: Parametric modeling (Closed linear curves for start)
JScript is good enough, I’ve been writing Js for years, but it gets messy with large codes. Not as bad as VBS but not as flexible as Python.
Now about renaming. In my example I’m creating a curve with CreateCurve, but it should work with SICreateCurve too.
crv = CreateCurve( 1, 0, positions, false)('Value')
Most SI commands return a collection object and the first object of that collection is usually the created object, so you can call it with (0).
This first value is also called “value” so you can call it by its name too like I’m doing it in that code (“value”).
I’m using a single line but probably in 2 lines is easier to understand :
crvResultCollection = CreateCurve( 1, 0, positions, false)
crv = crvResultCollection(0)
So since we are getting the new curve as an object with this crv variable, then you can rename it like this:
crv.Name = “NewCurveName”
And of course, verify it with:
LogMessage ( crv )
This crv is the curve object, just like if you were getting it with Selection(0)
Or you can just reuse this variable as the name of your object in the next commands like ray was saying. I kinda misunderstood your question and wrote a long explanation.
In SI if you use an object variable in a command, th command will automatically use this object’s FullName, just be aware that this object isn’t really a string. Well, in Jscript you won’t notice the difference but in python you can’t concatenate an object with a string so you’ll have to use .FullName or str() to “convert” this object to string.
About the ruler, Cesar’s CSruler works pretty well, have you tried it ?
Now about renaming. In my example I’m creating a curve with CreateCurve, but it should work with SICreateCurve too.
crv = CreateCurve( 1, 0, positions, false)('Value')
Most SI commands return a collection object and the first object of that collection is usually the created object, so you can call it with (0).
This first value is also called “value” so you can call it by its name too like I’m doing it in that code (“value”).
I’m using a single line but probably in 2 lines is easier to understand :
crvResultCollection = CreateCurve( 1, 0, positions, false)
crv = crvResultCollection(0)
So since we are getting the new curve as an object with this crv variable, then you can rename it like this:
crv.Name = “NewCurveName”
And of course, verify it with:
LogMessage ( crv )
This crv is the curve object, just like if you were getting it with Selection(0)
Or you can just reuse this variable as the name of your object in the next commands like ray was saying. I kinda misunderstood your question and wrote a long explanation.
In SI if you use an object variable in a command, th command will automatically use this object’s FullName, just be aware that this object isn’t really a string. Well, in Jscript you won’t notice the difference but in python you can’t concatenate an object with a string so you’ll have to use .FullName or str() to “convert” this object to string.
About the ruler, Cesar’s CSruler works pretty well, have you tried it ?
M.Yara
Character Modeler  Softimage Generalist (sort of)
Character Modeler  Softimage Generalist (sort of)

 Posts: 398
 Joined: 12 Mar 2013, 18:44
Re: Parametric modeling (Closed linear curves for start)
Thanks both rray and myara for solving the nameconflict prob! fixed previus posts
The CS Ruler is definatelly great measuurning tool i might used in the past not sure xd.
But i think im suggesting something beyond a measuring tool.
Example:
Lets say that i want to set that distance to 7 so the cube is automatically scaled accordingly.
Iv tried to unlock the parameter but it wont allow me. My suggestion is a ruler that is also a parametric tool that lets you rescale 2 in 1.
The CS Ruler is definatelly great measuurning tool i might used in the past not sure xd.
But i think im suggesting something beyond a measuring tool.
Example:
Lets say that i want to set that distance to 7 so the cube is automatically scaled accordingly.
Iv tried to unlock the parameter but it wont allow me. My suggestion is a ruler that is also a parametric tool that lets you rescale 2 in 1.
Last edited by mc_axe on 07 Jan 2018, 19:53, edited 1 time in total.

 Posts: 398
 Joined: 12 Mar 2013, 18:44
Re: Parametric modeling (Closed linear curves for start)
Well it came to my mind now that i could simply divide 7/curent lenght of the ruler, to get the new scaling for the cube that will result to a new mesurment of 7 it worked actually.

 Posts: 828
 Joined: 18 Mar 2010, 23:38
 Location: St. Thomas, Ontario
Re: Parametric modeling (Closed linear curves for start)
Here is how I do these parametric curve and surfaces in JS. Extracted from the parametric formula plugin available in the softimage resources.
Note: a line is of degree 0, KN = knot, CP = Control Points
In the code, I create an empty array and then push the points parameters in the array. I then use the array as input to the curve or nubs surface.
http://softimage.wiki.softimage.com/xsi ... inuity.htm
Code: Select all
// Initialize the u and v Knot arrays
var uKN = [];
var vKN = [];
// Calculate number of knots needed for parameterization
var nbUKN = nbUCP + u_Degree  1 ;
var nbVKN = nbVCP + v_Degree  1 ;
var uKN_Start = u_Degree  1 ;
var vKN_Start = v_Degree  1 ;
var uKN_End = nbUCP  1 ;
var vKN_End = nbVCP  1 ;
// Populate the knot arrays in u and v
for ( i=1; i<= u_Degree; i++) {uKN.push(uKN_Start);} // Start knot with multiplicity equal to the order
for ( i=uKN_Start+1; i<= uKN_End  1; i++) { uKN.push(i);}
for ( i=1; i<= u_Degree; i++) {uKN.push(uKN_End);} // End knot with multiplicity equal to the order
for ( i=1; i<= v_Degree; i++) {vKN.push(vKN_Start);}
for ( i=vKN_Start+1; i<= vKN_End  1; i++) { vKN.push(i);}
for ( i=1; i<= v_Degree; i++) {vKN.push(vKN_End);}
// curve parameterization option
if (PPG.u_Parameter.Value == 0) {u_Param = "siUniformParameterization";}
else if (PPG.u_Parameter.Value == 2) {u_Param = "siChordLengthParameterization";}
else if (PPG.u_Parameter.Value == 3) {u_Param = "siCentripedalParameterization";}
else {u_Param = "siNonUniformParameterization";}
if (PPG.v_Parameter.Value == 0) {v_Param = "siUniformParameterization";}
else if (PPG.v_Parameter.Value == 2) {v_Param = "siChordLengthParameterization";}
else if (PPG.v_Parameter.Value == 3) {v_Param = "siCentripedalParameterization";}
else {v_Param = "siNonUniformParameterization";}
// Create nurbs surface
var ns = oRoot.AddNurbsSurfaceMesh2(
Count, aControlPoints, [nbUCP], [nbVCP],
uKN, [nbUKN], vKN, [nbVKN],
[u_Degree],[v_Degree],
[u_Closed],[v_Closed],
[u_Param],[v_Param],
siSINurbs, Name
) ;
In the code, I create an empty array and then push the points parameters in the array. I then use the array as input to the curve or nubs surface.
http://softimage.wiki.softimage.com/xsi ... inuity.htm
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif

 Posts: 358
 Joined: 28 Sep 2011, 10:33
Re: Parametric modeling (Closed linear curves for start)
It seems like you only pasted one half of the code.
M.Yara
Character Modeler  Softimage Generalist (sort of)
Character Modeler  Softimage Generalist (sort of)

 Posts: 828
 Joined: 18 Mar 2010, 23:38
 Location: St. Thomas, Ontario
Re: Parametric modeling (Closed linear curves for start)
@Myara
I only pasted a portion of the code is correct as the entire plugin is over 600 lines of codes. For that just download the plugin from the Softimage Resources area (search for "parametric formula") and unzip the plugin to a file. The entire code is JScript and include over 100 preset shapes.
I only pasted a portion of the code is correct as the entire plugin is over 600 lines of codes. For that just download the plugin from the Softimage Resources area (search for "parametric formula") and unzip the plugin to a file. The entire code is JScript and include over 100 preset shapes.
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif

 Posts: 398
 Joined: 12 Mar 2013, 18:44
Re: Parametric modeling (Closed linear curves for start)
Thanx Daniel gr8 contribution to the thread! For a momment i was thinking that i might be the only one not understanding why that code is not working right away
100 shapes sound alot! Is there any shapes that we dont have access through UI?
100 shapes sound alot! Is there any shapes that we dont have access through UI?

 Posts: 398
 Joined: 12 Mar 2013, 18:44
Re: Parametric modeling (Closed linear curves for start)
Onwards with simple shapes in JScript
Shapes like regular triangle, square, pentagon, hexagon etc fall in that category of Regullar Convex Polygons, we can simply call them nGon (n= any value):
The Parametric n Gon challenge!
In the link you can see a little information about the shape components
Now for a simple script that produces a nGon (Linear curve) will need a given 'radius' and 'n'
Then we can solve the possitions of the points within a for loop, with help from sin and cos
We also want a function that will help so we dont have trouble with radians and angles.
A better version of that script could be one that logs more info:
For a real parametric challenge we should have the ability to define the shape with more than 1 cases of given parameters. We need at least one type indicator that will result to spcific 'n' and one size indicator that will result to a certain 'radius', if we have 5x5 parameters, we should normaly solve the problem 25 times! To overcome this problem with my nub scripting skillz as iI said earlir I came up with a loop that calls find_parameter() functions till problem is solved. The find functions would return same value if already defined or would try to solve the undefined variables with help from something else that is potentially defined. So i had to write a bounch of relationships for each parameter. And it worked with maximum 5 loops it solved all other variables.But i will present a better case of what i did:
Next script generates an nGon with more than 25 combos of given values. If the n gon is REGGULAR you get a notification in LOG
Certain values (on type parameters) will result to a 'n' that corespond to no case of regular polygon then youll get an IRREGULAR notification and the result will have at least one irregular component.
For the following script i will credit my friend Spasi for converting my horible non optimized code to something that i barelly understand xD.
Shapes like regular triangle, square, pentagon, hexagon etc fall in that category of Regullar Convex Polygons, we can simply call them nGon (n= any value):
The Parametric n Gon challenge!
In the link you can see a little information about the shape components
Now for a simple script that produces a nGon (Linear curve) will need a given 'radius' and 'n'
Then we can solve the possitions of the points within a for loop, with help from sin and cos
We also want a function that will help so we dont have trouble with radians and angles.
Code: Select all
var n = 500;
var radius = 6;
var angle = 360 / n;
function toRadians (angle) {
return angle * (Math.PI / 180);
}
var pointslist="";
for(i = 0; i <= n1; i++) {
pointslist+="("+radius*Math.cos(toRadians(angle * i))+","+radius * Math.sin(toRadians(angle * i))+",0),";
}
pointslist=pointslist.slice(0,1);
crv=SICreateCurve("nGon", 1, 1);
SISetCurvePoints( crv, pointslist, false );
ApplyTopoOp("CrvOpenClose", crv, i, siPersistentOperation, null);
Code: Select all
//LINEAR CURVES REGULAR CONVEX POLYGON or NGON (Definition with 'n' and 'radius')
var n = 7; //'N' of the NGon
var radius = 6; //RADIUS or Circumradius
//calcs
function toRadians (angle) { //receives angles returns radians
return angle * (Math.PI / 180);
}
var angle = 360 / n; //MAIN ANGLE or vertex (or apex for each isosceles Triangle )
var innerAngle=180(360/n); //INTERNAL angle
var extAngle=180innerAngle; //SUPPLEMENTARY angle or exterior
var hIA=innerAngle/2; //BASE ANGLE there are 2 equals in each isosceles triangle
var dCount=(n*(n3))/2; //Possible diagonals counter
var tanDist =Math.sin(toRadians(hIA))*radius; //INRADIUS the tangent Distance from a side to the center
var sideL=2*Math.sqrt(Math.pow(radius,2)Math.pow(tanDist,2));//SIDE LENGTH
var areaIso=tanDist*sideL/2; //AREA of each isosceles TRIANGLE
var area=areaIso*n; //TOTAL AREA OF NGON
var pointslist="";
for(i = 0; i <= n1; i++) {
pointslist+="("+radius*Math.cos(toRadians(angle * i))+","+radius * Math.sin(toRadians(angle * i))+",0),";
}
pointslist=pointslist.slice(0,1);
crv=SICreateCurve("nGon", 1, 1);
SISetCurvePoints( crv, pointslist, false );
ApplyTopoOp("CrvOpenClose", crv, i, siPersistentOperation, null);
SelectObj(crv, null, true);
LogMessage(
"Succesfully generated nGon with n = "+n+
"\nCircumRadius :"+radius+
"\n\nInradius: "+tanDist+
"\nMain Angle (360°/n): "+angle+
"°\nInterior Angle: "+innerAngle+
"°\nSupplementary Angle: "+extAngle+
"°\nPossible diagonals: "+dCount+
"\nSide Lenght: "+sideL+
"\nArea of each isosceles triangle: "+areaIso+
"\nArea of nGon: "+area
);
Next script generates an nGon with more than 25 combos of given values. If the n gon is REGGULAR you get a notification in LOG
Certain values (on type parameters) will result to a 'n' that corespond to no case of regular polygon then youll get an IRREGULAR notification and the result will have at least one irregular component.
For the following script i will credit my friend Spasi for converting my horible non optimized code to something that i barelly understand xD.
Code: Select all
//LINEAR CURVES REGULAR CONVEX POLYGON or NGON (Parametric)
//Regullar Convex Polygon or NGon
//Define it by at list 2 parameters that indicate type and size .
//Type indicators
var n;
var angle=10;
var innerAngle;
var extAngle;
var hIA;
//Size indicators
var radius;
var area;
var tanDist;
var sideL;
var areaIso=45;
//DEBUG
var dCount;//todo add relationship that results to a 'n'
function toRadians(angle) {
return angle * (Math.PI / 180);
}
function property(initValue, calc) {
var value = initValue;
var inCalc = false;
return function() {
if (value !== undefined) {
return value;
}
if (!inCalc) {
inCalc = true;
try {
value = calc.call(this);
} finally {
inCalc = false;
}
}
return value;
}
}
polygon = (function() {
function isRegular() {
var n = this.n();
return (n  0) === n;
}
return {
isValid: function() {
// TODO: validate input
return this.n() !== undefined && this.angle() !== undefined && this.radius() !== undefined;
},
n: property(n, function() {
var angle = this.angle();
if (angle !== undefined) {
return 360.0 / angle;
}
return undefined;
}),
angle: property(angle, function() {
var n = this.n();
if (n !== undefined) {
return 360 / n;
}
var hIA = this.hIA();
if (hIA !== undefined) {
return 180  2 * hIA;
}
return undefined;
}),
hIA: property(hIA, function() {
var innerAngle = this.innerAngle();
if (innerAngle !== undefined) {
return innerAngle * 0.5;
}
return undefined;
}),
innerAngle: property(innerAngle, function() {
var n = this.n();
if (n !== undefined) {
return 180  (360 / n);
}
var extAngle = this.extAngle();
if (extAngle !== undefined) {
return 180  extAngle;
}
return undefined;
}),
extAngle: property(extAngle, function() {
var innerAngle = this.innerAngle();
if (innerAngle !== undefined) {
return 180  innerAngle;
}
return undefined;
}),
radius: property(radius, function() {
var sideL = this.sideL();
var angle = this.angle();
if (sideL !== undefined && angle !== undefined) {
return (sideL * 0.5) / Math.sin(toRadians(angle * 0.5));
}
return undefined;
}),
sideL: property(sideL, function() {
var radius = this.radius();
var angle = this.angle();
if (radius !== undefined && angle !== undefined) {
return 2 * Math.sin(toRadians(angle * 0.5)) * radius
}
var tanDist = this.tanDist();
if (tanDist !== undefined && angle !== undefined) {
return 2 * tanDist * Math.tan(toRadians(angle * 0.5));
}
if (radius !== undefined && tanDist !== undefined) {
return 2 * Math.sqrt(Math.pow(radius, 2)  Math.pow(tanDist, 2));
}
return undefined;
}),
tanDist: property(tanDist, function() {
var sideL = this.sideL();
var angle = this.angle();
if (sideL !== undefined) {
return sideL / (2 * Math.tan(toRadians(angle * 0.5)));
}
var areaIso = this.areaIso();
if (areaIso !== undefined && angle !== undefined) {
return Math.sqrt(areaIso / Math.tan(toRadians(angle * 0.5)));
}
return undefined;
}),
areaIso: property(areaIso, function() {
var area = this.area();
var n = this.n();
if (area !== undefined && n !== undefined) {
return area / n;
}
var tanDist = this.tanDist();
var sideL = this.sideL();
if (tanDist !== undefined && sideL !== undefined) {
return (tanDist * sideL) * 0.5;
}
return undefined;
}),
area: property(area, function() {
var n = this.n();
var areaIso = this.areaIso();
if (n !== undefined && areaIso !== undefined) {
return n * areaIso;
}
return undefined;
}),
dCount: property(dCount, function() {
var n = this.n();
if (n !== undefined) {
return (n * (n  3)) * 0.5;
}
return undefined;
}),
render: function() {
LogMessage(
"\nn: " + this.n() + (isRegular.call(this) ? " REGULAR" : " IRREGULAR ") +
"\nCircumRadius: " + this.radius() +
"\nInRadius: " + this.tanDist() +
"\nSide Length: " + this.sideL() +
"\n\nMain Angle (360°/n): " + this.angle() + "°" +
"\nInterior Angle: " + this.innerAngle() +
"\nIntAngle/2 " + this.hIA() + "°" +
"\nExt_Angle: " + this.extAngle() +
"\n\nArea of each isosceles triangle: " + this.areaIso() +
"\nArea of nGon: " + this.area() +
"\nPossible diagonals: " + this.dCount()
);
var n = this.n();
var angle = this.angle();
var radius = this.radius();
var pointsList = "";
for (i = 0; i <= n  1; i++) {
pointsList += "(" + radius * Math.cos(toRadians(angle * i)) + "," + radius * Math.sin(toRadians(angle * i)) + ",0),";
}
pointsList = pointsList.slice(0, 1);
return pointsList;
}
};
})();
if (polygon.isValid()) {
var pointsList = polygon.render();
//*
crv=SICreateCurve("nGon", 1, 1);
SISetCurvePoints(crv, pointsList, false);
ApplyTopoOp("CrvOpenClose", crv, i, siPersistentOperation, null);
SelectObj(crv, null, true);
//*/
}

 Posts: 358
 Joined: 28 Sep 2011, 10:33
Re: Parametric modeling (Closed linear curves for start)
Oh, now I see what you were trying to do.
There is an addon called keyvis Curve Tools, it's been written in JScript and it's nGon plugin does exactly that:
http://www.keyvis.at/cgtools/toolsfor ... rvetools/
And although converting degrees to radians is something very simple, you have a couple of XSI tools:
XSIMath.DegreesToRadians()
XSIMath.RadiansToDegrees()
There is an addon called keyvis Curve Tools, it's been written in JScript and it's nGon plugin does exactly that:
http://www.keyvis.at/cgtools/toolsfor ... rvetools/
And although converting degrees to radians is something very simple, you have a couple of XSI tools:
XSIMath.DegreesToRadians()
XSIMath.RadiansToDegrees()
M.Yara
Character Modeler  Softimage Generalist (sort of)
Character Modeler  Softimage Generalist (sort of)

 Posts: 828
 Joined: 18 Mar 2010, 23:38
 Location: St. Thomas, Ontario
Re: Parametric modeling (Closed linear curves for start)
@MC_Axe
Is there any shapes that we don't have access through UI?
Not really. Providing you don't exceed the number of variables provided in the UI. Their is a way to go around it by entering values directly in the formula.
There is a limitation to the code as it is not a formula parser so it will not handle strange formulas. The code has very limited error detection so it will crash Softimage if the formula solver goes to infinity/division by zero or looping funny. The code is open so anybody can modify it to their needs. I left it open so that anybody with better coding skill can modify it and make it more robust. In the spirit of sharing, I would appreciated any improvement to the code be shared as well with the community.
The code create nurbs surface (i.e. it fold a nurbs plane into all kind of shape). You can convert the nurbs shape to polygons after if you need it.
Is there any shapes that we don't have access through UI?
Not really. Providing you don't exceed the number of variables provided in the UI. Their is a way to go around it by entering values directly in the formula.
There is a limitation to the code as it is not a formula parser so it will not handle strange formulas. The code has very limited error detection so it will crash Softimage if the formula solver goes to infinity/division by zero or looping funny. The code is open so anybody can modify it to their needs. I left it open so that anybody with better coding skill can modify it and make it more robust. In the spirit of sharing, I would appreciated any improvement to the code be shared as well with the community.
The code create nurbs surface (i.e. it fold a nurbs plane into all kind of shape). You can convert the nurbs shape to polygons after if you need it.
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif

 Posts: 828
 Joined: 18 Mar 2010, 23:38
 Location: St. Thomas, Ontario
Re: Parametric modeling (Closed linear curves for start)
The NGon challenge is a good start to understand all kind of formula variation. The points are simply a location on a circle. You basically translate the x,y coordinates to polar coordinates on the circle.
x = r cos(tetha)
y = r sin(tetha)
where r is the radius of the circle and tetha is the angle in radians measured from the X axis
https://en.wikipedia.org/wiki/Polar_coordinate_system
In 3D, x,y,z would translate to polar coordinates on a sphere.
There is even a parametric formula for gears
http://mathworld.wolfram.com/GearCurve.html
x = r cos(tetha)
y = r sin(tetha)
where r is the radius of the circle and tetha is the angle in radians measured from the X axis
https://en.wikipedia.org/wiki/Polar_coordinate_system
In 3D, x,y,z would translate to polar coordinates on a sphere.
There is even a parametric formula for gears
http://mathworld.wolfram.com/GearCurve.html
$ifndef "Softimage"
set "Softimage" "true"
$endif
set "Softimage" "true"
$endif

 Posts: 398
 Joined: 12 Mar 2013, 18:44
Re: Parametric modeling (Closed linear curves for start)
Hello i did not had time to look at any code latelly, so to refresh my mem i did a new shape.
The : Regular star polygon (continuous )
It looked quite simmilar case with n gon drawing
i thought that i just had to figure our the new angle to create next point.
180(180/n) worked right away for n = 5 quite heavy metal results.
All even numbers produced weird results at the start. Later i figured that some of them work with 180(360/n)
others worked with 180(720/n)
In the end i realized that n = 6 is quite unique case because it cannot be regular continues star polygon.
n=6 requires a weird sequence of different angles with a number of edges > n (not regular anymore). So i left it as it is produces a 6gon i believe.
And closing with the weird image of the day produced based on this script:
Added a z value on each itteration so it ended like a star spiral thing , then i added a bend deformer so it looked like a ring of star spiralz haha and then i made it a mesh and extruded each quad.
The : Regular star polygon (continuous )
It looked quite simmilar case with n gon drawing
i thought that i just had to figure our the new angle to create next point.
180(180/n) worked right away for n = 5 quite heavy metal results.
All even numbers produced weird results at the start. Later i figured that some of them work with 180(360/n)
others worked with 180(720/n)
In the end i realized that n = 6 is quite unique case because it cannot be regular continues star polygon.
n=6 requires a weird sequence of different angles with a number of edges > n (not regular anymore). So i left it as it is produces a 6gon i believe.
Code: Select all
var n = 4;
var radius = 1;
var angle = 360/n;
var a;
function toRadians (angle) {
return angle * (Math.PI / 180);
}
var pointslist="";
if (n % 2 === 1){ //Math.abs(n % 2) == 1
a=180angle*0.5;
LogMessage("n="+n+" ODD NUMBERS1,3,5,7 ...team"+a+"");
for(i = 0; i <= n1; i++) {
pointslist+="("+radius*Math.cos(toRadians(a * i))+","+radius * Math.sin(toRadians(a * i))+","+0+"),";
}
}
else if ((n6)%4==0){LogMessage("n="+n+" EVEN NUMBER 6 10 14 ..team");
a=180angle*2;
for(i = 0; i <= n1; i++) {
pointslist+="("+radius*Math.cos(toRadians(a * i))+","+radius * Math.sin(toRadians(a * i))+",0),";
}
}
else{LogMessage("n="+n+" EVEN NUMBER rest team");
a=180angle;
for(i = 0; i <= n1; i++) {
pointslist+="("+radius*Math.cos(toRadians(a * i))+","+radius * Math.sin(toRadians(a * i))+",0),";
}
}
pointslist=pointslist.slice(0,1);
crv=SICreateCurve("Star_nGon", 1, 1);
SISetCurvePoints( crv, pointslist, false );
ApplyTopoOp("CrvOpenClose", crv, i, siPersistentOperation, null);
Added a z value on each itteration so it ended like a star spiral thing , then i added a bend deformer so it looked like a ring of star spiralz haha and then i made it a mesh and extruded each quad.

 Posts: 27
 Joined: 21 Feb 2018, 12:46
 Location: Zaragoza,Spain
Re: Parametric modeling (Closed linear curves for start)
Hi sorry if i didnt understand what you are trying to do, but wont all that logic you are creating be easier to prototype and parametrize dynamically in ICE?
It could be done in strads as i think someone says before, but if you need it, I can also share a plugin I developed some time ago, it lets you create a real sicurve from ice attributes interactively, it allows both linear and cubic, and also subcurves.
It works with arrays of 3D points ( and also of integers specifiying nb per subcurve if yo want). So you will be working with arrays until you plug those to the curve, that is what you are doing now i think, but in ICE, and that means you can change anything interactively, without need to create a lot of parameters editors and scriptedOps to have interaction...
And also you can debug to the viewport or to the console with the log node...
I dont know if these make sense for you, if you want to test it, let me know and I will try to post it with a few samples. I have already done some ice curve nodes like some spirals and some loxodrome(i think thats the namr :S).
And sorry if I completly missundertood the problem
It could be done in strads as i think someone says before, but if you need it, I can also share a plugin I developed some time ago, it lets you create a real sicurve from ice attributes interactively, it allows both linear and cubic, and also subcurves.
It works with arrays of 3D points ( and also of integers specifiying nb per subcurve if yo want). So you will be working with arrays until you plug those to the curve, that is what you are doing now i think, but in ICE, and that means you can change anything interactively, without need to create a lot of parameters editors and scriptedOps to have interaction...
And also you can debug to the viewport or to the console with the log node...
I dont know if these make sense for you, if you want to test it, let me know and I will try to post it with a few samples. I have already done some ice curve nodes like some spirals and some loxodrome(i think thats the namr :S).
And sorry if I completly missundertood the problem
You do not have the required permissions to view the files attached to this post.

 Posts: 398
 Joined: 12 Mar 2013, 18:44
Re: Parametric modeling (Closed linear curves for start)
@Pedrito I know im kinda reinventing the wheel here, like Daniel said most of these basic shapes are solved in to an existing plugin.
There are levels of "complexity" in what i was trying to do originally.
A)Generate a geometry with minimum variables example: nGon defined by Radius and N.
B)Generate a geometry with more than one combos of parameters example: nGon defined with radius + n and second option area + n.
C)  with many combos, reminding a cad program.

D)? ? unknown tool that makes life eazier: Ppl suggested in this thread that we could have an addon that adds parametric functionality but it would be hellish hard.
And of course it matters what the target geometry is or what you want to monitor.
I only managed to get to point C with a simpple nGon ( linear curve with js), but im not very happy cause it lacks UI, to be cool.
Your suggestion comes in a time that i miss sliders alot
Q: Example in pic requires plugin or i can built it right away?
There are levels of "complexity" in what i was trying to do originally.
A)Generate a geometry with minimum variables example: nGon defined by Radius and N.
B)Generate a geometry with more than one combos of parameters example: nGon defined with radius + n and second option area + n.
C)  with many combos, reminding a cad program.

D)? ? unknown tool that makes life eazier: Ppl suggested in this thread that we could have an addon that adds parametric functionality but it would be hellish hard.
And of course it matters what the target geometry is or what you want to monitor.
I only managed to get to point C with a simpple nGon ( linear curve with js), but im not very happy cause it lacks UI, to be cool.
Your suggestion comes in a time that i miss sliders alot
Q: Example in pic requires plugin or i can built it right away?

 Posts: 27
 Joined: 21 Feb 2018, 12:46
 Location: Zaragoza,Spain
Re: Parametric modeling (Closed linear curves for start)
Hi, the ngon problem in Ice is ridicully easy I think, the first option culd be propotyped in less than 5 mins, just create a vector in de direction you want, and rotate it with an N sized array of angles... And from there, all the logic you want.... Thats why I ask why dont use Ice in this case....mc_axe wrote: ↑12 Mar 2018, 23:48A)Generate a geometry with minimum variables example: nGon defined by Radius and N.
B)Generate a geometry with more than one combos of parameters example: nGon defined with radius + n and second option area + n.
C)  with many combos, reminding a cad program.

D)? ? unknown tool that makes life eazier: Ppl suggested in this thread that we could have an addon that adds parametric functionality but it would be hellish hard.
It requires a scriptedOP wich takes care of converting.ice arrays into real curves dynamically if you want a real curve. But You can do that with strands without any plugin, I will try to post both methods later so maybe the help, will post also some compounds that parameteize some curves ! Hope thesse help

 Posts: 27
 Joined: 21 Feb 2018, 12:46
 Location: Zaragoza,Spain
Re: Parametric modeling (Closed linear curves for start)
Hi there!
Here you have the Addon and a sample Scene inside, A menu for create the main curve is in Primitive/Curves/PC_IceCurve
If you take a look at the scene, it is one created and a bunch of compounds wich make different things, change the case and test them if you want to see how it works
Hope this heps
Here you have the Addon and a sample Scene inside, A menu for create the main curve is in Primitive/Curves/PC_IceCurve
If you take a look at the scene, it is one created and a bunch of compounds wich make different things, change the case and test them if you want to see how it works
Hope this heps
You do not have the required permissions to view the files attached to this post.