macro or lisp to auto insert blocks at center of part and just inside the midpoint of surrounding line segments based on layer or pin color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm looking for a macro or LISP, now on LT 2024, to auto insert consecutive number blocks for each part selected at center of part and label the edges with blocks just on the inside at (4"or so for 2" block) from the midpoint of surrounding line segments based on layer or pin color of that segment. also auto dimension just outside of each segment at (3" to 4").
I made a macro to insert the numbers consecutively and explode them 1,2,3... as you place them. ^C^C_-layer;s;0;;_-insert;1A;\;;;_x;l;_-insert;2A;\;;;_x;l;... I have a LISP that works very similar to what I am looking for, but I'm rephrasing my question with hopefully more details to get my point as clearly as I can. The reason for the blocks that look like text is for a laser projector on a CNC. I'm going to add the LISP I currently have, created by Sea-Haven, below the image.
(defun c:wow ( / oldsnap ) ;The dtr function converts degrees to radians ;The rtd function converts radians to degrees (defun dtr (a) (* pi (/ a 180.0)) ) ; (defun rtd (a) (/ (* a 180.0) pi) ) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setvar 'angbase 0) (setvar 'textstyle "Standard") (command "bpoly" (getpoint "\nPick point inside ") "") (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (entlast))))) (setq co-ord (cons (last co-ord) co-ord)) (command "erase" (entlast) "") (repeat (setq x (- (length co-ord) 1)) (setq pt1 (nth x co-ord) pt2 (nth (- x 1) co-ord)) (setq mp (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5))) (setq ang (angle pt1 pt2)) (setq ent (entget (ssname (ssget mp) 0))) (setq lay (cdr (assoc 8 ent))) (command "text" mp 2.5 (rtd (- ang (/ pi 2.))) lay) (princ (strcat "\n" (rtos ang 2 4))) (setq x (1- x)) ) (setvar 'osmode oldsnap) (princ) ) (c:wow)