Jim Clayton Posted May 21, 2019 Posted May 21, 2019 I had a thought for a lisp and I'm wondering if maybe something like it already exists. I draw mechanical assemblies with lots of mark bubbles, weld symbols, and other blocks. Using weld symbols as an example: Is there a way to type a command for the block (Weld), then select all the locations that I want to place a weld symbol, hit enter, and have it appear? They're dynamic blocks so once they're in place I would be able to manipulate the weld type but it would eliminate having to insert blocks repeatedly or copying/pasting them. Thanks for the help. Quote
ronjonp Posted May 21, 2019 Posted May 21, 2019 Post a sample drawing. Inserting blocks is quite easy with lisp. Next step is logic to determine what weld goes where. Quote
Jim Clayton Posted May 22, 2019 Author Posted May 22, 2019 Example attached. Excuse the drafting quality, just grabbed something someone did from Vault. Weld symbols are in Red. The idea is type a command, select the points where you would want the blocks, in this case weld symbols, and then insert them at the selected points all at once. sample.dwg Quote
ronjonp Posted May 22, 2019 Posted May 22, 2019 (edited) Give this a try. Inserts block 'weldunder' at midpoint of horizontal sections of leaders. (defun c:foo (/ d p s sc) ;; RJP » 2019-05-22 (cond ((null (tblobjname "block" "WELDUNDER")) (print "Block 'WELDUNDER' not found!")) ((setq s (ssget '((0 . "leader")))) (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (setq d (vlax-ename->vla-object (cdr (assoc 330 (entget (car s)))))) (foreach e s (setq p (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget e)))) (mapcar '(lambda (r j) (if (equal (cadr r) (cadr j) 1e-2) (vla-insertblock d (vlax-3d-point (mapcar '/ (mapcar '+ r j) '(2 2 2))) "WELDUNDER" (setq sc 2.7) sc sc 0 ) ) ) p (cdr p) ) ) ) ) (princ) ) (vl-load-com) Edited May 22, 2019 by ronjonp Quote
Jim Clayton Posted May 22, 2019 Author Posted May 22, 2019 Thanks for the help. For one reason or another it's not recognizing the hatching when I select it. I load the lisp, enter the command, and am prompted to select objects, I select the intended point of placement, and it's not recognizing it...even if I hit enter. I tried generating boundaries around the hatching to give it a defined pick point but that's not doing the trick either. Thoughts? Thanks again. Quote
ronjonp Posted May 22, 2019 Posted May 22, 2019 (edited) 1 hour ago, Jim Clayton said: Thanks for the help. For one reason or another it's not recognizing the hatching when I select it. I load the lisp, enter the command, and am prompted to select objects, I select the intended point of placement, and it's not recognizing it...even if I hit enter. I tried generating boundaries around the hatching to give it a defined pick point but that's not doing the trick either. Thoughts? Thanks again. I misunderstood your intentions. The code above inserts this block at the midpoint of horizontal leader landings which I explained above in my post. Edited May 22, 2019 by ronjonp Quote
Jim Clayton Posted May 23, 2019 Author Posted May 23, 2019 I think I'm looking for something like this, which might be a Lee Mac lisp...but maybe thinned down a bit, or with a search capability rather than entering the block name. But honestly it's a bit of a guessing game right now. pnt2blk.lsp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.