bogeymen77 Posted June 8, 2018 Posted June 8, 2018 i'm looking for a simple area routine base on the dimension not the line. i want to be able to click on 2 cotation that i got from the dimlinear command and have the area "print" in a text format where i want to. I know a routine with a lot of visual lisp routine in it, but i'm looking a version with a standard/ basic lisp. thank you. Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 Hi, Is it something like select the 1st dimlinear then the 2nd one then specify a point to place the area as a text object which supposed to be produced from multiplying of dim text1 and dim text2 ? Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 This? (defun c:Test ( / dm1 dm2 en1 en2 obj get hgt ins ) (and (setq dm1 (car (entsel "\nSelect 1st dimlineaer :"))) (or (member '(100 . "AcDbAlignedDimension") (setq en1 (entget dm1))) (alert "Invalid object.<!>") ) (setq dm2 (car (entsel "\nSelect 2nd dimlineaer :"))) (or (member '(100 . "AcDbAlignedDimension") (setq en2 (entget dm2))) (alert "Invalid object.<!>") ) (setq obj (tblobjname "BLOCK" (cdr (assoc 2 en1)))) (while (and (not hgt) (setq obj (entnext obj))) (and (= (cdr (assoc 0 (setq get (entget obj)))) "MTEXT") (setq hgt (assoc 40 get)) ) ) (setq ins (getpoint "\nSpecify location of text area :")) (entmake (list '(0 . "TEXT") (cons 10 (trans ins 0 1)) (cons 11 (trans ins 0 1)) hgt (cons 1 (rtos (* (cdr (assoc 42 en1)) (cdr (assoc 42 en2))) 2)) ) ) ) (princ) ) Quote
bogeymen77 Posted June 8, 2018 Author Posted June 8, 2018 work perfectly thank... If i can ask you an other issue. if i have a few area measurement and i want to have the total, what would be the routine/formula? thank Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 You're welcome. if i have a few area measurement and i want to have the total, what would be the routine/formula? Do you mean that you would like to sum texts with numerical values to new text as total areas? Quote
bogeymen77 Posted June 8, 2018 Author Posted June 8, 2018 yes. for exemple i got 4 piece of counter top ,i got the area for each one. After i would like to have the sum of all 4 pieces. thank you Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 What do you mean by counter top? Can you upload a sample drawing showing the outcome of the process that you looking forward? Quote
bogeymen77 Posted June 8, 2018 Author Posted June 8, 2018 i'm drawing counter top. here'S an example test counter top.dwg Quote
BIGAL Posted June 9, 2018 Posted June 9, 2018 I am sure Tharwat will continue to answer there are a few different ways to do this. 1 Pick text and add up. 2 Select text on one layer, your dwg its on layer 0 needs to be something different, like table-area. 3 Make a block and have an attribute then just total all attributes. 4 like 3 but make an Autocad table of the areas with common table top styles. It would be good at this point to suggest which method you want so its not a case of multiple changes. Could not resist suggestion 1, this is real basic no error checking. (defun c:test ( / tot ent obj) (setq tot 0.0) (while (setq ent (entsel "\nPick text Enter to stop")) (setq obj (vlax-ename->vla-object (car ent))) (setq tot (+ (atof (vla-get-textstring obj)) tot)) ) (alert (strcat "The total area is = " (rtos tot 2 3 ))) ) Quote
Tharwat Posted June 9, 2018 Posted June 9, 2018 (defun c:sum (/ int tot sel ent int val ins) ;; Tharwat - Date: 09.Jun.2018 ;; (princ "\nSelect text areas to sum :") (and (setq int -1 tot 0.0 sel (ssget "_:L" '((0 . "TEXT"))) ) (progn (while (setq ent (ssname sel (setq int (1+ int)))) (and (numberp (setq val (read (cdr (assoc 1 (entget ent)))))) (setq tot (+ tot val)) ) ) (< 0.0 tot) ) (setq ins (getpoint "\n Specify text location :")) (entmake (list '(0 . "TEXT") (cons 10 (trans ins 0 1)) (cons 11 (trans ins 0 1)) (cons 40 (getvar 'TEXTSIZE)) (cons 1 (rtos tot 2)) ) ) ) (princ) ) Quote
bogeymen77 Posted June 9, 2018 Author Posted June 9, 2018 works Perfectly !!! WOW thanks you all !!! Quote
Tharwat Posted June 9, 2018 Posted June 9, 2018 works Perfectly !!! WOW thanks you all !!! You're welcome. Quote
BIGAL Posted June 9, 2018 Posted June 9, 2018 Nicely done Tharwat. Maybe 1 little suggestion. (cons 1 (strcat "Area = " (rtos tot 2))) Quote
Tharwat Posted June 10, 2018 Posted June 10, 2018 Nicely done Tharwat. Thank you BIGAL. Maybe 1 little suggestion. (cons 1 (strcat "Area = " (rtos tot 2))) Yes indeed it is a very good suggestion and make sense. 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.