好的,这是一个链测长度偏移和rl,将遵循路线创建三维点。
链测长度,偏移,RL
- ; Read a csv file and create 3d points along a pline alignment
- ; by Alan H jan 2016
- ;local defun for sq to pline
- (defun alg-ang (obj pnt)
- (- (angle '(0. 0. 0.)
- (vlax-curve-getfirstderiv obj (vlax-curve-getparamatpoint obj pnt)))(/ pi 2.0)
- )
- )
- ; thanks to Lee-mac for this defun
- (defun _csv->lst ( str / pos )
- (if (setq pos (vl-string-position 44 str))
- (cons (substr str 1 pos) (_csv->lst (substr str (+ pos 2))))
- (list str)
- )
- )
- (defun drawpt (chain offsetd rl / pt pt2 )
- (setq Pt (vlax-curve-getPointAtDist Obj chain))
- (setq ang (alg-ang Obj Pt))
- (setq pt2 (polar pt ang offsetd))
- (setq pt2 (list (car pt2) (cadr pt2) rl)) ; add z
- (command "point" pt2)
- )
- (defun chofrl ( / fname strval lst)
- (setq Obj (vlax-ename->vla-object (car (entsel "\nSELECT PLINE AS ALIGNMENT >>"))))
- ;(setq fname (open "c:\\acadtemp\\cross.csv" "r"))
- (setq fname (OPEN (getstring "\nEnter file name") "r"))
- (while (setq strval (read-line fname))
- (setq lst (cons (_csv->lst strval) lst))
- (setq chain (atof (nth 0 (nth 0 lst))))
- (setq offsetd (atof (nth 1 (nth 0 lst))))
- (setq rl (atof (nth 2 (nth 0 lst))))
- (drawpt chain offsetd rl)
- (setq lst nil)
- (princ chain)
- )
- (close fname)
- (princ)
- )
- (chofrl)
|