Lt Dan's legs Posted May 19, 2010 Posted May 19, 2010 I'm looking for a simple lisp that puts a block (name: corner) in all corners of a rectangle. it needs to turn with the box. the block is at 0º in the upper left hand corner. I know there's something out there like this but I couldn't find it. Quote
Lee Mac Posted May 19, 2010 Posted May 19, 2010 In the language of pseudocode... Prompt for Block Selection [selection/getstring ~ check validity (findfile)] Prompt for box Selection (check object validity) Get Vertices of Box (dxf group code 10 - multiple entries) Sort Points by x then y, or vice versa and insert block with correct rotation at each point. (Alternatively, perhaps get First Derivative of curve near vertex to determine rotation. Quote
alanjt Posted May 19, 2010 Posted May 19, 2010 Haha nice one Alan You're such a tease lol HaHa, thanks. I was looking for Gile's Clockwise routine, but then I remembered I could just use the formula to check the area of a triangle (given 3 points), so I just used that. Quote
Lt Dan's legs Posted May 19, 2010 Author Posted May 19, 2010 It goes along with the the code you helped me with the first time. When I create this I want the corners to fill in. I'd like them to come in automatically but if I have to select them than that's fine (defun c:COMP1 (/ blockname p1 p2 d d1) ;; modified by Reid b. (vl-load-com) (setq blockname "1compartment") (if (and (or (tblsearch "block" blockname) (findfile (strcat blockname ".dwg")) (alert (strcat blockname " cannot be found!")) ) (setq p1 (getpoint "\nSpecify block insertion point: ")) (setq d (getdist p1 "\nSpecify box width: ")) (setq d1 (getdist p1 "\nSpecify box length: ")) ) ((lambda (block) (foreach x (vlax-invoke block 'GetDynamicBlockProperties) (cond ((eq (vla-get-propertyname x) "DISTANCE") (vla-put-value x (cond ((>= 0.125 (/ d 0.125)) 0.125) ((< 0.125 (setq num (/ d 0.125))) (* 0.125 (fix num))) (0.125) ) ) ) ((eq (vla-get-propertyname x) "DISTANCE1") (vla-put-value x (cond ((>= 0.125 (/ d1 0.125)) 0.125) ((< 0.125 (setq num (/ d1 0.125))) (* 0.125 (fix num))) (0.125) ) ) ) ) ) (vl-catch-all-apply (function (lambda () (vla-explode block) (vla-delete block)))) ) (vla-insertblock (if (or (eq acmodelspace (vla-get-activespace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (eq :vlax-true (vla-get-mspace *AcadDoc*)) ) (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*) ) (vlax-3d-point (trans p1 1 0)) blockname 1. 1. 1. 0. ) ) ) (princ) ) http://www.cadtutor.net/forum/showthread.php?t=47619 Quote
alanjt Posted May 19, 2010 Posted May 19, 2010 It's really nice of you to completely remove my name from my code. Quote
Lt Dan's legs Posted May 19, 2010 Author Posted May 19, 2010 It's really nice of you to completely remove my name from my code. I copied this code from http://www.cadtutor.net/forum/showthread.php?t=47619&page=4 I thought I selected all but I guess I missed it. Look at comment #38 I promise your name is on this code. I've never claimed to know lisp I did clip out (angle (trans p1 1 0) (trans p2 1 0)) ;; modified by Reid b. Quote
Lt Dan's legs Posted May 19, 2010 Author Posted May 19, 2010 Could you point me to the right thread? 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.