Hi all
I have a little issue with filletting two splines with code I am hoping to get some help with.
I have 2 Beizers (order 3 or 4) who's end points are joined (As part of an iteration through a series of pairs - about 2k in all)
After borrowing some code from LeeMac, Ajilal.Vijayan and others, I thought I had it nailed but it is giving intermittent results as far as the direction of the fillet goes, or actually filleting at all.
The fillet will always be performed on a pair of splines joining at an angle 15-165 degrees (tangents).
I try to select 2 points that are close to the ends of each respective spline, but the result is not always a fillet - if the point is too far off the spline it can miss the selection (at least I think that's what is happening)..
..or if it is selecting the end point of a spline it can fillet in the wrong direction (extension rather than trimming)
I put all objects in view at the time of selection...
I draw some check lines in the code below to show the selection point of each spline for passing to the fillet command
(osnaps are off)
The crux of the issue is I do not seem to be able to get the resultant point actually on the spline for selection (see
I use vlax-curve-getClosestPointTo in an attempt to locate it after first getting close to the end I require filleted
So here's what I got...
(defun c:get_closest_points (name_subspline name_subspline2nd / w_pt w_pt2 w_pt_closest w_pt2_closest)
(setq curve (vlax-ename->vla-object name_subspline))
(setq w_pt
(vlax-curve-getPointAtDist
curve
(* (vlax-curve-getDistAtParam curve (vlax-curve-getEndParam curve))0.8) ; a point 80% along length of spline [near end point selection]
)
)
(setq w_pt_closest (vlax-curve-getClosestPointTo curve w_pt T))
(setq curve2 (vlax-ename->vla-object name_subspline2nd))
(setq w_pt2
(vlax-curve-getPointAtDist
curve2
(* (vlax-curve-getDistAtParam curve2 (vlax-curve-getEndParam curve2))0.2) ; a point 20% along length of spline [near start point selection]
)
)
(setq w_pt2_closest (vlax-curve-getClosestPointTo curve2 w_pt2 T))
(terpri)(command "line" (strcat (rtos (car w_pt_closest)) "," (rtos (cadr w_pt_closest))) (strcat(rtos (car w_pt2_closest)) "," (rtos (cadr w_pt2_closest))) "")(princ)
(command "fillet" (list name_subspline w_pt_closest) (list name_subspline2nd w_pt2_closest) )
I'll try to upload an image of what I am talking about (if I can) shortly