cadsterdyne Posted October 14, 2016 Share Posted October 14, 2016 Hi Cadtutors Could anybody please let me know how to invoke text command so that what ever result i am "princ"ing to command line. i want to be able to paste it on screen through text command, pick a point where the "princ" result is ready to be placed in model space. ;| ARSQ, Area and Perimeter of Rectangle when Length and Width are known Variables len Length of Rectangle wid Width of Rectangle |; (defun c:arsq() (setq len ( getreal "\nEnter Length Of Rectangle \n")) (setq wid ( getreal "\nEnter Widh Of Rectangle \n")) (setq peri (* len wid)) (princ (strcat "\nThe Area Of Rectangle is = " (rtos peri 2 4 ) " Sqm")) (setq are (* 2 (+ len wid))) (princ (strcat "\nThe Perimeter Of Rectangle is = " (rtos are 2 4 ) " Sqm")) (princ) ) Thanks in Advance. Cadsterdyne Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 14, 2016 Share Posted October 14, 2016 This? (defun c:arsq (/ len wid pnt are per) (and (setq len (getreal "\nEnter Length Of Rectangle :")) (setq wid (getreal "\nEnter Widh Of Rectangle :")) (setq are (strcat "The Area Of Rectangle is = " (rtos (* len wid) 2 4) " Sqm")) (setq per (strcat "The Perimeter Of Rectangle is = " (rtos (* 2 (+ len wid)) 2 4) " Sqm")) (princ (strcat "\n" are)) (princ (strcat "\n" per)) (setq pnt (getpoint "\nSpecify text location :")) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 (trans pnt 1 0)) (cons 40 (* (getvar "DIMSCALE") 2.0)) (cons 7 (getvar 'TEXTSTYLE)) (cons 1 (strcat are "\\P" per)) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
cadsterdyne Posted October 14, 2016 Author Share Posted October 14, 2016 Exactly what i meant Tharwat! Thank you so much. I can see the changes you added to the code. as i am a beginner at learning AutoLISP, could you please direct me to some place where i can lookup details about invoking commands? as i see you didnt use command ".text" to accomplish the above requirement. i dont even know if that exist's. or is the right way to go, i want to learn more about code formats for various commands. i hope i am conveying what iam trying to learn. Thanks again. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 14, 2016 Share Posted October 14, 2016 (edited) You are welcome Actually I used the entmake function instead of command call which is better in all cases and specially when you have many object to be created which the factor of speed would force its self in this ring. besides that programming is not a use of command unless you have no better go with your aim of a program. Hit THIS for more information about entmake function. Edited October 14, 2016 by Tharwat words missing added Quote Link to comment Share on other sites More sharing options...
cadsterdyne Posted October 14, 2016 Author Share Posted October 14, 2016 Thank you for the enlightenment Tharwat. Point Noted. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 14, 2016 Share Posted October 14, 2016 Excellent to hear that. Quote Link to comment Share on other sites More sharing options...
samifox Posted October 14, 2016 Share Posted October 14, 2016 You are welcome Actually I used the entmake function instead of command call which is better in all cases and specially when you have many object to be created which the factor of speed would force its self in this ring. besides that programming is not a use of command unless you have no better go your aim of a program. Hit THIS for more information about entmake function. very nice Thaerwat! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted October 14, 2016 Share Posted October 14, 2016 Many thanks samifox for your reply. Highly appreciated. It would be nice of you if you write my name correctly. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 15, 2016 Share Posted October 15, 2016 cadsterdyne when using command there are switches you can use . - _ I am trying to find the details if I remember right the . is language so a German Autocad would see command as just that. Just at command line type LA and see what happens then do -LA An example if using command in lisp often need say -hatch so no dialouge will open and an area is hatched. Quote Link to comment Share on other sites More sharing options...
cadsterdyne Posted October 15, 2016 Author Share Posted October 15, 2016 Just at command line type LA and see what happens then do -LA . Thanks BIGAL i see how that can add to a speedy workflow. Thanks for sharing. Quote Link to comment Share on other sites More sharing options...
cadsterdyne Posted October 15, 2016 Author Share Posted October 15, 2016 Actually I used the entmake function instead of command call which is better in all cases and specially when you have many object to be created which the factor of speed would force its self in this ring. On the lines of Speed in Code found this interesting. (entmake) vs (command) vs (vla-add-) Speed Test!! http://cadpanacea.com/wp/?p=1542 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.