Hey guys,
Bla-bla-bla... read this if you want:
There was a question in another forum, where the task was to "cap" two curves (that are most likely offseted, but not always).
So Tharwat did a wonderful job there, to compare the distance between each 'Endpoint and 'Startpoint from the pair of curves to determine the correct 'chain solution', hence he wrote a "quick" capping routine.
My input there was by using a grread toggle (to ask the user if the result is correct), hehe - Unfortunately that thread got 'old' and was buried down in the history (so I'm unable to find it).However, one most likely would perform offset at first and then would cap.. so I came up with this variation (written as subfunction) :
; c - open curve
; d - cap size
; Returns: The cap'ped polyline
; Example: (OpenCurve->DoubleOffsetNcap (car (entsel)) 60)
(defun OpenCurve
->DoubleOffsetNcap
( c d
/ *error* oL spc vL IsLineSpline UseLwPoly o
)
); defun *error*
; Point list to safearray
)
); defun pL->SafeArray
; Basic function to get the point list from ename/vla-object
)
); defun GetCoords
(setq vL
(append (GetCoords
(car oL
)) (reverse (GetCoords
(cadr oL
))))) ; clockwise or not, aslong we reverse the 2nd pointlist will work ); and
)
); setq o
); and
)
); cond
(*error* nil) o ; so if 'c' was a 3D line, then it will return 3DPoly, else LightWeightPoly
); defun OpenCurve->DoubleOffsetNcap
This is just an idea for a potentially useful subfunction.
But I'd like to see your shots at this (since I think my code is sloppy, and doesn't work with arcs).