Jump to content

changing global width of a rectangle


Recommended Posts

Guest lesliematt
Posted

I am working on another project, and i want a lisp that will change the global width of a rectangle that the user selects automatically to 0.0625. what is an easy way of doing this??

 

-M

Posted

Here it goes .......

(defun c:DoIt (/ pt width height end)
 (setq pt (getpoint"\nSpecify start point:")
width 0.0625
height (getdist"\nSpecify Height of Rectangle:")
end (list (+ (car pt) width)
	  (+ (cadr pt) height))
)
 
 (vl-cmdf "_.rectangle" pt end )
 (princ)
)

 

Enjoy it .....

 

Regards

 

Tharwat

Posted
Here it goes .......

(defun c:DoIt (/ pt width height end)
 (setq pt (getpoint"\nSpecify start point:")
   width 0.0625
   height (getdist"\nSpecify Height of Rectangle:")
   end (list (+ (car pt) width)
         (+ (cadr pt) height))
   )

 (vl-cmdf "_.rectangle" pt end )
 (princ)
)

 

Enjoy it .....

 

Regards

 

Tharwat

 

Read the request again

Posted
Read the request again

 

so why don't you post your codes instead ...

Posted
so why don't you post your codes instead ...

 

Not meant to make you mad. He wanted to select it is all. I'm still a grasshopper

Posted
Not meant to make you mad. He wanted to select it is all. I'm still a grasshopper

 

I did not get mad, we are just sharing ideas and informations.... :D

 

So no problem at all , And if you take a look at his second thread, you'll find out that was right.

 

Regards

 

Tharwat

Guest lesliematt
Posted
I did not get mad, we are just sharing ideas and informations.... :D

 

So no problem at all , And if you take a look at his second thread, you'll find out that was right.

 

Regards

 

Tharwat

 

Thank you Tharwat, this is what im looking for. i added more detail to my other post. they are related to each other. i am trying different things, but am pretty shaky on the language. if you could add a few comments in your coding, it would help me understand what is happening. Thanks

 

M

Posted
Thank you Tharwat, this is what im looking for. i added more detail to my other post. they are related to each other. i am trying different things, but am pretty shaky on the language. if you could add a few comments in your coding, it would help me understand what is happening. Thanks

 

M

 

Here it is .... friend.

(defun c:DoIt (/ pt width height end)
 (setq pt (getpoint"\nSpecify start point:")		;the start point location
width 0.0625					;width of your desired rectangle
height (getdist"\nSpecify Height of Rectangle:");height of rectangle
end (list (+ (car pt) width)			;the X coordinate for the oppsite point of the start one
	  (- (cadr pt) height))			;the Y coordinate for the oppsite point of the start one
)
 
 (vl-cmdf "_.rectangle" pt end )			;the command which will draw your desired rectangle
 (princ)			
)

 

Regards.

 

Tharwat

Guest lesliematt
Posted
Here it is .... friend.

(defun c:DoIt (/ pt width height end)
 (setq pt (getpoint"\nSpecify start point:")        ;the start point location
   width 0.0625                    ;width of your desired rectangle
   height (getdist"\nSpecify Height of Rectangle:");height of rectangle
   end (list (+ (car pt) width)            ;the X coordinate for the oppsite point of the start one
         (- (cadr pt) height))            ;the Y coordinate for the oppsite point of the start one
   )

 (vl-cmdf "_.rectangle" pt end )            ;the command which will draw your desired rectangle
 (princ)            
)

 

Regards.

 

Tharwat

 

 

Thank you so much. its a 'teach a man to fish' sort of thing.

Posted
:oops: I didn't see that one. My bad
Posted
I am working on another project, and i want a lisp that will change the global width of a rectangle that the user selects automatically to 0.0625. what is an easy way of doing this??

 

-M

 

Pline Width or Width of rectangle?

Guest lesliematt
Posted
Pline Width or Width of rectangle?

 

pline width, check my other thread, it is linked to this one. i need all the help i can get.

 

'making a polyline box using lisp'

Posted

Quick one:

 

(defun c:plWid ( / ss wd )
 (vl-load-com)
 ;; © Lee Mac 2010

 (if (and (setq ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
          (setq wd (getdist "\nSpecify Width: ")))
   (
     (lambda ( i / e )
       (while (setq e (ssname ss (setq i (1+ i))))
         (vla-put-Constantwidth (vlax-ename->vla-object e) wd)
       )
     )
     -1
   )
 )
 (princ)
)

 

Or, Slightly more advanced:

 

(defun c:plWid ( / *error* doc undo ss )
 (vl-load-com)
 ;; © Lee Mac 2010

 (defun *error* ( msg )
   (and undo (vla-EndUndoMark doc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
 )

 (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
 
 (if
   (and
     (ssget "_:L" '((0 . "LWPOLYLINE")))
     (setq *wid*
       (cond
         (
           (getdist
             (strcat "\nSpecify Width <"
               (rtos
                 (setq *wid*
                   (cond ( *wid* ) ( 1.0 ))
                 )
               )
               "> : "
             )
           )
         )
         ( *wid* )
       )
     )
   )
   (progn
     (setq undo (not (vla-StartUndoMark doc)))
     
     (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc))
       (vla-put-ConstantWidth obj *wid*)
     )
     (vla-delete ss)
     (setq undo (vla-EndUndoMark doc))
   )
 )
 
 (princ)
)

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