本帖最后由 夏生生 于 2022-4-4 15:55 编辑
可以看看vlax-curve-getfirstderiv函数
- (defun c:tt (/ en f i lst n pt pt1 pt1a pt2 pt2a ss)
- (setq ss (ssget '((0 . "arc"))))
- (repeat (setq i (sslength ss))
- (setq en (ssname ss (setq i (1- i)))
- pt1 (vlax-curve-getstartpoint en)
- pt1a (mapcar '+
- pt1
- (vlax-curve-getfirstderiv
- en
- (vlax-curve-getparamatpoint en pt1)
- )
- )
- pt2 (vlax-curve-getendpoint en)
- pt2a (mapcar '-
- pt2
- (vlax-curve-getfirstderiv
- en
- (vlax-curve-getparamatpoint en pt2)
- )
- )
- pt (trans (inters pt1 pt1a pt2 pt2a nil) 0 1)
- n (itoa (1+ i))
- lst (cons (strcat n
- ","
- (rtos (car pt) 2 3)
- ","
- (rtos (cadr pt) 2 3)
- ","
- (rtos (cdr (assoc 40 (entget en))) 2 3)
- )
- lst
- )
- )
- (entmake
- (list '(0 . "circle") (cons 10 (trans pt 1 0)) (cons 40 1))
- )
- (entmake (list '(0 . "text")
- '(100 . "AcDbEntity")
- '(100 . "AcDbText")
- (cons 10 (trans pt 1 0))
- (cons 1 n)
- (cons 40 1)
- )
- )
- )
- (setq f (open "d:\\1.csv" "w"))
- (foreach n lst
- (write-line n f)
- )
- (close f)
- )
|