• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD 2010/2011/2012 DWG Format

    Reply
    Contributor
    Prac_Slip_Kerm
    Posts: 23
    Registered: ‎09-07-2011
    Accepted Solution

    Find the inflection point of a spline

    457 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 :-)
    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 321
    Registered: ‎06-21-2011

    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.

    Gavin Rouleau, PE
    C3D 2012 SP1, Win XP Home
    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 321
    Registered: ‎06-21-2011

    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.

    Gavin Rouleau, PE
    C3D 2012 SP1, Win XP Home
    Please use plain text.
    Contributor
    Prac_Slip_Kerm
    Posts: 23
    Registered: ‎09-07-2011

    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 :-)
    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 321
    Registered: ‎06-21-2011

    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.

    Gavin Rouleau, PE
    C3D 2012 SP1, Win XP Home
    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 321
    Registered: ‎06-21-2011

    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.

    Gavin Rouleau, PE
    C3D 2012 SP1, Win XP Home
    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 321
    Registered: ‎06-21-2011

    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.

    Gavin Rouleau, PE
    C3D 2012 SP1, Win XP Home
    Please use plain text.
    Contributor
    Prac_Slip_Kerm
    Posts: 23
    Registered: ‎09-07-2011

    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 :-)
    Please use plain text.
    Valued Mentor
    gjrcmb
    Posts: 321
    Registered: ‎06-21-2011

    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,

    Gavin Rouleau, PE
    C3D 2012 SP1, Win XP Home
    Please use plain text.
    Contributor
    Prac_Slip_Kerm
    Posts: 23
    Registered: ‎09-07-2011

    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 :-)
    Please use plain text.