本帖最后由 vitalgg 于 2024-1-24 09:27 编辑
- (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))))
- (defun c:dimrec ()
- (@:help '("统计矩形行列数并标在左上角。"))
- ;;选矩形
- (setq recs
- (vl-remove-if-not 'curve:rectanglep
- (pickset:to-list (ssget '((0 . "lwpolyline"))))))
- ;;矩形分堆
- (foreach
- box (pickset:cluster (pickset:from-list recs) 100)
- (setq recs
- (vl-remove-if-not 'curve:rectanglep
- (pickset:to-list
- (ssget
- "w" (car box)(cadr box)
- '((0 . "lwpolyline"))))))
- (setq recs (list:sort recs
- '(lambda(x y)
- (>
- (cadar (entity:getbox x 0))
- (cadar (entity:getbox y 0))
- ))))
- (setq grecs (list:group-by recs
- '(lambda(x y)
- (equal
- (cadar (entity:getbox x 0))
- (cadar (entity:getbox y 0))
- 10))))
- (entity:putdxf
- (entity:make-text
- (strcat (itoa(length grecs))
- "x"
- (itoa(length (car grecs))))
- (list (caar box)(cadadr box) 0)
- (* 0.25 (- (nth 1 (cadr box))(nth 1 (car box))))
- 0 0.8 0 "LT")
- 62 1)
- )
- (princ))
|