Good day, is it possible to make lisp that makes a table to count selected dimensions that separates per layer. and if possible also export the table to excel? I'm not very familiar making lisp. Any help is much appreciated Thank you.
Use this -MyPropertiesCAD
Set the settings as shown in the pictures.
And for each polyline, enter a name in the properties panel.
Please attach a small sample drawing, perhaps the one in your screen shots.
I'm sure someone here can create a Lisp for that. (been done several times before).
ECCAD
Try this export table to excel. Like others can make a custom solution that sorts the info say by layer name, before making the table. Do a Google.
Hello I've searched LISPs and the only one that comes close to what I want to do was the post Extract Rectangle Dimension To Table (Count & Numbering). But instead of the rectangles what I need is only the selected dimension Lengths. LISP to make CAD table or in excel too. Just to automate the process to make work faster. Thank you.
@jchua3 wrote:Hello I've searched LISPs and the only one that comes close to what I want to do was the post Extract Rectangle Dimension To Table (Count & Numbering). But instead of the rectangles what I need is only the selected dimension Lengths. LISP to make CAD table or in excel too. Just to automate the process to make work faster. Thank you.
What's wrong with the proposed solution?
Try this
(defun c:dim2excel ( / Number2Alpha AH:putcell excel ss i j k layers el measures mea old new)
(defun Number2Alpha (Num# / Val#)
(if (< Num# 27)
(chr (+ 64 Num#))
(if (= 0 (setq Val# (rem Num# 26)))
(strcat (Number2Alpha (1- (/ Num# 26))) "Z")
(strcat (Number2Alpha (/ Num# 26)) (chr (+ 64 Val#)))
)
)
);defun Number2Alpha
(defun AH:putcell (cellname val1 / )
(setq myRange (vlax-get-property (vlax-get-property excel "ActiveSheet") "Range" cellname))
(vlax-put-property myRange 'Value2 val1)
)
(if (= (setq excel (vlax-get-object "Excel.Application") ) nil)
(setq excel (vlax-get-or-create-object "Excel.Application"))
(vlax-invoke-method (vlax-get-property excel 'WorkBooks) 'Add)
)
(setq ss (ssget '((0 . "DIMENSION"))) i -1 layers nil)
(while (< (setq i (1+ i))(sslength ss))
(setq el (vlax-ename->vla-object (ssname ss i)))
(if (not (member (vla-get-layer el) layers))
(setq layers (cons (vla-get-layer el) layers))
)
)
(setq j 0 k 0)
(foreach layer layers
(setq i -1 measures (list))
(while (< (setq i (1+ i))(sslength ss))
(setq el (vlax-ename->vla-object (ssname ss i)))
(cond
((= layer (vla-get-layer el))
(setq mea (rtos (vla-get-measurement el) 2 2))
(cond
((setq old(assoc mea measures))
(setq new (cons mea (1+ (cdr old))))
(setq measures (subst new old measures))
)
(T
(setq measures (cons (cons mea 1) measures))
)
)
)
)
)
(vla-put-visible excel :vlax-true)
(vlax-put-property excel 'ScreenUpdating :vlax-true)
(vlax-put-property excel 'DisplayAlerts :vlax-true)
(foreach measure measures
(AH:putcell (strcat (Number2Alpha (+ j 1)) (itoa (1+ k))) (car measure))
(AH:putcell (strcat (Number2Alpha (+ j 2)) (itoa (1+ k)))(itoa(cdr measure)))
(AH:putcell (strcat (Number2Alpha (+ j 3)) (itoa (1+ k))) layer)
(setq k (1+ k))
)
)
(vlax-release-object excel)
(princ)
)
Miljenko Hatlak
Can't find what you're looking for? Ask the community or share your knowledge.