hi,
i have a problem, i will draw a DESTINATION 2d polyline (using lsp ??) using midpoint (every segment) of another SOURCE 2d polyline
can somebody help me ?
many Thanks
Ste
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
@Anonymous wrote:
....
i have a problem, i will draw a DESTINATION 2d polyline (using lsp ??) using midpoint (every segment) of another SOURCE 2d polyline
....
Welcome to the Forums! This isn't really a release-specific issue, and the Customization Forum would be a better place [I didn't Search for whether someone may have asked the same thing before, but it's possible]. But quickly:
(vl-load-com); if needed
(defun C:PLMID (/ pl clo n ptlist)
(setq
pl (car (entsel "\nSelect Polyline: "))
clo (vlax-curve-isClosed pl)
n 0
); setq
(repeat (- (cdr (assoc 90 (entget pl))) (if clo 0 1)); number of vertices, minus 1 if open
(setq
ptlist (cons (vlax-curve-getPointAtParam pl (+ n 0.5)) ptlist); halfway points
n (1+ n)
); setq
); repeat
(command "_.pline")
(foreach pt ptlist (command "_none" pt))
(command (if clo "_close" ""))
); defun
That's very basic, and minimally tested. It will draw on the current Layer, using whatever the current Polyline thickness is, and doesn't check that the User actually picked a Polyline [or even anything at all], and so on, but all those improvements and more can easily be added.
[It is rarely possible that it could fail, since Polylines can under strange circumstances find their Parameter values out of whack and not with integer values representing the vertices, but I've never had that happen. There's a thread that discusses that somewhere, but I didn't find it in a really quick Search.]
You're welcome [I'll have to look up Master Oogway, to see whether to take that as a compliment...], and I found that discussion of quirky Polyline Parameter values -- see Owen Wengerd's message at the bottom of page one of this thread, and subsequent discussion.