I need some brains to work on this script
for DNA Wandering stuff.
I have made 4 straight splines but can go no further.
Now I am trying to attach them and my line keep
If you check my video you see that I am starting
to build the outline of the cube.
It is oriented as shown.

( http://www.youtube.com/watch?v=zhY9RMPmqEo )

I have attached the script that make the 4 lines


select $Shape01
max modify mode
subobjectLevel = 0
modPanel.setCurrentObject $Shape01.baseObject
splineOps.startAttach $Shape01

_____need to attach $Shape02 $Shape03 $Shape04


dna_walkabout.ms1.49 KB


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tommym's picture


It can support the pair of us 50 50


Anubis's picture


Glad to know I have support the science with something :)

my recent MAXScripts RSS (archive here)

tommym's picture

DNA Walkabout

Wow thanks Anubis,

You make it look so easy. The next step is to turn this into the cube outline
The outer cube edges are 700 by 700 by 700 and the center inner cube is 100 by 100 by 100
What I aim to end up with is to get the DNA "DEE" and "SPAGO" to string along like crazy by just punching in the numbers 0.1.2 with S or feeding a text and produce a DNA 4 Color String to move to perfect order around in 3d space. Which could be a big thing for science. I realize this is putting you guys out a bit
but it will not see daylight without your help.
Thanks from Paul


Anubis's picture

interesting video...

First to say, forget all splineOps functions as soon as possible. They are kernel of bugs that corrupt the scene. The rest functions for shapes are fine, but splineOps is a full garbage.

So, you need to draw the lines one by one and then attach them? If so, you can use addAndWeld (but below will show an alternative):

fn drawLineBetweenTwoPoints pointA pointB =
	ss = SplineShape pos:pointA
	addNewSpline ss
	addKnot ss 1 #corner #line PointA
	addKnot ss 1 #corner #line PointB
	updateShape ss
-- draw lines...
sp1 = drawLineBetweenTwoPoints  [0,0,606.213] [494.976,-285.774,202.087]
sp2 = drawLineBetweenTwoPoints [0,0,606.213] [-494.976,-285.783,202.087]
sp3 = drawLineBetweenTwoPoints [0,-571.557,-202.059] [494.976,-285.783,202.087]
sp4 = drawLineBetweenTwoPoints [-494.963,-285.774,202.067] [0,-571.557,-202.059]
-- as the 4 lines w'd become 1 shape - you can leave this part for the end
-- and just say: (sp1.wirecolor = color 0 252 252)
#(sp1,sp2,sp3,sp4).wirecolor = color 0 252 252 -- set wirevcolor for all
-- addAndWeld...
addAndWeld sp1 sp2 0.1
addAndWeld sp1 sp3 0.1
addAndWeld sp1 sp4 0.1
updateShape sp1
-- so you end with 1 closed shape
isClosed sp1 1 -->> true

As you know the coords, the alternative (more easy) way w'd be to draw entire shape at once (no needs attaching in this case):

-- here is a custom function
fn DrawShape pntCoords wColor = (
	ss = SplineShape pos:pntCoords[1]
	addNewSpline ss
	for i = 1 to pntCoords.count do (
		addKnot ss 1 #corner #line pntCoords[i]
	close ss 1; ss.wirecolor = wColor
	updateShape ss; ss
-- define array of Point3
arrPoints = #(
	[0,0,606.213], [494.976,-285.774,202.087],
	[0,-571.557,-202.059], [-494.963,-285.774,202.067]
-- call the function
newShape = DrawShape arrPoints (color 0 252 252)


my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.