Hi,
First off I have little to no experience reading/editing a LISP. I'm trying to see if its possible to combine these two LISPS attached to get what I'm looking for. The AreaLabelV1-9.1 is a great lisp. Unfortunately, it doesn't account for duplicates to create a count # for picked areas or objects like the rectangle_dims LISP does. I need it to have the ability to consolidate duplicate areas so I don't have multiples in the table.
I'd appreciate any help/advice.![]()
-Me
Updated code above. Post 34. Trying to keep just last version posted. Will add some more later on on start with blank dwg.
Thank you so much @Sea-Haven , it's work perfect.
It's better if it can be sorted by layer, but I can handle that in Excel and will figure out how to do it later. Your help has already taken up so much of your time.
I sincerely appreciate all your help.
Ok will have a look again so select all rectangles but make 1 table.
; resort here lst3 based on layer name and other values can do up to 5 values deep.
(foreach val lst3
I am working on curtainwall shop drawing task in which I need to give unique number and need to make table with area and dimension of each glass panel, and this is useful to me.
But Is it Possible to Add Number with Prefix and Suffix (for example GL1-1,GL1-2,GL1-3) Automatically instead of just 1, 2, 3 ,4..... type number?
Can you please help with this?
Hi,
I need numbering from bottom left to right. Can you help me to edit the code?
Hello,
I am doing a list of a lot rectangles. The LISP file has been very helpful, thank you! But in my project, I needed the dimensions such that the X direction dimension will always be the length, and the Y-dir dimension will always be the width. And not arranged such that the width shall always be the shorter dimension.
Appreciate if you can help me on this.
Thanks a lot.
See image below for sample scenario. I need all Y-dir dimensions to be width, and X-dir dimensions to be the length. In this case, last shape takes the shorter dimension as width, which is not supposed to be. Any help is appreciated.
Thank you so much.
@Crisger4VSG7 Don't need to look at the dims just select the rectangs, May have time later today.
Try this.
(defun c:rectsize ( / AH:table_make cnt lst lst3 my-count objtable pointmin pontmax ss txtsz val1 val2 xd yd)
(defun remove-duplicates (lst)
(cond
((null lst) nil)
((member (car lst) (cdr lst)) (remove-duplicates (cdr lst)))
(T (cons (car lst) (remove-duplicates (cdr lst))))
)
)
(defun AH:table_make (numcolumns txtsz / numrows curspc colwidth numcolumns objtable rowheight sp doc)
(vl-load-com)
(setq sp (vlax-3d-point (getpoint "Pick top left"))); or use getpoint
(setq doc (vla-get-activedocument (vlax-get-acad-object) ))
(if (= (vla-get-activespace doc) 0)
(setq curspc (vla-get-paperspace doc))
(setq curspc (vla-get-modelspace doc))
)
(setq numrows 2)
(setq rowheight (* 2.0 txtsz))
(setq colwidth 20)
(setq objtable (vla-addtable curspc sp numrows numcolumns rowheight colwidth))
(vla-SetTextHeight Objtable (+ acDataRow acTitleRow acHeaderRow) txtsz)
(vla-settext objtable 0 0 "RECTANGLES")
(vla-settext objtable 1 0 "Length")
(vla-settext objtable 1 1 "Height")
(vla-settext objtable 1 2 "PC's")
(princ)
)
; By Gile
(defun my-count (a L)
(cond
((null L) 0)
((equal a (car L)) (+ 1 (my-count a (cdr L))))
(t (my-count a (cdr L))))
)
; starts here
(setq txtsz (getreal "Enter text size "))
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(setq lst '())
(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
(vla-GetBoundingBox obj 'minpoint 'maxpoint)
(setq pointmin (vlax-safearray->list minpoint))
(setq pointmax (vlax-safearray->list maxpoint))
(setq xd (atof (rtos (abs (- (car pointmin)(car pointmax))) 2 4)))
(setq yd (atof (rtos (abs (- (cadr pointmin)(cadr pointmax))) 2 4)))
(setq lst (cons (list xd yd) lst))
)
(setq lst (vl-sort lst
'(lambda (a b)
(cond
((< (car a) (car b)))
((= (car a) (car b))
(< (cadr a) (cadr b)))
)
)
)
)
(setq lst3 '())
(foreach val lst
(setq cnt (my-count val lst))
(setq lst3 (cons (list (nth 0 val)(nth 1 val) cnt) lst3))
)
(setq lst3 (vl-sort lst3 '(lambda (x y) (< (car x)(car y)))))
(setq lst3 (remove-duplicates lst3))
(AH:table_make 3 txtsz)
(setq objtable (vlax-ename->vla-object (entlast)))
(setq numrows (vla-get-rows objtable))
(foreach val1 lst3
(vla-InsertRows Objtable numrows (vla-GetRowHeight Objtable (1- numrows)) 1)
(vla-settext objtable numrows 0 (car val1))
(vla-settext objtable numrows 1 (cadr val1))
(vla-settext objtable numrows 2 (caddr val1))
(setq numrows (1+ numrows))
)
(princ)
)
Hello sir,
Happy New Year. It works fine, and I really appreciate your help. If you could also help me add another column that identify the layer that the rectangles are in, same as shown below.
Thank you so much.
Can't find what you're looking for? Ask the community or share your knowledge.