Dayananda Posted July 23, 2022 Posted July 23, 2022 I want to insert a block at a given distance from a start end of a polyline. Pl. can somebody give me a code. Quote
mhupp Posted July 23, 2022 Posted July 23, 2022 (edited) Need a little more information or a sample drawing. Must have just read title Assumes start end of poly are same distance. Easy enough using vlax-curve-getpointatdist. error check to see if distance is less than 1/2 the distance of the polyline. or the start block would be past the end block on the polyline. ;;----------------------------------------------------------------------------;; ;; INSERT BLOCK AT DISTANCE FROM ENDPOINTS ON POLYLINE (defun C:foo (/ dist poly Spt Ept) (vl-load-com) (setvar 'cmdecho 0) (setq dist (getdist "\nDistance from ends of poyline: ")) (setq poly (vlax-ename->vla-object (car (entsel "\nSelect Polyline: ")))) (if (< dist (/ (vla-get-length poly) 2)) (progn (setq Spt (vlax-curve-getpointatdist poly dist)) (command "_.Insert" blockname "_non" Spt "" "" "") (setq Ept (vlax-curve-getpointatdist poly (- (vla-get-length poly) dist))) (command "_.Insert" blockname "_non" Ept "" "" "") ) (prompt "\nDistance is to large") ) (setvar 'cmdecho 1) (princ) ) Edited July 24, 2022 by mhupp cmdecho and princ 1 Quote
Steven P Posted July 23, 2022 Posted July 23, 2022 Along the polyline? Look at chainage LISPS, there are some that will place a block there and I think will have a repeat or while loop as it iterates along the line, maybe all you need is to take that out to get the first distance. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.