Jump to content

Recommended Posts

Posted
nestly has got everybody today :roll:. Hey nestly tell us what you have as a keyboard, or do use speech-to-text?

 

I can't type worth a darn. Anytime I get in first is purely luck. :)

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Tyke

    4

  • nestly

    4

  • Cad64

    3

  • khoshravan

    3

Top Posters In This Topic

Posted
Try using the POLYGON command.

 

Command sequence:

 

Command: POLYGON

Enter number of sides : 4

Specify center of polygon or [Edge]: E

Specify first endpoint of edge: Click to select start point on screen

Specify second endpoint of edge: Hold Shift and drag out square

 

Edit: Looks like eldon snuck in while I was typing. :P

 

 

If you draw squares all the time, you could automate the polygon command like so:

 

(defun c:SQ (/)
(command "polygon" "4" "e")
(princ)
)

 

Dear CAD64

 

Thanks for your detailed reply. This is enough for me, a 4 sided polygon with edges.

 

Also other solutions for defining a function or keyboard shortcut is good. Thanks to all folks.

Posted

A slight variation to the theme may be usefull

 

; draw pits with 100mm walls
; by Alan H 2011
(setq oldsnap (getvar "osmode"))
(setq oldlayer (getvar "clayer")) 
(command "_layer" "n" "Design-Drainage-Pits" "c" 4 "Design-Drainage-Pits" "")
(setvar "clayer" "Design-Drainage-Pits")
(setq length (getreal "\nPlease enter length m eg 0.9: "))
(setq width (getreal "\nPlease enter width : "))
(setq pt1 (getpoint "\npick 1st point to place pit : "))
(setq pt2 (getpoint "\nPick 2nd point for orientation"))
(setvar "osmode" 0)
(setq pt7 (getpoint "\Pick pt on pit side : "))
(setq ang (angle pt1 pt2))
(setq ang5 (angle pt2 pt7))
(setq diffang (- ang ang5))
(if (> diffang 1.5707) 
(setq ang2 (- ang 1.570796))
(setq ang2 (+ ang 1.570796))
)
(setq ang3 (+ ang 3.1415926))
(setq ang4 (- ang 1.570796))
(setq pt3 (polar pt1 ang length))
(setq pt4 (polar pt3 ang2 width))
(setq pt5 (polar pt4 ang3 length))

(command "pline" pt1 pt3 pt4 pt5 "c")
(setq pt6 (polar pt1 ang 50.0))
(command "offset" 0.1 pt4 pt6 "")
(setvar "osmode" oldsnap)
(setvar "clayer" oldlayer)
(princ)

Posted
A slight variation to the theme may be usefull

 

; draw pits with 100mm walls
; by Alan H 2011
(setq oldsnap (getvar "osmode"))
(setq oldlayer (getvar "clayer")) 
(command "_layer" "n" "Design-Drainage-Pits" "c" 4 "Design-Drainage-Pits" "")
(setvar "clayer" "Design-Drainage-Pits")
(setq length (getreal "\nPlease enter length m eg 0.9: "))
(setq width (getreal "\nPlease enter width : "))
(setq pt1 (getpoint "\npick 1st point to place pit : "))
(setq pt2 (getpoint "\nPick 2nd point for orientation"))
(setvar "osmode" 0)
(setq pt7 (getpoint "\Pick pt on pit side : "))
(setq ang (angle pt1 pt2))
(setq ang5 (angle pt2 pt7))
(setq diffang (- ang ang5))
(if (> diffang 1.5707) 
(setq ang2 (- ang 1.570796))
(setq ang2 (+ ang 1.570796))
)
(setq ang3 (+ ang 3.1415926))
(setq ang4 (- ang 1.570796))
(setq pt3 (polar pt1 ang length))
(setq pt4 (polar pt3 ang2 width))
(setq pt5 (polar pt4 ang3 length))

(command "pline" pt1 pt3 pt4 pt5 "c")
(setq pt6 (polar pt1 ang 50.0))
(command "offset" 0.1 pt4 pt6 "")
(setvar "osmode" oldsnap)
(setvar "clayer" oldlayer)
(princ)

 

All this long code is for drawing a simple four-sided square?

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