Guest lesliematt Posted July 9, 2010 Share Posted July 9, 2010 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 9, 2010 Share Posted July 9, 2010 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 Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted July 9, 2010 Share Posted July 9, 2010 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 9, 2010 Share Posted July 9, 2010 Read the request again so why don't you post your codes instead ... Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted July 9, 2010 Share Posted July 9, 2010 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 9, 2010 Share Posted July 9, 2010 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.... So no problem at all , And if you take a look at his second thread, you'll find out that was right. Regards Tharwat Quote Link to comment Share on other sites More sharing options...
Guest lesliematt Posted July 9, 2010 Share Posted July 9, 2010 I did not get mad, we are just sharing ideas and informations.... 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 9, 2010 Share Posted July 9, 2010 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 Quote Link to comment Share on other sites More sharing options...
Guest lesliematt Posted July 9, 2010 Share Posted July 9, 2010 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. Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted July 9, 2010 Share Posted July 9, 2010 I didn't see that one. My bad Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 9, 2010 Share Posted July 9, 2010 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? Quote Link to comment Share on other sites More sharing options...
Guest lesliematt Posted July 9, 2010 Share Posted July 9, 2010 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' Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 9, 2010 Share Posted July 9, 2010 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) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.