Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/15/2021 in all areas

  1. This is a slight change to what Ronjonp provided. (defun c:foo (/ o s spc) (if (setq s (ssget ":L" '((0 . "dimension")))) (progn (setq spc (getreal "\nEnter spacing eg 100 ")) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq n (/ (vla-get-measurement (setq o (vlax-ename->vla-object e))) spc)) (vla-put-textoverride o (strcat (rtos n 2 0) (strcat "x" (rtos spc 2 0)))) ) ) ) (princ) ) If you have fixed values could do like this can have more values its a library routine. 3 lines of code to make.
    1 point
  2. Here's another for fun .. works pretty well on geometry with many internal islands but doesn't do the self intersecting areas. (defun c:foo (/ a d e mp n o p p2 s x) ;; RJP » 2021-05-13 (setq d 0.075) (if (setq s (ssget "_X" '((0 . "LWPOLYLINE")))) (progn (setq s (mapcar 'cadr (ssnamex s))) (setq s (mapcar '(lambda (e) (list e (vlax-curve-getarea e))) s)) (setq s (mapcar 'car (vl-sort s '(lambda (r j) (< (cadr r) (cadr j)))))) (while (cadr s) (setq e (car s)) (setq s (cdr s)) (repeat (setq n (fix (vlax-curve-getendparam e))) (setq p (vlax-curve-getpointatparam e (- n 0.5))) (if (= 0 (vla-getbulge (vlax-ename->vla-object e) (fix (- n 0.5)))) (progn (setq a (mapcar '(lambda (x) (list (setq p2 (vlax-curve-getclosestpointto x p)) (distance p p2) e) ) s ) ) (setq a (vl-sort a '(lambda (r j) (< (cadr r) (cadr j))))) (cond ((< (cadar a) d) (grdraw (caar a) p 3) (setq o (vlax-ename->vla-object (last (car a)))) (setq mp (mapcar '/ (mapcar '+ (caar a) p) '(2 2 2))) (entmakex (list '(0 . "CIRCLE") (cons 10 mp) (cons 40 (/ (distance (caar a) p) 2)) '(62 . 3) ) ) (entmakex (list '(0 . "TEXT") '(100 . "AcDbEntity") '(8 . "DiameterText") '(100 . "AcDbText") '(62 . 1) (cons 10 mp) (cons 40 (/ (distance (caar a) p) 4)) (cons 1 (vl-string-right-trim "0" (strcat "%%C" (rtos (distance (caar a) p) 2 4))) ) '(50 . 0.) '(7 . "Standard") '(71 . 0) '(72 . 1) (cons 11 mp) '(100 . "AcDbText") '(73 . 2) ) ) ) ) ) ) (setq n (1- n)) ) ) ) ) ) (vl-load-com)
    1 point
×
×
  • Create New...