Notifications
Clear all

[Closed] splineOps.weld in a loop

I do not seem to be able to figure this out:
in my script the splineOps.weld method seems to work only on the last section created in the loop and not on any previous one.
I must be doing something wrong.

L_Ext Side_Segments:1 Front_Segments:1 Width_Segments:1 Height_Segments:1 Side_Length:600 Front_Length:400 Side_Width:180 Front_Width:240 height:600 mapcoords:1 realWorldMapSize:on pos:[0,0,0] isSelected:on
actionMan.executeAction 0 "311"  -- Tools: Zoom Extents All Selected	
n = 2 --number of sections
d = 200 --increment
for i=1 to n do
(
	section length:20 width:20 pos:[0,0,i*d] isSelected:on
	redrawViews()
	convertToSplineShape $
	max modify mode 
	setCommandPanelTaskMode mode:#modify
	subObjectLevel = 1
	max select all
	updateshape $
	splineOps.weld $ -- weld vertex does not work except on the last loop???
	subObjectLevel = 0
)

Thanks in advance for any help.

2 Replies

I found the solution here:
http://forums.cgsociety.org/archive/index.php/t-586990.html

for o in selection where iskindof o SplineShape do weldSpline o 0.1

Sorry for the redundant post.

actually

for o in selection where iskindof o SplineShape do weldSpline o 0.1

welds the vertices but leaves the splines open (it does not weld the first vertex with the last).
the dotnet Timer function suggested in the previous post does not seem to work in my script (it welds and closes only the last spline).