Ish Posted July 25, 2021 Posted July 25, 2021 (edited) Dear members, Any lisp program or trick to make a area table From a plan. I want a area table with plot number text along with area . I will select all at time, the automatically generate area table. Please See the attached image. AREA TABLE OF POLYGON.dwg Edited July 26, 2021 by Ish Modified again Quote
Ajmal Posted July 25, 2021 Posted July 25, 2021 dear Ish, I think you will be satisfied with our master lee mac program. http://www.lee-mac.com/arealabel.html 1 Quote
Ish Posted July 25, 2021 Author Posted July 25, 2021 But sir I need plot number also, According leemac only area is coming.and I think we have to pick or select one by one also. I need plot number text and area of that plot. Quote
Ish Posted July 25, 2021 Author Posted July 25, 2021 3 hours ago, Ajmal said: dear Ish, I think you will be satisfied with our master lee mac program. http://www.lee-mac.com/arealabel.html I used but not fullfil my requirements. It is providing only area , I need also plot number text. Quote
confutatis Posted July 25, 2021 Posted July 25, 2021 One question: where is the area derived from? 1 Quote
Ish Posted July 25, 2021 Author Posted July 25, 2021 Every plot have close polyline ( boundary). Quote
devitg Posted July 25, 2021 Posted July 25, 2021 Hi Ish , If you would upload the sample.dwg , no doubt would come. Quote
confutatis Posted July 25, 2021 Posted July 25, 2021 Maybe you could also add fields related to the areas of the polylines to the table boxes, right? Quote
Steven P Posted July 25, 2021 Posted July 25, 2021 So this will get the text written in the rectangles, assuming they are polylines. Largely untested though, it is Sunday. See the 'princ' at the end for where the text is. After that you could modify Lee Macs LISP to add these names in, good luck to that, I have never been very successful in working out how he does things. (defun c:txtinrect( / mytext myrectss acount) https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-xy-coordinates-of-2d-rectangle-lwpolyline/td-p/846832 (defun massoc (key alist / x nlist) (foreach x alist (if (eq key (car x)) (setq nlist (cons (cdr x) nlist)) ) ) (reverse nlist) ) ;end ;;get rectangles (setq myrectsss (ssget '((0 . "LWPOLYLINE")))) (setq acount 0) (while (< acount (sslength myrectsss)) (setq mycoords (massoc 10 (entget (ssname myrectsss acount)))) (setq pt1 (nth 0 mycoords)) (setq pt2 (nth 2 mycoords)) (setq mytext (ssname (ssget "_W" pt1 pt2 '((0 . "*text"))) 0)) (princ (vla-get-textstring (vlax-ename->vla-object mytext))) ;;each text withn a rectangle (setq acount (+ 1 acount)) ) ) you could also look at this to get the area of a rectangle using pt1 and pt2 above, and then just find a lisp to create a table using these... it is Sunday though, TV to watch.... Quote
BIGAL Posted July 25, 2021 Posted July 25, 2021 You really need to have a go your just using this forum as a write it for me. Your community reputation is -19 not good. There is plenty of examples out there how to do this task. Quote
Ish Posted July 26, 2021 Author Posted July 26, 2021 (edited) The attached image just for example, In main file there no rectangular shape, Each shape are different . Like a polygon, that's why pick point aur corner to corner selection will not be a solution. Thanks AREA TABLE OF POLYGON.dwg Edited July 26, 2021 by Ish Modified Quote
confutatis Posted July 26, 2021 Posted July 26, 2021 (edited) (defun C:ADDTAB (/ ss lista2d arealist index ename listpoint pointtable objtable) (if (not (setq ss (ssget '((0 . "LWPOLYLINE")(8 . "BOUNDARY"))))) (vl-exit-with-error "") ) (defun lista2d (lst) (if lst (cons (list (car lst) (cadr lst)) (lista2d (cddr lst)) ) ) ) (setq arealist '()) (repeat (setq index (sslength ss)) (setq ename (ssname ss (setq index (1- index)))) (setq listpoint (lista2d (safearray-value (variant-value (vla-get-Coordinates (vlax-ename->vla-object ename)))))) (if (not (setq sstext (ssget "_WP" listpoint '((0 . "MTEXT")(8 . "TABLE TEXT"))))) (ssdel ename ss) (setq arealist (cons (list (vla-get-Textstring (vlax-ename->vla-object (ssname sstext 0))) (vla-get-Area (vlax-ename->vla-object ename))) arealist)) ) ) (setq pointtable (getpoint "\nSelect point insertion table: ") objtable (vla-AddTable (vla-get-modelspace (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-3d-Point pointtable) (+ 2 (sslength ss)) 2 6 17) index 0 ) (vla-SetText objtable index 0 "AREA TABLE") (vla-SetCellTextHeight objtable index 0 2.40) (vla-SetCellAlignment objtable index 0 acMiddleCenter) (vla-SetText objtable (setq index (1+ index)) 0 "PLOT NO.") (vla-SetCellTextHeight objtable index 0 2.10) (vla-SetCellAlignment objtable index 0 acMiddleCenter) (vla-SetText objtable index 1 "AREA") (vla-SetCellTextHeight objtable index 1 2.10) (vla-SetCellAlignment objtable index 1 acMiddleCenter) (foreach elem arealist (vla-SetText objtable (setq index (1+ index)) 0 (car elem)) (vla-SetCellTextHeight objtable index 0 2.40) (vla-SetCellAlignment objtable index 0 acMiddleCenter) (vla-SetText objtable index 1 (rtos (cadr elem) 2 3)) (vla-SetCellTextHeight objtable index 1 2.10) (vla-SetCellAlignment objtable index 1 acMiddleCenter) ) ) This should be fine. The programme selects the polylines on the BOUNDARY layer, the vertices of the polylines act as a selection for any text inside. If there is no text, the polyline is deleted from the selection set, otherwise a list is created with the text string and the corresponding polyline area. The rest is easy, the table is created with the list data in the AREALIST variable. Edited July 26, 2021 by confutatis 2 1 Quote
Steven P Posted July 26, 2021 Posted July 26, 2021 You should be able to get the extents of each polygon using in my example if you modify Pt1 and Pt2 in my example making them up with the maximum and minimum values of x and y in the list of coordincates, and there should be example of this online.... like Big Al suggests, you have a couple of starting points now, have a go modifying these examples and let us know where you get stuck after this Quote
confutatis Posted July 26, 2021 Posted July 26, 2021 (edited) (defun C:ADDROWTAB (/ ss lista2d index ename listpoint objtable) (setvar "NOMUTT" 1) (princ "\nSelect table: ") (setq objtable (ssget "_+.:E:S" '((0 . "ACAD_TABLE")))) (setvar "NOMUTT" 0) (if (not (and (setq ss (ssget '((0 . "LWPOLYLINE")(8 . "BOUNDARY")))))) (vl-exit-with-error "") ) (defun lista2d (lst) (if lst (cons (list (car lst) (cadr lst)) (lista2d (cddr lst)) ) ) ) (setq arealist '()) (repeat (setq index (sslength ss)) (setq ename (ssname ss (setq index (1- index)))) (setq listpoint (lista2d (safearray-value (variant-value (vla-get-Coordinates (vlax-ename->vla-object ename)))))) (if (not (setq sstext (ssget "_WP" listpoint '((0 . "MTEXT")(8 . "TABLE TEXT"))))) (ssdel ename ss) (setq arealist (cons (list (vla-get-Textstring (vlax-ename->vla-object (ssname sstext 0))) (vla-get-Area (vlax-ename->vla-object ename))) arealist)) ) ) (setq objtable (vlax-ename->vla-object (ssname objtable 0))) (setq stringlist '() index 0 ) (while (/= (vla-GetText objtable index 0) "") (setq stringlist (cons (vla-GetText objtable index 0) stringlist)) (setq index (1+ index)) ) (mapcar '(lambda (elem) (if (equal (car elem) (car (member (car elem) stringlist))) (setq arealist (vl-remove elem arealist)))) arealist) (setq index (vla-get-Rows objtable)) (foreach elem arealist (vla-InsertRows objtable index 6 1) (vla-SetText objtable index 0 (car elem)) (vla-SetCellTextHeight objtable index 0 2.40) (vla-SetCellAlignment objtable index 0 acMiddleCenter) (vla-SetText objtable index 1 (rtos (cadr elem) 2 3)) (vla-SetCellTextHeight objtable index 1 2.10) (vla-SetCellAlignment objtable index 1 acMiddleCenter) (setq index (1+ index)) ) (princ) ) Since I have a lot of fun programming in autolisp, I just modified the ADDTAB program with a few changes. The program adds rows to the table, selected additional polylines, without having to redo the table. If an area is already present in the table, it is not inserted again in the table. Edited July 26, 2021 by confutatis 1 Quote
mhupp Posted July 26, 2021 Posted July 26, 2021 (edited) @confutatis my 2¢ might want to add a closed poly check when selecting the polylines on the boundary layer. you can still return an area on an open polyline and it might not be the full plot area. (if (not (and (setq ss (ssget '((0 . "LWPOLYLINE")(8 . "BOUNDARY")(70 . 1)))))) Also I didn't know this about 3 months ago but WP works great with polylines unless its has arcs. if you use the polyline vertices with WP selection window it will cut corners when their is an arc. Example it wont pick up "test1" text because its outside the white selection window. granted this probably isn't a problem with plots, but caused quite a bit of finger pointing at my work when one of my commands wasn't picking up everything "inside" the polyline. fix here Edited July 26, 2021 by mhupp 1 Quote
confutatis Posted July 26, 2021 Posted July 26, 2021 You're right, I hadn't accounted for closed polylines, though it should be the post author's job to verify that. However, the problem is easily solved with a fairly trivial command that I created some time ago and that is the closure of all open polylines selected, even those with the first vertex coincident with the last, but considered open. As for WP selection on curves, I had created a program similar to Lee Mac's, to convert arcs to line segments. I didn't look closely, but it seemed to me that there were no curves on polylines. What is represented on the DWG should be cadastral parcels, usually defined by polylines with no curved lines. Quote
mhupp Posted July 26, 2021 Posted July 26, 2021 2 hours ago, confutatis said: I didn't look closely, but it seemed to me that there were no curves on polylines. I just wanted to vent. Quote
BIGAL Posted July 26, 2021 Posted July 26, 2021 confutatis do it the other way around get the text then do a bpoly sorts out other problems like no pline, sides as multi objects. 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.