jcalla Posted May 16, 2011 Share Posted May 16, 2011 I am looking for a lisp routine to create an area in a given square feet quantity. Can someone help me out? Thanks, JPC Quote Link to comment Share on other sites More sharing options...
CadEarner Posted May 17, 2011 Share Posted May 17, 2011 Area in which shape? Square, Rectangle, Triangle, Circle, Polygon,etc... please specify. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 17, 2011 Share Posted May 17, 2011 Welcome to CADTutor - In the future, please post your LISP questions in the AutoLISP, Visual LISP & DCL Forum. As for your request... are you looking for a LISP routine to create an object with a specific area, or are you looking to select an object(s) and label the area of said object(s)? Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 17, 2011 Share Posted May 17, 2011 The square root of an area will give you the length of each side of a square. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted May 17, 2011 Share Posted May 17, 2011 Maybe this will get you started.. Quote Link to comment Share on other sites More sharing options...
jcalla Posted June 2, 2011 Author Share Posted June 2, 2011 The shape of the area would be a rectangle. I have a lisp for a circle. It is as follows: ; ----- CTEST.LSP ----- ; Draw circles by area (in square yards) (defun C:CTEST() (setq ar (getreal "AreaSY? ")) (setq ar (* ar 1296)) (setq pt (getpoint "Centerpoint?")) (setq rad (sqrt (/ ar pi))) (command "circle" pt rad) (princ) ) Could this be modified for the area of a rectangle? Thanks, JPC Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 2, 2011 Share Posted June 2, 2011 If its a rectangle then whats the problem the area= L x W you just have to nominate 1 of them then theres lots of ways to draw a rectang simplest would be use RECTANG. (setq pt1 (getpoint "Left lower corner ?")) the (car pt1) = x (cadr pt1) = y add L & W to these values then make a list for new Pt2 (setq pt2 (list (+ ptx L) (+ pty W)))(command "rectang" pt pt2) Quote Link to comment Share on other sites More sharing options...
jcalla Posted June 2, 2011 Author Share Posted June 2, 2011 OK. If the rectang command would prompt me for an area in square feet, then I would be ok. I need a lisp that would prompt me for a start point then ask me for either a lenght or width, then prompt me for the square feet at the given length or width. JPC Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 2, 2011 Share Posted June 2, 2011 RECTANG Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]: Specify other corner point or [Area/Dimensions/Rotation]: A Quote Link to comment Share on other sites More sharing options...
jcalla Posted June 2, 2011 Author Share Posted June 2, 2011 I forgot one thing. I use version R14, so I don't have the option of entering the area using the rectang command which is why I am asking about a lisp routine. JPC Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 2, 2011 Share Posted June 2, 2011 As an imitation of the Rectang command in 2010... (defun c:arec ( / an ar p1 x ) (if (and (setq p1 (getpoint "\nSpecify first corner point: ")) (progn (initget 6) (setq ar (getreal "\nSpecify Area for Rectangle: ")) ) (progn (initget "Length Width") (setq an (getkword "\nCalculate rectangle dimensions based on [Length/Width] <Length>: ")) (if (eq "Width" an) (setq x (getdist "\nSpecify rectangle width: " p1)) (setq x (getdist "\nSpecify rectangle length: "p1)) ) ) ) (command "_.rectang" "_non" p1 "_non" (polar (polar p1 (if (eq "Width" an) 0. (/ pi 2.)) x) (if (eq "Width" an) (/ pi 2.) 0.) (/ ar x) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
jcalla Posted June 2, 2011 Author Share Posted June 2, 2011 Lee Mac On the right path, however the above routine area defaults in square inches. Could you redo your magic to default in square feet? JPC Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 2, 2011 Share Posted June 2, 2011 This? (defun c:arec ( / an ar p1 x ) (if (and (setq p1 (getpoint "\nSpecify first corner point: ")) (progn (initget 6) (setq ar (getreal "\nSpecify Area for Rectangle: ")) ) (progn (initget "Length Width") (setq an (getkword "\nCalculate rectangle dimensions based on [Length/Width] <Length>: ")) (if (eq "Width" an) (setq x (getdist "\nSpecify rectangle width: " p1)) (setq x (getdist "\nSpecify rectangle length: "p1)) ) ) ) (command "_.rectang" "_non" p1 "_non" (polar (polar p1 (if (eq "Width" an) 0. (/ pi 2.)) (* x 12.)) (if (eq "Width" an) (/ pi 2.) 0.) (* 12. (/ ar x)) ) ) ) (princ) ) Edit: went the wrong way with the conversion.. Quote Link to comment Share on other sites More sharing options...
jcalla Posted June 2, 2011 Author Share Posted June 2, 2011 Lee Mac, I get "malformed list " error when I call it up. JPC Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 2, 2011 Share Posted June 2, 2011 Did you copy all the code? Quote Link to comment Share on other sites More sharing options...
jcalla Posted June 2, 2011 Author Share Posted June 2, 2011 Yes sir, I sure did. Your previous code worked fine, but I got the "malformed list "error with this one. JPC 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.