nicnicman Posted May 7, 2010 Posted May 7, 2010 When creating the shutter in the attachment I divided the total height by the number of slats. Then copied each slat all the way down the shutter. There must be a faster way to do this! Is there a command that will divide an area into a specific number of parts? This would be a huge time saver for me and I thank anyone with suggestions. Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 Sorry I forgot to attach the image at first. It's there now. How would you go about using the DIVIDE command for creating the slats in a shutter. I just tried the command but it didn't seem to be working for me. Quote
Lee Mac Posted May 7, 2010 Posted May 7, 2010 If the slat is a block, you could use either DIVIDE or MEASURE (whichever suits your situation), and select the 'block' option. Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 I have to go eat dinner but I'll try it right after. Thanks a lot! Quote
Lee Mac Posted May 7, 2010 Posted May 7, 2010 You're welcome I'm sure someone more knowledgeable than I will stop by and clarify anything I've missed. Quote
Lee Mac Posted May 7, 2010 Posted May 7, 2010 Oh forgot, Alan wrote this a while back - it could help. If you need help running it, check the link in my sig Lee Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 Just tried again with the slat as a block but I was getting some funny results. I'll try your link to see if it helps. Quote
Lee Mac Posted May 7, 2010 Posted May 7, 2010 This is how I might approach it: The number of segments is of course the number of slats + 1 Quote
Car5858 Posted May 7, 2010 Posted May 7, 2010 You can also use the array command and plug in the values. Row X Column 1 Preview before accpting. Quote
Lee Mac Posted May 7, 2010 Posted May 7, 2010 Silly me - I knew I would see past the obvious... thanks Car Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 @ LeeMac The problem with that method is that it doesn't adjust the slats to different size shutters. Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 @ LeeMac The problem with that method is that it doesn't adjust the slats to different size shutters. The same with the array method. It would be very convenient if you could just type in the number of slats to fit in a given rectangle, and the command would do the division. Quote
Lee Mac Posted May 7, 2010 Posted May 7, 2010 How about something like this? (defun c:slat ( / line p1 p2 p3 n i pi/2 ) ;; Lee Mac ~ 08.05.10 (defun line (s e) (entmakex (list (cons 0 "LINE") (cons 10 s) (cons 11 e) ) ) ) (if (and (setq p1 (getpoint "\nPick First Corner Point: ")) (setq p2 (getcorner "\nPick Second Point: " p1)) (setq n (getint "\nSpecify Number of Slats: "))) (progn (setq i (/ (- (cadr p2) (cadr p1)) n) pi/2 (/ pi 2.) p3 (cons (car p2) (cdr p1))) ( (lambda ( j ) (repeat (1- n) (apply (function line) (mapcar (function (lambda ( point ) (trans point 1 0) ) ) (list (polar p1 pi/2 (* (setq j (1+ j)) i)) (polar p3 pi/2 (* j i)) ) ) ) ) ) 0 ) ) ) (princ) ) Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 Yes! Exactly like that. That's great! I really wish I knew how to program in Lisp Quote
Car5858 Posted May 7, 2010 Posted May 7, 2010 Knew you would come up with a good lisp Lee, sometimes we just need to be redirected a bit. Thanks Quote
nicnicman Posted May 7, 2010 Author Posted May 7, 2010 This will also work great for the window grids too! Quote
Lee Mac Posted May 8, 2010 Posted May 8, 2010 This will also work great for the window grids too! Excellent Quote
Lee Mac Posted May 8, 2010 Posted May 8, 2010 With the help of ObjectARX we can create a Dynamic Version ;; An example of Dynamic Slat creating using a grRead substitute, ;; Function by Lee Mac, using DynDraw by Alexander Rivilis (defun c:slat ( / line vers step bit v n p1 p2 p3 pi/2 i prev ) ;; Lee Mac ~ 08.05.10 (vl-load-com) (defun line (s e) (entmakex (list (cons 0 "LINE") (cons 10 s) (cons 11 e) ) ) ) (setq vers '((18.0 . "2010") (17.2 . "2009") (17.1 . "2008") (17.0 . "2007") (16.2 . "2006") (16.1 . "2005") (16.0 . "2004") (15.6 . "2002")) ) (setq step 1e-6 bit (if (eq "X86" (strcase (getenv "PROCESSOR_ARCHITECTURE") ) ) "x32" "x64" ) ) (cond ( (not (setq v (cdr (assoc (atof (getvar 'ACADVER) ) vers ) ) ) ) (princ "\n** Not Compatible in this Version **") ) ( (not (and (setq n (getint "\nSpecify Number of Slats: ") ) (setq p1 (getpoint "\nPick First Corner Point: ") ) ) ) (princ "\n*Cancel*") ) ( (and (null dyndraw) (not (arxload (strcat "DynDraw" v (if (eq "2010" v) bit "") ".arx" ) ) ) ) (princ "\n** Arx File not Found **") ) ( (vl-acad-defun 'UpdateSlatCallBack) (setq p2 (dyndraw "UpdateSlatCallBack" "\nPick Second Point [Number] : " "Number" (+ 1 2 128 2048) -1 nil ) ) (redraw) (if (vl-consp p2) (progn (setq i (/ (- (cadr p2) (cadr p1)) n) pi/2 (/ pi 2.) p3 (cons (car p2) (cdr p1))) ( (lambda ( j ) (repeat (1- n) (apply (function line) (mapcar (function (lambda ( point ) (trans point 1 0) ) ) (list (polar p1 pi/2 (* (setq j (1+ j)) i)) (polar p3 pi/2 (* j i)) ) ) ) ) ) 0 ) ) ) ) ) (princ) ) (defun UpdateSlatCallBack ( argument / tmp ) (cond ( (eq 'STR (type argument)) (redraw) (if (eq "Number" argument) (if (setq tmp (getint "\nSpecify Number of Slats: ") ) (setq n tmp) ) (princ "\n** Invalid Keyword **") ) (setq argument t) ) ( (vl-consp argument) (or prev (setq prev argument)) (if (< step (distance prev argument)) (progn (setq prev argument p2 argument) (setq i (/ (- (cadr p2) (cadr p1)) n) pi/2 (/ pi 2.) p3 (cons (car p2) (cdr p1)) p4 (cons (car p1) (cdr p2))) (redraw) (grvecs (cons -3 (list p1 p3 p3 p2 p1 p4 p4 p2))) ( (lambda ( j ) (repeat (1- n) (grvecs (cons -30 (list (polar p1 pi/2 (* (setq j (1+ j)) i)) (polar p3 pi/2 (* j i)) ) ) ) ) ) 0 ) ) ) ) ) argument ) You will need the correct version of DynDraw by Alexander Rivilis, here. Lee 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.