Jump to content

polygon command


cadamrao

Recommended Posts

Try running the command normally making sure to use the desired oprions, then write a LISP that uses the exact same options. When done test.

 

Post your code here if you have any issues.

Link to comment
Share on other sites

need lisp for save time and reduce no.of pick&type

 

ًBring your codes and we will help you with it .

 

My post first is a lisp but without a defun , name , and princ at last, and if you need it continuously you can add while .

Link to comment
Share on other sites

(if (setq p (getpoint "\n Specify center of [color=blue]Triangle[/color]:"))
 (vl-cmdf "_.polygon" 3 p [color=red]"inscribed"[/color] pause)
)

 

@ Tharwat -

 

Polygon with three sides = Triangle. :wink:

 

Also, instead of using an empty string ("") as the option, consider explicitely specifying the desired option as "inscribed." If the user last selected "Circumscribed about circle" the empty string ("") will not return "Inscribed in circle" as desired in the OP. Technically "I", "_i", or others would work too... I simply prefer to spell out the options for clarity when reading the code. I've also seen where the letter options within a command have changed from version to version. Just something to be aware of.

 

Obviously, do what works best for you.

Link to comment
Share on other sites

(defun c:tri (/ point)
 (if (setq point (getpoint "\nSpecify triangle center point: "))
   (command "_.polygon" 3 "_non" point "_inscribed")
 )
 (princ)
)

Link to comment
Share on other sites

Found this a while ago. I don't know where I got it from. It will search your entire drawing and add a circumscribed polygon to the circles. I don't have time right now to try to tweak it for inscribed. So you can try doing that or get help.

; Searches for circles in a drawing and puts circumscribed polygons outside of these circles.
(defun c:polyincirc (/ ss i sset e)
 (if (setq ss (ssget "_x" '((0 . "CIRCLE"))))
   (repeat
     (setq i (sslength ss))
     (setq sset (ssname ss (setq i (1- i))))
     (setq e (entget sset))
     (command "_.polygon" 3 "_non" (cdr (assoc 10 e)) "_c" (cdr (assoc 40 e)))
     )
   (princ "\n No Circle(s) found")
   )
 (princ)
 )

Link to comment
Share on other sites

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...