Sweep object SplineScale splinedata
-
On 27/02/2013 at 07:19, xxxxxxxx wrote:
Hi all,
I have a script where I am creating sweepNURBs objects in python based on imported data. Its all working fine. I have radius information for each point of the imported splines, and I'd like to address the SweepNURBS[c4d.SWEEPOBJECT_SPLINESCALE] spline data parameters to:
- set the spline type to linear
- add spline knots for each data point
- set the y value to reflect the radius at that point
- set the x value to position the knot along the spline proportional to the point's position along the imported spline.
I've searched, but I'm not finding much about this, and I may be wrong, but the c4d.SplineData documentation seems mostly oriented toward making custiom GUIs...
Any insight from the hive mind? Thanks in advance...
Nick
-
On 27/02/2013 at 08:41, xxxxxxxx wrote:
read c4d.SplineData, it is all there. the class is the wrapper for the SplineData CustomGui, but
has itself nothing to do with CustomGuis (spline data is just like most of the the c4d interface
elements a CustomGui). -
On 27/02/2013 at 10:48, xxxxxxxx wrote:
Hi,
I've read the splinedata section but my attempts to use it haven't worked.
Here's an example of what I've tried:
Sweep = c4d.BaseObject(c4d.Osweep)
Sweep[c4d.ID_BASELIST_NAME] = "Sweep"
Sweep[c4d.SWEEPOBJECT_CONSTANT] = False
splineRadius = Sweep[c4d.SWEEPOBJECT_SPLINESCALE]
splineRadius.InsertKnot(0.5, 0.5, 0)doc.InsertObject(Sweep)
Here I'm hoping that a new knot is created between the default knots at a y position of .5. I've also tried the SetKnot command to no avail.
I don't get errors, but I also don't get any new knots...
Nick
-
On 27/02/2013 at 10:58, xxxxxxxx wrote:
you have to write your variable back or dircetly use the your spline object.
Sweep[c4d.SWEEPOBJECT_SPLINESCALE].InsertKnot(args)but you should use setknot, as it is the method connected to the new splinedata
interface.# --- init values # ----------------------------------------------------------------------------------- def Init(self, node) : ... rampSpl, rmpCount = c4d.SplineData(), 7 rampSpl.MakePointBuffer(rmpCount) step = 1.0/ (rmpCount-1) for i in xrange(rmpCount) : if i == 0: rampSpl.SetKnot(index = i, vPos = c4d.Vector(i * step, (i * step) ** 5, 0), interpol = 1) elif i >= rmpCount-2: rampSpl.SetKnot(index = i, vPos = c4d.Vector(i * step, (i * step) ** 5, 0), interpol = 1) else: rampSpl.SetKnot(index = i, vPos = c4d.Vector(i * step, (i * step) ** 5, 0), interpol = 2) linearSpl = c4d.SplineData() linearSpl.SetKnot(index = 0, vPos = c4d.Vector(0, 1, 0), vTangentLeft = c4d.Vector(-.25, 0, 0), vTangentRight = c4d.Vector(.25, 0, 0)) linearSpl.SetKnot(index = 1, vPos = c4d.Vector(1, .8, 0), vTangentLeft = c4d.Vector(-.25, .15, 0), vTangentRight = c4d.Vector(0, 0, 0)) node[c4d.IDC_NOISE_SPREADSPLINE] = rampSpl node[c4d.IDC_NOISE_VERTEXSCALESPLINE] = linearSpl
-
On 28/02/2013 at 13:17, xxxxxxxx wrote:
Many thanks for your help...
I still couldn't get it to work (beginning Python coder here), so I tried another tack: I duplicated the path spline, and adjusted the points to provide a rail spline for the sweepNURBs object. Works very well, and results in more controllable geometry.
This is for the reconstruction of neuron geometry from morphology data files...
Nick