guitarguy1685 Posted November 16, 2009 Posted November 16, 2009 Ok so i'm trying to wright my first autolisp but I've hit a road block. What I want to do is make a lisp that will take the area of an object and mlutiply it by a number then put both numbers into an MText along w/ the perimeter and insert next to the object. What I have written so far is (defun C:AreaP () (command "area" "o" pause) (setq AreaP (getvar Area)) (setq PermP (getvar Perimeter)) (setq AP (* areaP 1.2)) (command "-mtext" pause) (princ AreaP) (princ AP) (princ PermP) (princ) ) The code above is from memory since I'm not at my computer atm. So far it all seems to work except when I get the point where I want the text in the mtext. in the first line of mtext is pastes all the values and then goes to the next line. How can I get each value on a seperate line and complete the mtext command? again thanks in advance. Quote
alanjt Posted November 16, 2009 Posted November 16, 2009 Give this a look: (defun c:AreaP (/ Ent Pnt AreaP PermP AP) (and (setq Ent (entsel "\nSelect object: ")) (setq Pnt (getpoint "\nSpecify MText placement point: ")) (progn (command "_.area" "_o" (car ent)) (setq AreaP (getvar "area") PermP (getvar "perimeter") AP (* AreaP 1.2) ) ;_ setq (princ (strcat "\nArea: " (rtos AreaP 2 2) "\nModified Area: " (rtos AP 2 2) "\nPerimeter: " (rtos PermP 2 2) ) ;_ strcat ) ;_ princ (command "_.mtext" Pnt "_w" 0 "Area: " (rtos AP 2 2) "") ) ;_ progn ) ;_ and (princ) ) ;_ defun Quote
guitarguy1685 Posted November 17, 2009 Author Posted November 17, 2009 wow that's pretty awesome. thanks a ton. Quote
alanjt Posted November 18, 2009 Posted November 18, 2009 wow that's pretty awesome. thanks a ton. I didn't over complicate it, since you seem to be a beginner. If you have any questions about it, feel free to ask. Quote
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.