nicnicman Posted May 7, 2010 Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share Posted May 7, 2010 DIVIDE command? Quote Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share 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 Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share Posted May 7, 2010 I have to go eat dinner but I'll try it right after. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share 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 Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share Posted May 7, 2010 This is how I might approach it: The number of segments is of course the number of slats + 1 Quote Link to comment Share on other sites More sharing options...
Car5858 Posted May 7, 2010 Share Posted May 7, 2010 You can also use the array command and plug in the values. Row X Column 1 Preview before accpting. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share Posted May 7, 2010 Silly me - I knew I would see past the obvious... thanks Car Quote Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share Posted May 7, 2010 @ LeeMac The problem with that method is that it doesn't adjust the slats to different size shutters. Quote Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share 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 Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share Posted May 7, 2010 Yes! Exactly like that. That's great! I really wish I knew how to program in Lisp Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 7, 2010 Share Posted May 7, 2010 Excellent - glad it will save you some time Quote Link to comment Share on other sites More sharing options...
Car5858 Posted May 7, 2010 Share 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 Link to comment Share on other sites More sharing options...
nicnicman Posted May 7, 2010 Author Share Posted May 7, 2010 This will also work great for the window grids too! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 8, 2010 Share Posted May 8, 2010 This will also work great for the window grids too! Excellent Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 8, 2010 Share 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 Link to comment Share on other sites More sharing options...
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.