Could somebody write me a routine which would split a spline in it's lowest point, please?
Could somebody write me a routine which would split a spline in it's lowest point, please?
Can you explain more in details please ?
Tharwat
I need to split a parabola like this one (unknown start and end)
http://www.google.hr/imgres?start=24...13,s:247,i:204
into 2 pieces in it's lowest point.
I've been working all day on a somewhat mathematical solution (putting a horizontal line inside of the parabola, then putting a vertical line in the center of the horizontal one and breaking the spline (parabola) in the intersection of the vertical line and the spline).
I was hoping someone with more programming skill could help me with a more elegant solution (one which works on splines of any type)![]()
Give this a try...
Note that it is absolutely bare-bones, with no error handling, and assumes that there is only one "lowest" point on the curve.Code:(defun c:foo ( / MAXPT MINPT OLDOSMODE PTA SPLINEOBJ VLA-SPLINEOBJ) (setq splineobj (car (entsel)) vla-splineobj (vlax-ename->vla-object splineobj) ); setq (vlax-invoke-method vla-splineobj 'getboundingbox 'minpt 'maxpt) (setq pta (vlax-curve-getclosestpointtoprojection vla-splineobj (list 0.0 (- (cadr (vlax-safearray->list minpt)) 10.0) 0.0) (list 1.0 0.0 0.0) nil ); vlax-curve-getclosestpointtoprojection oldosmode (getvar "osmode") ); setq (setvar "osmode" (boole 7 (getvar "osmode") 16384)) (vl-cmdf "break" splineobj pta pta) (setvar "osmode" oldosmode) (princ) ); defun
thank you![]()