AutoCAD 2010/2011/2012

Reply
Contributor
Prac_Slip_Kerm
Posts: 23
Registered: ‎09-07-2011
Message 1 of 10 (7,016 Views)
Accepted Solution

Find the inflection point of a spline

7016 Views, 9 Replies
03-11-2012 04:42 PM

Hi All,

  Just wondering if anyone knows how to find the inflection point of a spline???

I create a spline from a list of points and want to know where the curve of the spline changes to be able to dimension this point, it is not necessarily a point that is entered.

TIA

Cheers
Steve :-)
Valued Mentor
gjrcmb
Posts: 322
Registered: ‎06-21-2011
Message 2 of 10 (7,004 Views)

Re: Find the inflection point of a spline

03-11-2012 05:53 PM in reply to: Prac_Slip_Kerm

Have you tried the CVSHOW command?

 

Displays the control vertices for specified NURBS surfaces or curves.

Valued Mentor
gjrcmb
Posts: 322
Registered: ‎06-21-2011
Message 3 of 10 (7,001 Views)

Re: Find the inflection point of a spline

03-11-2012 06:30 PM in reply to: gjrcmb

Also if you use the LIST command and select the spline, the control vertices displayed with CVSHOW command will be listed on the Text Screen.

Contributor
Prac_Slip_Kerm
Posts: 23
Registered: ‎09-07-2011
Message 4 of 10 (6,976 Views)

Re: Find the inflection point of a spline

03-12-2012 07:55 PM in reply to: gjrcmb

Thanks Guys,

  I thought this was the only way - might need to do a LISP to get control points then draw a line and find intersection point with spline. Would be nice to be able to snap to the CV points.... and the intersection of the CV line with the spline as this is the point I am after.

Cheers
Steve :-)
Valued Mentor
gjrcmb
Posts: 322
Registered: ‎06-21-2011
Message 5 of 10 (6,968 Views)

Re: Find the inflection point of a spline

03-12-2012 09:59 PM in reply to: Prac_Slip_Kerm

Try turning on your 3D Object Snap with Vertex selected to snap to the Control Vertices.  Then you could use the OSNAP Intersection snap to find the points you are after.

Valued Mentor
gjrcmb
Posts: 322
Registered: ‎06-21-2011
Message 6 of 10 (6,953 Views)

Re: Find the inflection point of a spline

03-13-2012 01:14 AM in reply to: Prac_Slip_Kerm

Maybe something like the attached lisp program could get you started.  Something I just put together fairly quickly that prints out the control vertex points of a spline and draws a polyline through the points.  Does not address how you would go about calculating or finding the intersection of the polyline and spline, which maybe more difficult to do.

Valued Mentor
gjrcmb
Posts: 322
Registered: ‎06-21-2011
Message 7 of 10 (6,937 Views)

Re: Find the inflection point of a spline

03-13-2012 12:46 PM in reply to: gjrcmb

OK, I couldn't resist.  See following lisp program that places polyline through control vertices and points at the intersection of the spline and polyline.  It also prints out the coordinates of the control vertices, the number of vertices, the number of spline-polyline intersection points, and the coordinates of the intersection points.  Notice that the points at the intersections at the beginning and ending of the spline do not necessarily coincide exactly with the control vertices at the beginning and ending of the spline.

 

The application does not automatically change the point display type.  So recommend using DDPTYPE to change the display of your points prior to running application.  As said before this is something I just put together fairly quickly, so make sure you test it out throughly.  Also could be modified to eliminate polyline, or the beginning and end points if not needed.

Contributor
Prac_Slip_Kerm
Posts: 23
Registered: ‎09-07-2011
Message 8 of 10 (6,920 Views)

Re: Find the inflection point of a spline

03-14-2012 03:12 AM in reply to: gjrcmb

Thanks Gavin!

  That LISP works well! I am making a few changes to it and when I finish I will post it back here for others - just wondering if the intersection is always the inflection piont though? Particulary when there are several cv points on the same side of the line before the change of curve?

The 3D snap works very well too thank you, I have lots to do though hence the LISP which is excellent!!!

Thanks again for the help guys!!!

 

Cheers
Steve :-)
Valued Mentor
gjrcmb
Posts: 322
Registered: ‎06-21-2011
Message 9 of 10 (6,909 Views)

Re: Find the inflection point of a spline

03-14-2012 10:28 AM in reply to: Prac_Slip_Kerm

I am not an expert on splines, so can't really shine any light on what might be considered an inflection point and how they relate to a definition of a spline.  Apparently there are different types and different parameters that can be set to determine the ultimate spline geometry, so it seems that there may be a lot to consider.

 

Glad that the Lisp routine is of help, and would definitely like to see what you come up with after its modification.  Also curious to know what you are drawing with the splines.  As a roadway design engineer, never really have the need to use splines, but apparently they do have their practicable applications.

 

You're welcome,

Contributor
Prac_Slip_Kerm
Posts: 23
Registered: ‎09-07-2011
Message 10 of 10 (6,900 Views)

Re: Find the inflection point of a spline

03-14-2012 01:30 PM in reply to: gjrcmb

Here is my slightly modified code. It deletes the polyline and draws a vertical line instead of a point.

;;;=========================================================================
;;; Spline Inflection
;;;=========================================================================
;;Application to place lines at the intersection of spline and polyline drawn through Spline Control Vertices
(defun c:SI (/ esel sobj elst ptlst nvrt pt pobj npts nintn pt2 yoffset)
	(vl-load-com)
	(while (null
		(setq esel (entsel "\nSelect Spline: ")))
		(princ "\nNothing Selected.")
	)
	(setq sobj (vlax-ename->vla-object (car esel)))
	(setq elst (entget (car esel)))
	(setq ptlst '())
	(setq nvrt 0)
        (setq yoffset 10)
	(if (= (cdr (assoc 0 elst)) "SPLINE")
		(progn
			(while (assoc 10 elst)
				(setq pt (cdr (assoc 10 elst)))
				(princ "\nCoordinates of Control Vertex: ")				
				(princ pt)
				(setq ptlst (append ptlst (list pt)))
				(setq elst (cdr (member (assoc 10 elst) elst)))
				(setq nvrt (+ nvrt 1))				
			)
			(princ (strcat "\nNumber of Spline Control Vertices: " (itoa nvrt)))
			(entmake '((0 . "POLYLINE")))
			(repeat nvrt
				(entmake (list '(0 . "VERTEX") (cons 10 (car ptlst))))
				(setq ptlst (cdr ptlst))
			)
			(entmake '((0 . "SEQEND")))
			(setq pobj (vlax-ename->vla-object (ssname (ssget "L") 0)))
			(setq ptlst (vl-catch-all-apply 'vlax-safearray->list 
				(list (vlax-variant-value (vla-intersectwith sobj pobj acextendnone)))))
		 	(vla-delete pobj)
			(setq npts (/ (length ptlst) 3))
			(princ (strcat "\n\nNumber of Intersection Points: " (itoa (- npts 2))))
		  	(setq ptlst (cdddr ptlst));Remove 1st points xyz
			(repeat npts
			  (while (> (length ptlst) 3)
			    (progn
				(setq pt (list (car ptlst) (cadr ptlst) (caddr ptlst)))
			        (setq pt2 (list (car ptlst) (- (cadr ptlst) yoffset) (caddr ptlst)))
				(princ "\nCoordinates of Intersection Points: ")
				(princ pt)
			        (entmake (list '(0 . "LINE") (cons 8 "BASE") (cons 10 pt) (cons 11 pt2)))
				(setq ptlst (cdddr ptlst))
			    );End Progn
			  );End While
			);End Repeat
		)
		(princ "\nSelected Object is Not a Spline.")
	)
	(princ)
)

 I use this for Kerb Returns as at the moment we do these by hand using a french curve then draft them using vanilla CAD. So I use a spline to fit between the points to get a smooth transition but want to be able to get the Kerb Return chainage of the inflection point to label the change of Vertical Curve.

I assume that C3D makes KR's much simpler! We are looking at updating design software and I am hoping to get C3D, will have to wait and see.

Thanks Again, Hope this might help others too!

 



Cheers
Steve :-)

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community




Connect with AutoCAD

Twitter

Facebook

Blogs

Pinterest

Youtube