Notifications
Clear all

[Closed] Spline/vertex weld routine

Hello–

I am new to programming and very new to maxscript, and I need some help. I am bringing in building footprint data from AutoCad. The data comes in as ‘linked shapes’. I need to convert these to editable splines, and then weld the vertices for each individual shape so that I can extrude them capped.

I have searched the forums and gotten part way (‘Script for sorting out splines’ was very helpful). I’ve come up with the following routine that works on a single spline shape, but when multiple shapes are selected only the last shape’s vertices are welded. (the script works on each shape up to the point of welding verticies):

max modify mode
splines = for obj in selection collect obj
for s in splines do
(
convertTo s SplineShape
select s
subobjectLevel=1
max select all
splineOps.weld $
splineOps.weld $
)

I’ve noticed others have had the same issue, but I can’t sort out how to fix it. Even if it cannot be fixed, I would very much like to know why it will not work for multiple shapes.

Thanks

2 Replies

i wasnt able to do it either, i havent had any chances on fiddling with splineops in the past, it was kind of fun playing with the scripts. anyway, id just like to share what i did, even though i wasnt able to make it work like you wanted… sori.


thespline = selection
for i in thespline where classof i == line do
 (
 spline_num = numsplines i
 for j in 1 to spline_num  while (j != 0) do
  (
  knots_num = numknots i j
  first_knot = (knots_num - (knots_num-1))
  last_knot = knots_num
  setknotselection i j #(first_knot,last_knot)  
  )
 splineops.weld i 
 )

this only works in subobject vertex mode… hehe, although I know its a lot easier to just select the vertices and press weld rather than going thru this script.

Thanks Galagast. I didn’t know about that method.