Leika Posted May 22, 2022 Posted May 22, 2022 Hello all, I found this code from alanjt. It draw an arc that i want to use for my doors. Works fine for me and happy, but how can i change the color when draw the arc? Does anyone have an example of how to do it with entmake? (if (and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint "\nSpecify end point: ")) (setq rad (getreal "\nSpecify radius: ")) ) (command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad) ) Thank you very much to read my problem! Quote
Isaac26a Posted May 22, 2022 Posted May 22, 2022 35 minutes ago, Leika said: Works fine for me and happy, but how can i change the color when draw the arc? Well you can add this line to the code (if (and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint "\nSpecify end point: ")) (setq rad (getreal "\nSpecify radius: ")) ) (command "_.color" 1) ;; 1-Red or choose the one you want 2-yellow 3-green ... (command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad) ) Quote
Leika Posted May 22, 2022 Author Posted May 22, 2022 Thank you very much Isaac! This will be my plan b I was looking for something like this, but unfortunately doesn't work : (defun arc_ (rad p1 p2) (entmakex (list '(0 . "ARC") ;(cons 10 cen) (cons 40 rad) (cons 50 p1) (cons 51 p2) (cons 62 1) ) ) ) (defun c:ZZ ( / cen rad sAng eAng) (if (and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint "\nSpecify end point: ")) (setq rad (getreal "\nSpecify radius: ")) ) (arc_ p1 p2 rad) ;(progn ; (command "_.color" 1) ;; 1-Red or choose the one you want 2-yellow 3-green ... ; (command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad) ; (command "_.color" "ByLayer") ;) ) ) (c:ZZ) Quote
Steven P Posted May 22, 2022 Posted May 22, 2022 So in your code the line (arc_ p1 p2 rad) should be (arc_ rad p1 p2), however I think cons 50 and 51 should be angles? See this from Lee Mac, ' http://lee-mac.com/3pointarccircle.html#3parc ' to create a 3 point arc, you will need to use the 3 point circle LISP and 3 point arc LISP to make it work. I would be tempted to use this routine and change your method to selecting the 3 points rather than selecting 2 points with the mouse and then entering a number with the keyboard if that works for you? Quote
BIGAL Posted May 23, 2022 Posted May 23, 2022 A door between 2 points can have 4 answers as you have left right and top bottom. Adding say a rad that is -ve is not a bad idea so will add arc n other side. There is a dynamic door block with all 4 answers built in will see if can find. Some one else may post before me. Quote
Leika Posted May 23, 2022 Author Posted May 23, 2022 I initially used different door blocks. What later switched to an arc is entered with point1 point2 and radius. A little later I wanted to be able to color the arc and I have now succeeded with that code from expert Lee Mac. The code here is just an example of what I wanted to achieve because I break the walls to put the doors in there and everything goes as planned! (Photo attachment) It remains for me to thank you both! 1 Quote
Leika Posted May 24, 2022 Author Posted May 24, 2022 This was also an opportunity to keep the code simple. (command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad) (command "_.chprop" "_last" "" "_color" 9 "") 1 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.