SergiuDSD Posted May 4, 2020 Posted May 4, 2020 Hello, It might be a dumb question for you but I have some troubles with this So. I have to do this draw with that command and I dont know how to write it Attached you have what I've done and the screenshot of entire draw. The only thing that I dont know is that pollar array comand. Can you help me please? https://imgur.com/a/8EoGJiE And here is the code of what ive done untill now ; adaptare valori variabile de sistem (setq cmdc (getvar "cmdecho") attd (getvar "attdia") osmd (getvar "osmode")) (setvar "cmdecho" 0) (setvar "attdia" 1) (setvar "osmode" 0) ; introducere date de intrare (initget 1 ) (setq p1 (getpoint "\nIndica punctul de insertie: ")) (initget 3) (setq L (getreal "\nIntrodu valoarea lungimii minim 100 (mm): ")) (initget 3) (setq H (getreal "\nIntrodu valoarea lungimii minim 100 (mm): ")) ;definire puncte caracteristice desen (setq p2 (list (+ (car p1) L) (+ (cadr p1) H)) p3 (list (+ (car p1) 1.6 (* 0.06 L)) (+ (cadr p1) 1.6 (* 0.053 H))) p4 (list (+ (car p1) (* 0.2 L)) (+ (cadr p1) (* 0.344 H))) p5 (list (+ (car p1) (* 0.3 L)) (+ (cadr p1) (* 0.52 H))) p6 (list (+ (car p1) (* 0.08 L)) (+ (cadr p1) (* 0.8 H))) p7 (list (+ (car p1) 2.5 (* 0.6 L)) (+ (cadr p1) 2.5(* 0.85 H))) p8 (list (+ (car p1) (* 0.72 L)) (+ (cadr p1) (* 0.12 H))) p9 (list (+ (car p1) (* 0.6 L)) (+ (cadr p1) (* 0.595 H))) ) ;desenare piesa (command "rectangle" p1 p2 "circle" p3 1.6 "-array" "L" "" "R" "1" "5" (* 0.048 H) "rectangle" p4 "D" "60" "10" p2 "arc" p6 "e" (list (+ (car p6) 20) (cadr p6 )) "A" "-180" "arc" p8 "e" (list (+ (car p8) 20) (cadr p8)) "A" "-180" "line"p6 (list (+(car p6) 20) (cadr p6))"" "line"p8 (list (+(car p8) 20) (cadr p8))"" "polygon" "4" p7 "C" "2.5" "-array" "L" "" "P" "1" "5" (* 0.85) "180" "Y" "line" p5 "@0,10" "@10,0" "@0,-2.5" "@20,0" "" "line" p5 "@10,0" "@0,2.5" "@20,0" "" "arc" p9 "e" (list (car p9) (- (cadr p9) 5)) "A" "-180") "" Quote
hanhphuc Posted May 5, 2020 Posted May 5, 2020 (edited) Quote So. I have to do this draw with that command and I dont know how to write it Attached you have what I've done and the screenshot of entire draw. The only thing that I dont know is that pollar array comand. Can you help me please? you need to calculate polar radial center, 360/6= 60d for each sector. chord = 2r sin 60d base on your previous 100x100 example, using radii= 11.0794 i'm not used to command input, i merely modified the -array part just like entering in command line if it does not work, trial & error (defun c:tt ( / a attd cmdc h l osmd p1 p2 p3 p4 p5 p6 p7 p8 p9 r) ; adaptare valori variabile de sistem (setq cmdc (getvar "cmdecho") attd (getvar "attdia") osmd (getvar "osmode")) (setvar "cmdecho" 0) (setvar "attdia" 1) (setvar "osmode" 0) ; introducere date de intrare (initget 1 ) (setq p1 (getpoint "\nIndica punctul de insertie: ")) (initget 3) (setq L (getreal "\nIntrodu valoarea lungimii minim 100 (mm): ")) (initget 3) (setq H (getreal "\nIntrodu valoarea lungimii minim 100 (mm): ")) ;definire puncte caracteristice desen (setq p2 (list (+ (car p1) L) (+ (cadr p1) H)) p3 (list (+ (car p1) 1.6 (* 0.06 L)) (+ (cadr p1) 1.6 (* 0.053 H))) p4 (list (+ (car p1) (* 0.2 L)) (+ (cadr p1) (* 0.344 H))) p5 (list (+ (car p1) (* 0.3 L)) (+ (cadr p1) (* 0.52 H))) p6 (list (+ (car p1) (* 0.08 L)) (+ (cadr p1) (* 0.8 H))) p7 (list (+ (car p1) -2.5 (* 0.6 L)) (+ (cadr p1) 2.5(* 0.85 H))) p8 (list (+ (car p1) (* 0.72 L)) (+ (cadr p1) (* 0.12 H))) p9 (list (+ (car p1) (* 0.6 L)) (+ (cadr p1) (* 0.595 H))) a (/ pi 6.0) r (* L 0.110794)) (command "rectangle" p1 p2 "circle" p3 1.6 "-array" "L" "" "R" "1" "5" (* 0.048 H) "rectangle" p4 "D" "60" "10" p2 "arc" p6 "e" (list (+ (car p6) 20) (cadr p6 )) "A" "-180" "arc" p8 "e" (list (+ (car p8) 20) (cadr p8)) "A" "-180" "line"p6 (list (+(car p6) 20) (cadr p6))"" "line"p8 (list (+(car p8) 20) (cadr p8))"" "polygon" "4" p7 "C" "2.5" "-array" "L" "" "P" (mapcar '- p7 (list (* r (cos a)) (* r (sin a))) ) "6" "360" "Y" "line" p5 "@0,10" "@10,0" "@0,-2.5" "@20,0" "" "line" p5 "@10,0" "@0,2.5" "@20,0" "" "arc" p9 "e" (list (car p9) (- (cadr p9) 5)) "A" "-180") (mapcar 'setvar '(cmdecho attdia osmode) (list cmdc attd osmd )) (princ) ) p/s: not sure BCAD's bug? array not not center if polygon objects not rotate. or try activeX method (vla-ArrayPolar mspace NumberOfObjects AngleToFill CenterPoint) Edited May 5, 2020 by hanhphuc defun & new radius Quote
SergiuDSD Posted May 5, 2020 Author Posted May 5, 2020 Sorry but I didnt understand. I tried to write it but doesnt work. Im noob, is my first time when I try to do something in lisp. Is a project for the college and i dont understand anything. I had a model and i adapted from there what ive done untill now. But that pollar array of the squares is not there. The only thing i know is that it should be like first array of the circles. Has to be something like "array" "L" "P" "" but after that i dont know what to write, the order If you look to the image you will see the distance of 0,4L of width and 0,15H of height. There is the squere that i will use for the pollar array, There is the starting point. Maybe it will help you this information Sorry but i cant figured out Quote
hanhphuc Posted May 5, 2020 Posted May 5, 2020 wrap your code in a defun c:tt , look at my previous reply (update) i only edited 3 lines of codes for array the command 1 hour ago, SergiuDSD said: If you look to the image you will see the distance of 0,4L of width and 0,15H of height. There is the squere that i will use for the pollar array, There is the starting point. Maybe it will help you this information at P7 which 2.5 was incorrect, should be 0.4L from the edge P7 (list (+ (car p1) -2.5 (* 0.6 L)) (+ (cadr p1) 2.5 (* 0.85 H))) 0.0781L & 0.4L the radius should be 0.110794L a (/ pi 6.0) r (* L 0.110794)) calculate the polar center relative to 360/6 division "-array" "L" "" "P" (mapcar '- p7 (list (* r (cos a)) (* r (sin a))) ) "6" "360" "Y" 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.