Notifications
Clear all

[Closed] Creating segments in a Spline

Hey,

I’m trying to create segments (evenly) in a line. I thought this would take 10 minutes to do…but now getting completely stuck.

I thought of using “refine” somthing like this:

for x = 1 to 6 do
(
refineSegment $Line001 1 x 0.5
)

Nothing…

Any direction would be great! Thanks

4 Replies
1 Reply
(@lucpet)
Joined: 11 months ago

Posts: 0

Look up knots for a spline. Here is an example of another spline question I answered a while ago. It uses code from the help file if memory serves me.

-- How to move a Spline Knot (Vertex)
-- Well this is very rough but it will start you off
rollout testme "Testme"
(
	button goMe "Go!" width:150
	spinner k1 "Knot 1" range:[-100000.0,100000.0,0.0] width:140 align:#center
	spinner k2 "Knot2" range:[-100000.0,100000.0,-100.0] width:140 align:#center
fn dLBP pointA pointB =
(
	ss = SplineShape pos:pointA
	addNewSpline ss
	addKnot ss 1 #corner #line PointA
	addKnot ss 1 #corner #line PointB
	ss.wirecolor = color 255 246 0
	updateShape ss
	ss
)
	on goMe pressed do
	(
		dLBP  [0.0,0.0,0.0] [0.0,0.0,-100.0]
	)
	on k1 changed val do
	(
		setKnotPoint $Shape001 1 1 [0.0, 0.0, val]
		updateShape $Shape001
	)
	on k2 changed val do
	(
		setKnotPoint $Shape001 1 2 [0.0, 0.0, val]
		updateShape $Shape001
	)
)
createdialog testme style:#(#style_toolwindow, #style_sysmenu)

Thank you Ill get on this now.

Knots pos will be in local coords too from what I remember so you might need a function to translate if your incoming data is in world coords.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

getknotpoint always returns knot’s position in the world space.