Jump to content

Recommended Posts

Posted

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!

Posted
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)
    )

 

Posted

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)

 

Posted

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?

 

 

Posted

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.

Posted

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! 🥰

DOORS.thumb.jpg.3e7850a43ee96742af3f4242d422b28d.jpg

  • Like 1
Posted

This was also an opportunity to keep the code simple.

 

(command "_.arc" "_non" p1 "_e" "_non" p2 "_radius" rad)
(command "_.chprop" "_last" "" "_color" 9 "")

 

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...