سبع الليل Posted March 14, 2013 Share Posted March 14, 2013 بسم الله الرحمن الرحيم الحمد لله رب العالمين ، و الصلاة و السلام على أشرف المرسلين ، أشهد أن لا إله إلا الله ، و أن محمداً رسول الله ، و أن عيسى المسيح عبد الله و رسوله و كلمته ألقاها إلى مريم ،، و بعد : Hii Guys and cad msters : I really love you , and happy to join this great forum (command "circle" p1 "d" d1 "") (setq soda ( entlast)) (command "hatch" "s" soda "") (command "array" "l" "" "r" "1" "10" "150" "") This will make an array for a circle along ( + X ) direction What shall I do if i need the array in (-X) direction ,,,, or if i want to specify an angle for the array ?? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2013 Share Posted March 14, 2013 Just add to the number minus mark like this "-150" Good luck . Quote Link to comment Share on other sites More sharing options...
pBe Posted March 14, 2013 Share Posted March 14, 2013 (Defun c:demo (/ soda p1 d1 dir ang) (setq p1 (Getpoint "\nPick point:")) (setq d1 (getdist "\nEnter Circle Diameter size: ")) (setq soda (ssadd)) ;<-- empty selection set (command "circle" p1 "d" d1 "") (ssadd (entlast) soda) ;<--add circle to selection set (command "hatch" "s" soda "") (ssadd (entlast) soda);<--add hatch to selection set ;;; option for direction ;;; (initget 1 "R L") (setq dir (getkword "\nChoose Direction [Left/Right]: ")) ;;; ;;; (command "array" soda "" "r" "1" "10" (if (eq dir "L") (- 150) 150 ) ) (princ) ) Now whats the deal with the "angle" ? polar array angle? or directional angle? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2013 Share Posted March 14, 2013 My approach . (defun c:TesT (/ *error* GrLeader c s p d g pt) ;;; Author : Tharwat Al Shoufi 14. 03. 2013 ;;; (defun *error* (x) (redraw) (princ "\n*Cancel*")) (defun GrLeader (pt d w / p1 p2 p3 p4) (if (eq "R" w) (setq p1 (polar pt (* pi 0.5) (* d 4.)) p2 (polar p1 (/ pi 4.) (* d 4.)) p3 (polar p2 pi d) p4 (polar p2 (* pi 1.5) d) ) (setq p1 (polar pt (* pi 0.5) (* d 4.)) p2 (polar p1 (* (/ pi 4.) 3.) (* d 4.)) p3 (polar p2 0. d) p4 (polar p2 (* pi 1.5) d) ) ) (grvecs (list -1 pt p1 p1 p2 p2 p3 p2 p4)) (princ) ) (setq d 75.) ; Radius of the Circle (if (and (setq s (ssadd) p (getpoint "\n Specify Circle insertion point:") ) (ssadd (setq c (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 d)))) s) ) (progn (command "_.hatch" "s" c "") (ssadd (entlast) s) (while (eq (car (setq g (grread t 15 0))) 5) (redraw) (princ "\r Specify the Direction ") (if (> (car (cadr g)) (car p)) (Grleader p d "R") (GrLeader p d nil) ) ) (cond ((and (eq 3 (car g)) (> (car (cadr g)) (car p))) (command "_.array" s "" "r" "1" "10" 150)) ((and (eq 3 (car g)) (< (car (cadr g)) (car p))) (command "_.array" s "" "r" "1" "10" -150)) (t (princ "*Cancel*")) ) ) ) (redraw) (princ "\n Written by Tharwat Al Shoufi") (princ) ) Quote Link to comment Share on other sites More sharing options...
سبع الليل Posted March 14, 2013 Author Share Posted March 14, 2013 Really :::: This is a great forum Thank you all ,, Every day i learn new something ... (Defun c:demo (/ soda p1 d1 dir ang) (setq p1 (Getpoint "\nPick point:")) (setq d1 (getdist "\nEnter Circle Diameter size: ")) (setq soda (ssadd)) ;<-- empty selection set (command "circle" p1 "d" d1 "") (ssadd (entlast) soda) ;<--add circle to selection set (command "hatch" "s" soda "") (ssadd (entlast) soda);<--add hatch to selection set ;;; option for direction ;;; (initget 1 "R L") (setq dir (getkword "\nChoose Direction [Left/Right]: ")) ;;; ;;; (command "array" soda "" "r" "1" "10" (if (eq dir "L") (- 150) 150 ) ) (princ) ) Now whats the deal with the "angle" ? polar array angle? or directional angle? ssadd is new for me ,,, but really it is a great and very useful & important .... thank you mr pBe very much what i need is the directional angle Quote Link to comment Share on other sites More sharing options...
سبع الليل Posted March 14, 2013 Author Share Posted March 14, 2013 My approach . (defun c:TesT (/ *error* GrLeader c s p d g pt) ;;; Author : Tharwat Al Shoufi 14. 03. 2013 ;;; (defun *error* (x) (redraw) (princ "\n*Cancel*")) (defun GrLeader (pt d w / p1 p2 p3 p4) (if (eq "R" w) (setq p1 (polar pt (* pi 0.5) (* d 4.)) p2 (polar p1 (/ pi 4.) (* d 4.)) p3 (polar p2 pi d) p4 (polar p2 (* pi 1.5) d) ) (setq p1 (polar pt (* pi 0.5) (* d 4.)) p2 (polar p1 (* (/ pi 4.) 3.) (* d 4.)) p3 (polar p2 0. d) p4 (polar p2 (* pi 1.5) d) ) ) (grvecs (list -1 pt p1 p1 p2 p2 p3 p2 p4)) (princ) ) (setq d 75.) ; Radius of the Circle (if (and (setq s (ssadd) p (getpoint "\n Specify Circle insertion point:") ) (ssadd (setq c (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 d)))) s) ) (progn (command "_.hatch" "s" c "") (ssadd (entlast) s) (while (eq (car (setq g (grread t 15 0))) 5) (redraw) (princ "\r Specify the Direction ") (if (> (car (cadr g)) (car p)) (Grleader p d "R") (GrLeader p d nil) ) ) (cond ((and (eq 3 (car g)) (> (car (cadr g)) (car p))) (command "_.array" s "" "r" "1" "10" 150)) ((and (eq 3 (car g)) (< (car (cadr g)) (car p))) (command "_.array" s "" "r" "1" "10" -150)) (t (princ "*Cancel*")) ) ) ) (redraw) (princ "\n Written by Tharwat Al Shoufi") (princ) ) Thank you eng. Tharwat but there is somethings i can't understand it any way i am trying to understand and use Quote Link to comment Share on other sites More sharing options...
pBe Posted March 15, 2013 Share Posted March 15, 2013 thank you mr pBe very much...... what i need is the directional angle If you want to maintain the use of the command ARRAY, you can twist the UCS like so: (Defun c:demo (/ soda p1 d1 dir ang) (setq p1 (Getpoint "\nPick point:")) (setq d1 (getdist p1 "\nEnter Circle Diameter size: ")) (setq d (getdist "\nEnter Distance between circles: ")) (setq it (getint "\nEnter Number of itmes: ")) (setq soda (ssadd)) ;<-- empty selection set (command "circle" p1 "d" d1 "") (ssadd (entlast) soda) ;<--add circle to selection set (command "hatch" "s" soda "") (ssadd (entlast) soda);<--add hatch to selection set (setq p2 (getpoint p1 "\nPick point for direction ")) (command "_UCS" "_3P" p1 p2 "" "") (command "array" soda "" "r" "1" it d ) (command "_ucs" "_World") (princ) ) There's probably an angle prompt on newer version of CAD for array. Or you can use the command COPY: (Defun c:demo2 () (setq p1 (Getpoint "\nPick point:")) (setq d1 (getdist p1 "\nEnter Circle Diameter size: ")) (setq d (getdist "\nEnter Distance between circles: ")) (setq it (getint "\nEnter Number of itmes: ")) (setq soda (ssadd)) (command "circle" p1 "d" d1 "") (ssadd (entlast) soda) (command "hatch" "s" soda "") (ssadd (entlast) soda) (setq p2 (getpoint p1 "\nPick point for direction ")) (setq ang (angle p1 p2)) (repeat it (setq p2 (polar p1 ang d)) (command "_copy" soda "" "_non" p1 "_non" p2) (setq p1 p2) ) ) Both codes doesn't require a negative value for direction at all. play around with the plain and simple snippets until you get the hang of it, then you can start experimenting with codes like the one posted by tharwat. HTH Quote Link to comment Share on other sites More sharing options...
سبع الليل Posted March 16, 2013 Author Share Posted March 16, 2013 If you want to maintain the use of the command ARRAY, you can twist the UCS like so: (Defun c:demo (/ soda p1 d1 dir ang) (setq p1 (Getpoint "\nPick point:")) (setq d1 (getdist p1 "\nEnter Circle Diameter size: ")) (setq d (getdist "\nEnter Distance between circles: ")) (setq it (getint "\nEnter Number of itmes: ")) (setq soda (ssadd)) ;<-- empty selection set (command "circle" p1 "d" d1 "") (ssadd (entlast) soda) ;<--add circle to selection set (command "hatch" "s" soda "") (ssadd (entlast) soda);<--add hatch to selection set (setq p2 (getpoint p1 "\nPick point for direction ")) (command "_UCS" "_3P" p1 p2 "" "") (command "array" soda "" "r" "1" it d ) (command "_ucs" "_World") (princ) ) There's probably an angle prompt on newer version of CAD for array. Or you can use the command COPY: (Defun c:demo2 () (setq p1 (Getpoint "\nPick point:")) (setq d1 (getdist p1 "\nEnter Circle Diameter size: ")) (setq d (getdist "\nEnter Distance between circles: ")) (setq it (getint "\nEnter Number of itmes: ")) (setq soda (ssadd)) (command "circle" p1 "d" d1 "") (ssadd (entlast) soda) (command "hatch" "s" soda "") (ssadd (entlast) soda) (setq p2 (getpoint p1 "\nPick point for direction ")) (setq ang (angle p1 p2)) (repeat it (setq p2 (polar p1 ang d)) (command "_copy" soda "" "_non" p1 "_non" p2) (setq p1 p2) ) ) Both codes doesn't require a negative value for direction at all. play around with the plain and simple snippets until you get the hang of it, then you can start experimenting with codes like the one posted by tharwat. HTH Mr pBe really , you Are awesome great man thank you a lot a lot a lot a lot a lot a lot a lot a lot a lot a lot a lot a lot 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.