Jump to content

Rectangle from midpoint


CadFrank

Recommended Posts

Well you know when you use "getcorner" you kinda see the rectangle.

 

So I'd like to see the rectangle crow from the middle.

 

I've already created a Lisp routine that make a rectangle but with no preview of what it look like.

Link to comment
Share on other sites

Hi,

 

I'd like to know if it is possible to create a rectangle from middlepoint as they do in SolidWorks.

 

Regards.

(if (not

(Command "polygon" ))

;4 sides & circumcised & half radius?

(Tharwat will help )

); end of if

:)

Link to comment
Share on other sites

Consider the following example:

(defun c:crec ( / a b f l p q x z )
   (if (setq p (getpoint "\nSpecify center of rectangle: "))
       (progn
           (setq z (trans '(0 0 1) 1 0 t)
                 f
               (lambda ( a v )
                   (list
                       (mapcar '+ a v)
                       (mapcar '+ a (list (- (car v)) (cadr v)))
                       (mapcar '- a v)
                       (mapcar '+ a (list (car v) (- (cadr v))))
                   )
               )
           )
           (while (= 5 (car (setq q (grread t 13 0))))
               (redraw)
               (setq l (f p (mapcar '- (cadr q) p)))
               (mapcar '(lambda ( a b ) (grdraw a b -1)) (cons (last l) l) l)
           )
           (if (= 3 (car q))
               (entmake
                   (append
                      '(
                           (000 . "LWPOLYLINE")
                           (100 . "AcDbEntity")
                           (100 . "AcDbPolyline")
                           (090 . 4)
                           (070 . 1)
                       )
                       (mapcar '(lambda ( x ) (cons 10 (trans x 1 z))) (f p (mapcar '- (cadr q) p)))
                       (list (cons 210 z))
                   )
               )
           )
       )
   )
   (redraw) (princ)
)

However, the above uses grread, and therefore sacrifices all standard drawing aids (Object Snap, Orthomode, Tracking etc).

Link to comment
Share on other sites

thanks Tharwat me too, im happy need you guys here with sharp eyes 8)

 

@ hanhphuc, I completely forgot about the polygon command :thumbsup:

 

not yet.. command polygon is easy if square rectangle but not irregular L x W

 

...to create a rectangle from middle point as they do in SolidWorks.

Regards.

 

i dunno solidworks, so i would just subscribe here

Link to comment
Share on other sites

However, the above uses grread, and therefore sacrifices all standard drawing aids (Object Snap, Orthomode, Tracking etc).

 

How come you know that much.... what ever we ask, you can code it...

 

Thanks alot

Link to comment
Share on other sites

How come you know that much.... what ever we ask, you can code it...

 

I can't yet write a program to make your coffee - I'll keep working on it though ;)

 

You're welcome Frank :thumbsup:

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