Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/18/2023 in all areas

  1. Not tested, but it should be something like this : (defun c:dellaysbyprefix ( / lay lays prefix ) (while (setq lay (tblnext "LAYER" (not lay))) (setq lays (cons (cdr (assoc 2 lay)) lays)) ) (setq prefix (strcase (getstring "\nSpecify prefix of layers to remove from DWG : "))) (foreach lay lays (if (wcmatch (strcase lay) (strcat prefix "*")) (progn (vl-cmdf "_.LAYDEL" lay) (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) ) ) ) (princ) ) HTH. M.R.
    1 point
  2. I think its doable, have done some preperation but not sure if and when I can show something. Data is difficult to handle but hey, I'm a dragon, difficult is my middle name.
    1 point
  3. if talking a dynamic block then yes thanks to Lee-mac 1st, then can display visibility values and choose. Works for any dynamic block as it reads the visibility values. You insert block and then visibility values are displayed. Is this what you want as its 3 lisps, 2 are library functions the dcl and Lee-mac dynamic block functions. let me know will post code.
    1 point
  4. 1 point
  5. OK, This is what I have, should be the same as yours? Try it just to make sure of say typing errors and so on ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/get-polyline-length-total-by-layer-in-table/m-p/11229970#M432527 ;; Hatched area Table sorted by Layer with the Color markers ;;; (Defun c:POLYLENGHT ( / AllData ss e edata Area_table crow bn area_ ssNH fname clr ) (vl-load-com) ;;; pBe 23Apr2013 ;;; ;;; Mod for FSJ_Mo : Layer instead of Block swatches ;;; ;;; pBe 18Jul2013 ;;; ;;; karpki : Header by filename, m2 05/01/2020 ;;; ;;; Moded by hak_vz for karpki: color markers 12/01/2020 ;;; (setq txtht 250) ;; Change all '500' to this (setq cellht (* 3 txtht)) ;; Change all 1500 to this (setq cellwd (* 14 txtht)) ;; Change 7000 to this (if (setq AllData nil ssNH (ssadd) ss (ssget '((0 . "POLYLINE,LWPOLYLINE"))) ) (progn (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss (Setq i (1- i))))) (setq edata (list (vlax-get e 'Layer) (IF (not (vl-catch-all-error-p (setq area_ (vl-catch-all-apply 'vla-get-area (list E))) ) ) area_ (progn (ssadd (ssname ss i) ssNH) 0.0) ) ) ) (setq AllData (if (setq f (assoc (car edata) AllData)) (subst (list (car f) (+ (cadr f) (cadr edata))) f Alldata) (cons edata AllData) ) ) ) (setq AllData (vl-sort AllData '( lambda (m n) (< (Car m) (car n))))) (setq Area_table (vlax-invoke (vlax-get (vla-get-ActiveLayout (vla-get-activedocument (vlax-get-acad-object)) ) 'Block ) 'Addtable (getpoint "\nPick point for Table:") 2 3 cellht cellwd ) ) (setq fname(substr (setq str (getvar "dwgname")) 1 (- (strlen str) 4))) ;get Header name from file name (vla-settext Area_table 0 0 fname) ;set header name (vla-setcelltextheight Area_table 0 0 txtht) (mapcar '(lambda (y) (vla-settext Area_table 1 (car y) (cadr y)) (vla-setcelltextheight Area_table 1 (car y) txtht) ;second row text height ) (list '(0 "Category") '(1 "Total Length") '(2 "Colour")) ) (foreach d AllData (vla-insertrows Area_table (1+ (setq crow (vla-get-rows Area_table))) cellht ;cell height from 4-th row 1 ) (vla-setcelltextheight Area_table crow 0 txtht) ;set Layer name (Category) (vla-setCellAlignment Area_table crow 0 5) (vla-setCellValue Area_table crow 0 (car d)) (vla-setCellValue Area_table crow 1 (cadr d)) ;set Area (vla-setcelltextheight Area_table crow 1 txtht) (vla-setCellAlignment Area_table crow 1 5) (vla-setcellformat Area_table crow 1 (strcat "%lu2%pr3%ps[, m" (chr 072) "]")) (setq x(strcat "AutoCAD.AcCmColor." (substr (getvar 'Acadver) 1 2))) ;set Color markers (setq clr (vlax-create-object x)) (vla-put-colorindex clr (cdr (assoc 62 (tblsearch "layer" (car d))))) (vla-SetCellBackgroundColor Area_table crow 2 clr) ) ) ) (princ) )
    1 point
×
×
  • Create New...