Draw a line perpendicular to the spline

Draw a line perpendicular to the spline

anycganycgJ8A6A
Advocate Advocate
1,903 Views
3 Replies
Message 1 of 4

Draw a line perpendicular to the spline

anycganycgJ8A6A
Advocate
Advocate
Hi
I wish you a happy Christmas
I'm going to ask some difficult questions today.
The attached image shows the CAD screen
On the screen, the same distance to the spline
I want to draw a vertical line
Instead of using the space tool, the script will make the spline the same distance
I want to draw a line perpendicular to the vertex after division
is this possible ?
0 Likes
Accepted solutions (1)
1,904 Views
3 Replies
Replies (3)
Message 2 of 4

istan
Advisor
Advisor

also merry x-mas..either you or I drank too much punch.. I have no clue, what you talk about.. in the image there are > 9 polylines -  which vertex you talk about? Also you wrote about a vertical line or a perpendicular line..

0 Likes
Message 3 of 4

anycganycgJ8A6A
Advocate
Advocate
##- thank you for answer
There is curve spline . I would like to make vertical line per divided
spline vertext can you understand ?-##
0 Likes
Message 4 of 4

leeminardi
Mentor
Mentor
Accepted solution

Here's a script that draws a spline defined as y = x^2 and then draws lines perpendicular to it. 

 

I based it on the routine found here and just took a cross product of the tangent line with the z axis to get the perpendicular lines.  It can be modified to use an existing spline and to create a spline based on the end points of the perpendicular lines.  I assumed the spline lies on the XY plane. Getting a perpendicular line for a true 3D spline is a bit tricker as the are an infinite number to choose from! 

 

splineperp.JPG

 

 

(
	local sp = splineShape()
	addnewSpline sp
	for i = 1 to 100 by 10 do
		(
		addknot sp 1 #smooth #curve [i, (i*i / 100.0), 0]
		)
	updateShape sp
	sp.wirecolor = color 255 0 0
	local count = numknots sp - 1
	for i = 1 to count do
		(
		local pathp = true
		local pt = interpBezier3D sp 1 i 0.50 pathParam:pathp
		local tn = tangentBezier3D sp 1 i 0.50 pathParam:pathp
		local perp = cross tn [0,0,1]
		local sperp = splineShape()
			

		addnewSpline sperp
		addknot sperp 1 #corner #line pt
		addknot sperp 1 #corner #line (pt + (perp * 20))
		updateShape sperp
		sperp.wirecolor =yellow
		
		)
)

 

 

lee.minardi
0 Likes