[Closed] attaching spline – not using addandweld
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 [color=white]arch_gen pointA pointB pointC =[/color]
(
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
ss
)
newSpline = arch_gen array[1] array[2] array[3[size=2]]
[/size]
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:[size=2]on[/size]
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!!
Cheers,
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?
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())
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.
Im 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 Im not sure what the problem is??
Any ideas of what it might be?
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())
mmm…you 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.
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.