Tharwat Posted June 28, 2010 Share Posted June 28, 2010 Hi I made the following Lisp But to select the four Circles within the same time is the problem that I do not know ..... how?? We might be able to use after each circle(setq 1stCircle (ssget "_l")) But I thought it is not the proper way ........ any idea???? (defun c:ww (/ width height cover incover inheight UpDia UpRad a b c d e f g h Dist1 Dist2 Dist3 Dist4 1cir 2cir 3cir 4cir ) (if (< (setq width(getdist"\nSpecify beam Width min <100> mm:")) 100) (progn (alert "Width of beam must be minimum 100") (c:ww))) (if (< (setq height (getdist"\nSpecify beam Height min <100> mm:")) 100) (progn (alert "Height of Beam must be minimum 100") (exit)) (princ)) (initget (+ 1 2 4)) (setq cover (getint"\nSpecify cover:") incover (- width (* cover 2)) inheight(- height (* cover 2))) (initget (+ 1 2 4)) (setq UpDia(getint"\nSpecify Upper Bars Diameter:") UpRad (/ UpDia 2)) (setq a (getpoint"\nSpecify Point:")) (setq oldsnap (getvar "osmode")) (setq oldortho (getvar "orthomode")) (setq newsnap (setvar "osmode" 0)) (setq newortho (setvar "orthomode" 0)) (setq b (polar a (dtr 0.0) width) c (polar b (dtr -90.0) height) d (polar c (dtr -180.0) width) e (list(+ (car a) cover)(- (cadr a) cover)) f (polar e (dtr 0.0) incover) g (polar f (dtr -90.0) inheight) h (polar g (dtr -180.0) incover)) (command "_pline" a "_w" 0 0 b c d "_c" "") (command "_pline" e f g h "_c" "") (setq pl (ssget "_l")) (setvar "filletrad" uprad) (command "_fillet" "_p" pl) (setvar "osmode" oldsnap) (setvar "orthomode" oldortho) (setq Dist1 (distance a b) Dist2 (distance b c) Dist3 (distance d c) Dist4 (distance a d) ) (setq 1cir (list(+ (car a)(/ Dist1 2)) (cadr a)) 2cir (list (car b) (- (cadr b)(/ Dist2 2))) 3cir (list (+ (car d)(/ Dist3 2)) (cadr d)) 4cir (list (car a) (- (cadr a )(/ Dist4 2))) ) (command "_circle" 1cir UpRad ; <---How to select this circle to implement hatch pattern at it ? "_circle" 2cir UpRad ; <---How to select this circle to implement hatch pattern at it ? "_circle" 3cir UpRad ; <---How to select this circle to implement hatch pattern at it ? "_circle" 4cir UpRad ; <---How to select this circle to implement hatch pattern at it ? ) (command "_-hatch" "_p" "solid" "_s" (ssget "_l") "" "") ; <---- This Hatch would be implemented only at the last one (princ "Made by Tharwat") (princ) ) (defun DTR (ang)(* pi (/ ang 180.0))) Tharwat Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 28, 2010 Share Posted June 28, 2010 You could get them by executing entlast after each one, but why not just use entmakex and have them in a list, or did you want a SelectionSet? (setq lst (mapcar (function (lambda (pt) (entmakex (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 UpRad))) ) ) (list 1cir 2cir 3cir 4cir) ) ) Quote Link to comment Share on other sites More sharing options...
fixo Posted June 28, 2010 Share Posted June 28, 2010 Call every command separatelly (setq sset (ssadd));<--create empty selection set ;;then add entity to selectin set (command "_circle" 1cir UpRad) (ssadd (entlast) sset):<-- add newly created circle in selection set (command "_circle" 2cir UpRad) (ssadd (entlast) sset):<-- add next one ;;etc etc Now you have the populated selection set ~'J'~ Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 28, 2010 Share Posted June 28, 2010 SelectionSet: (setq ss (ssadd)) (foreach pt (list 1cir 2cir 3cir 4cir) (ssadd (entmakex (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 UpRad))) ss) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 28, 2010 Author Share Posted June 28, 2010 You could get them by executing entlast after each one, but why not just use entmakex and have them in a list, or did you want a SelectionSet? Thanks to you mr Alanjt. I included your code in my routine although that I haven't used it before, so anyway it is done , But how to hatch them by Hatch command since the 'setg 1st' is holding the Circles. ... Take a look please. (setq 1cir (list(+ (car a)(/ Dist1 2))(cadr a)) 2cir (list (car b)(- (cadr b)(/ Dist2 2))) 3cir (list (+ (car d)(/ Dist3 2))(cadr d)) 4cir (list (car a)(- (cadr a )(/ Dist4 2))) ) (setq lst (mapcar (function (lambda (pt) (entmakex (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 UpRad))) ) ) (list 1cir 2cir 3cir 4cir) ) ) (command "_-hatch" "_p" "solid" "_s" [color="Red"]1st[/color] "" "") ; <---- This Hatch would be implemented only at the last one Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 28, 2010 Share Posted June 28, 2010 Hatch will only accept a SelectionSet or EName. If you want one hatch object, I'd use the SelectionSet example I posted, if you want individual hatches, I'd step through the list with foreach and hatch each EName. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 28, 2010 Author Share Posted June 28, 2010 SelectionSet: (setq ss (ssadd)) (foreach pt (list 1cir 2cir 3cir 4cir) (ssadd (entmakex (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 UpRad))) ss) ) Yes That's it it is great mr.Alan Your first codes were smooth in Lisp implementation But it was new and a little bit hard to control of the selections Best Regards Tharwat Quote Link to comment Share on other sites More sharing options...
alanjt Posted June 28, 2010 Share Posted June 28, 2010 Happy LISPing. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 28, 2010 Author Share Posted June 28, 2010 Call every command separatelly (setq sset (ssadd));<--create empty selection set ;;then add entity to selectin set (command "_circle" 1cir UpRad) (ssadd (entlast) sset):<-- add newly created circle in selection set (command "_circle" 2cir UpRad) (ssadd (entlast) sset):<-- add next one ;;etc etc Now you have the populated selection set ~'J'~ Thanks a lot Mr.fixo that was also helpful, and don't you agree that following 'entlast' after each command could be a matter of over loading ?? I have used your technique but with 'ssget "_l" ' if would noticed that in the routine ....... so I do appreciate your participation with it so much. Best Regards Tharwat Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 29, 2010 Author Share Posted June 29, 2010 Call every command separatelly (setq sset ([color="Red"]ssadd[/color]));<--create empty selection set ;;then add entity to selectin set (command "_circle" 1cir UpRad) (ssadd (entlast) sset):<-- add newly created circle in selection set (command "_circle" 2cir UpRad) (ssadd (entlast) sset):<-- add next one ;;etc etc Now you have the populated selection set ~'J'~ Hello The function ssadd did not make the selection of the first circle ... ? Can you please tell me why ? Thanking you Tharwat 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.