Textfile splines to xyz and adding sweep modifier
Hi
I am having difficulty creating a swept modifier on a series of splines. The splines are generated from a text file which provides an x,y,z of each knot.
Whilst the splines come in generally correctly ( I cant tell because I cannot click on the vertex and move it etc to see the coordinate) the sweep modifier is not consistent across each spline nor follows the custom sweep object shape.
I thought this may have been a problem with the pivot but its still not working correctly.
I am also having an issue with the boolean of the left or right. I was wondering if I could get some tips on this, I am very green with Maxscript. thank you.
My code thus far is;
arr = $'Plinth*' as array arrg = $'Grout*' as array for i = 1 to arr.count do ( if arr[i] != undefined do ( delete arr[i] delete arrg[i] ) ) fileIn "C:\\My Projects\\Plinths.ms" n = getOpenFileName caption:"Open Plinth File:" filename:"C:/My Projects/" f = openfile n mode:"r" count = 0 while not eof f do ( l = readline f data = filterstring l "|" mySpline= splineShape name: ( uniqueName data[1]) addnewspline mySpline tarx = data[2] as float tary = data[3] as float tarz = data[4] as float tar2x = data[5] as float tar2y = data[6] as float tar2z = data[7] as float ( addknot mySpline 1 #corner #line (point3 tarx tary tarz) addknot mySpline 1 #corner #line (point3 tar2x tar2y tar2z) ) close mySpline 1 mySpline.Name = data[1] as string CenterPivot mySpline beamtype = getNodeByName data[8] for index = mySpline.modifiers.count to 1 by -1 do if ((classOf mySplinemodifiers[index]) == Sweep) do deleteModifier mySpline index local sw=sweep() -- create a sweep modifier addModifier mySpline sw -- add sweep modifier select mySpline -- select mySplineect mySpline.modifiers[#Sweep].CustomShape = 1 mySpline.modifiers[#Sweep].XOffset = 0 mySpline.modifiers[#Sweep].yOffset = 0 mySpline.modifiers[#Sweep].MirrorXZPlane = off mySpline.modifiers[#Sweep].shapes[1] = beamtype.baseObject mySpline.modifiers[#Sweep].PivotAlignment = 0 ss1 = data[9] as string ss = substring (ss1) 1 4 --if (ss = "Left") then mySpline.modifiers[#Sweep].MirrorXZPlane = off -- if (ss = Righ) then mySpline.modifiers[#Sweep].MirrorXZPlane = on mySpline.modifiers[#Sweep].Banking = off mySpline.modifiers[#Sweep].SmoothSection= on mySpline.modifiers[#Sweep].SmoothPath = off ) <code> the standard textfile is like this but there is many more; where its name, x knot 1, y knot1, z knot 1, x knot 2 to z knot 2, the shape STD_Plinth which looks like an L and which way it faces. 1|7270.313|-2280.269|64.913|7274.148|-2283.862|64.995|STD_Plinth|Left Grout_ 1|7270.313|-2280.269|64.548|7274.148|-2283.862|64.63|STD_Grout|Left 2|7274.316|-2284.019|65.007|7277.151|-2286.675|65.064|STD_Plinth|Left Grout_2|7274.316|-2284.019|64.642|7277.151|-2286.675|64.699|STD_Grout|Left