;; | --------------------------------------------------------------------------- ;; | PL_SplitPoly ;; | --------------------------------------------------------------------------- ;; | Function : Split a polyline into a number of smaller segment polylines ;; | based on a list of points falling along it. ;; | Argument : 'vlist' - List of points of the polyline ;; | 'ptLst' - List of points that fall along the polyline where the ;; | splitting should take place ;; | Return : None ;; | Updated : March 27, 2001 ;; | Author : Rakesh Rao ;; | Copyright: Four Dimension Technologies, Singapore-India ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun PL_SplitPoly( vlist ptLst / Lst Vx vlist1 cnt More len pt LastPt tmp ) (setq cnt 0 Lst '() More T len (length vlist) LastPt (last vlist) ) (while More (setq pt (nth cnt ptLst)) (if pt (progn (setq cnt (1+ cnt) Vx (GE_LocateVx pt vlist) ) (if Vx (progn (setq vlist1 (LI_SubList vlist 1 Vx)) (if vlist1 (progn (setq vlist1 (append vlist1 (list pt)) vlist1 (GE_DistWeed vlist1 0.0001 "Slope") ) (if vlist1 (setq Lst (cons (car vlist1) Lst)) ) (setq vlist (cons pt (LI_SubList vlist (1+ Vx) -1)) len (length vlist) ) )) )) ) (setq More nil) ) ) ; Add last segment to the list of points. (if Lst (setq tmp (car (GE_DistWeed (reverse (cons LastPt (reverse (nth 0 Lst)))) 0.0001 "Slope")) Lst (LI_RepList Lst 1 tmp) )) (reverse Lst) )