Notifications
Clear all

[Closed] SplineShape is not closing

 em3

Hi! I have a simple script that traces a Plane. Can’t figure out why it’s not closing. Can someone point me in the right direction?

				(
				local p = converttopoly(plane length:10 width:10 lengthsegs:1 widthsegs:1)
					local ss,vertorder,v
				ss = SplineShape pos:[0,0,0]
				addNewSpline ss
				vertOrder = #(1,2,4,3,1)
					for v in vertOrder do --thenotes.count do
					(
						addknot ss 1 #corner #line (polyop.getvert p v)
					)
					close ss 1
					updateshape ss
				)

Thanks!

2 Replies

The shape is closed. You just have 2 vertices at the same position because you have a 5 items in the array.

Try removing the last item in the array:

vertOrder = #(1,2,4,3)

Additionally, something like this may also work:

(
 gc()
 delete objects
 obj = converttopoly(plane length:10 width:10 lengthsegs:1 widthsegs:1 wirecolor:yellow)
 
 sh = splineshape wirecolor:red
 addnewspline sh
 
 for j in (polyop.getfaceverts obj 1) do
 (
 	addknot sh 1 #corner #line (polyop.getvert obj j)
 )
 
 close sh 1
 updateshape sh
 )
1 Reply
 em3
(@em3)
Joined: 11 months ago

Posts: 0

DOH! Thank you, works great now. I am shamed.