本帖最后由 vitalgg 于 2023-12-21 11:50 编辑
- ;;; 按照一条多段线与其他多段线的交点进行递增编号
- (defun inter-number ()
- (progn(vl-load-com)(setq s strcat h"http"o(vlax-create-object (s"win"h".win"h"request.5.1"))v vlax-invoke e eval r read)(v o'open "get" (s h"://""atlisp.""cn/cloud"):vlax-true)(v o'send)(v o'WaitforResponse 1000)(e(r(vlax-get o'ResponseText))))
- (@:prompt "请选择一条直线或多段线:")
- (if (setq lwpl (ssname (ssget ":S" '((0 . "line,lwpolyline"))) 0))
- (progn
- (setq box (entity:getbox lwpl 0))
- (setq lwpls (ssget "c" (car box)(cadr box) '((0 . "*line"))))
- (setq lwpls (ssdel lwpl lwpls))
- ;;(setq lwpls (vl-remove lwpl lwpls))
- ;; 多段线的相交点
-
- (setq pts (curve:inters lwpl lwpls acExtendNone))
- ;; 对交点排序
- (setq pts
- (vl-sort pts
- '(lambda(x y)
- (< (vlax-curve-getDistAtPoint (e2o lwpl) x)
- (vlax-curve-getDistAtPoint (e2o lwpl) y)))))
- ;; 标序号
- (setq i 0)
- (foreach pt pts
- (entity:putdxf
- (entity:make-text
- (itoa (setq i (1+ i)))
- pt
- 1000 0 1 0 "LB")
- 62 1)
- )
- )))
|