View Full Version : attaching spline - not using addandweld

02 February 2009, 03:03 PM
Hi all,

I am working on a project where I need to create splines using points stored in an array then attach these splines so that I can use the CrossSection modifier to create a surface between the two splines.

I have an easy way for creating the splines using points in an array:

fn arch_gen pointA pointB pointC =
ss = SplineShape pos:pointA
addNewSpline ss
addKnot ss 1 #smooth #curve PointA
addKnot ss 1 #smooth #curve PointB
addKnot ss 1 #smooth #curve PointC
updateShape ss
newSpline = arch_gen array[1] array[2] array[3]

Now I thought that I could simply create curves and attach them using:

addandweld $shape01 $shape02 0.0

This does weld the curves together but does not then work when I try to create a surface between the curves using:

addmodifier $shape01 (CrossSection()) ui:on
addmodifier $shape01 (Surface()) ui:on

Is there a way in which I can attach the created shapes using the attach method you can use in the 'geometry' modifier panel for the shape?
Any help here would be really appreciated!!


02 February 2009, 12:03 AM
just a thought: if all your have is a point array to begin with, why not just draw all the splines in the 1 splineshape object to begin with?

02 February 2009, 01:01 AM
in addition to what Gravey said...

are you quite sure the problem is with addAndWeld?

The following should create a 'Cylinder':

a = circle pos:[0,0,0]
convertToSplineShape a
b = circle pos:[0,0,-100]
convertToSplineShape b
addAndWeld a b 0.0
addmodifier a (CrossSection())
addmodifier a (Surface())

02 February 2009, 12:02 PM
I need the splineshapes to be separate to begin with because I am trying to create gothic arches between points. The script initially begins with one point and does some calculations to determine the points along a spline to another point.

This works fine and at this point if I use the manual attach operation I can then create a surface between any two splines. However, if I use addandweld it does not seem to work in the same way?

The circle method is good, but it will not allow me to create arches or curved surfaces, unless I go through the process of creating circles, rotating them and moving to correct positions...etc.

Iím not sure what the actual problem is, because this works with lines that are drawn but when I create my splineshapes using the function above it does seem to work! Perhaps it is not a problem with addandweld but if not Iím not sure what the problem is??

Any ideas of what it might be?

02 February 2009, 12:22 PM
what are the coordinates for two of the curves that seem to fail for you? I had a quick test with your function, and it seems to be okay, too...

newSpline = arch_gen [0,0,0] [50,100,0] [100,0,0]
newSpline2 = arch_gen [0,0,-100] [50,100,-100] [100,0,-100]
addAndWeld newSpline newSpline2 0.0
addmodifier newSpline (CrossSection())
addmodifier newSpline (Surface())

02 February 2009, 07:03 PM are right. That does seem to work but that means that something else must be wrong in my script I guess!

I will have another look and let you know the outcome.

02 February 2009, 08:24 AM
I have sorted out the problem! most of the arches I have been creating have a common starting point therefore using addandweld has been welding the splineshapes together. By changing the weld threshold from addandweld newSpline newSpline2 <0.0> to -1.0 the problem seems to have stopped.

This is probely a bit of a hack but it works. Thanks for all your help.

02 February 2009, 12:47 PM
ah! that would do it, yes - glad you resolved it :)

CGTalk Moderation
02 February 2009, 12:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.