PoetEngineer Posted June 28, 2022 Posted June 28, 2022 Hi everyone, a lot of people who are interesting in the engineering or another technics work have this lisp (I Shared bottom of my topic) as you know. however, this lisp is can't give me results that I want or I imagine, at the last times. I had a decision to customize this lisp for me and people who are want to reach goals like mine. I want to customize this lisp to draw hatch area values, line or polyline length values and count of block in drawing that I work in it. where should I start to customize the lisp to get my goals. THIS IS WHAT I WANT TO DO THIS IS WHAT I CAN DO NOW (defun C:LEGEND ( / *error* acdoc acobj an co e hs ht i la lst lt p p1 p2 p3 space ss st ro dr) (vl-load-com) (setq acObj (vlax-get-acad-object) acDoc (vla-get-activedocument acObj) space (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'PaperSpace 'ModelSpace)) ) (vla-startundomark acDoc) ;;;;;; Error function ;;;;;;;;; (defun *error* (msg) (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*")) (princ (strcat "\nError: " msg)) ) (if (and a (not (vlax-erased-p a))) (vla-delete a)) (vla-endundomark acDoc) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq st (entget (tblobjname "style" (getvar 'textstyle)) '("AcadAnnotative")) an (member '(1070 . 1) (cdr (member '(1070 . 1) (cadr (assoc -3 st))))) hs (cdr (assoc 40 st)) ro (angle '(0 0 0) (trans (getvar "UCSXDIR") 0 (trans '(0 0 1) 1 0 T))) dr (trans '(0 0 1) 1 0 T) ) (if an (setq ht (/ (if (> hs 0) hs 3.0) (cond ((getvar 'cannoscalevalue)) (1.0)))) (setq ht (* (if (> hs 0) hs 3.0) (getvar 'ltscale))) ) (if (setq ss (ssget)) (progn (repeat (setq i (sslength ss)) (setq e (entget (ssname ss (setq i (1- i)))) la (cdr (assoc 8 e)) lt (cdr (assoc 6 e)) co (cdr (assoc 62 e)) ) (if (not (member (list la lt co) lst)) (setq lst (cons (list la lt co) lst)) ) ) (setq lst (vl-sort lst '(lambda (a b) (< (car a) (car b))))) (if (setq p (getpoint "\nSpecify insert point: ")) (foreach x lst (setq p1 (trans p 1 0) p2 (trans (polar p 0.0 (* 10 ht)) 1 0) p3 (trans (polar p 0.0 (* 11 ht)) 1 0) ) (entmake (list '(0 . "LINE") (cons 8 (car x)) (cons 10 p1) (cons 11 p2) (cons 6 (cond ((cadr x)) ("ByLayer"))) (cons 62 (cond ((caddr x)) (256))) ) ) (vla-put-textalignmentpoint (vlax-ename->vla-object (entmakex (list '(0 . "TEXT") (cons 8 (car x)) (cons 6 (cond ((cadr x)) ("ByLayer"))) (cons 62 (cond ((caddr x)) (256))) '(100 . "AcDbText") (list 10 0 0 0) (cons 40 ht) (cons 1 (car x)) (cons 50 ro) (cons 7 (getvar 'textstyle)) (cons 72 0) (list 10 0 0 0) (cons 210 dr) (cons 73 2) ) ) ) (vlax-3d-point p3) ) (setq p (polar p (/ pi -2.0) (* 2 ht))) ) ) ) ) (*error* nil) (princ) ) LEGEND-AUTOCADDA SEÇİLEN ÇİZİM İÇERİSİNDEKİ LAYERLARI LEJANT HALİNE GETİREN LİSP.LSP Quote
Steven P Posted June 28, 2022 Posted June 28, 2022 Completely the wrong answer but might amuse someone somewhere.....Legends Oh, and made up over time so the code is a bit bloated, I haven't stripped anything out the files, so some stuff in there is useless as well for this answer but load up the files and the command blklegend gives you 3 options. Inserts a legend block. BLKLEGENDS.lspBLKWRITER.lsp (this had work stuff behind it but I needed to test wat I was doing) Quote
BIGAL Posted June 29, 2022 Posted June 29, 2022 Split this into 3 "hatch area values, line or polyline length values and count of block in drawing" hatch area values, line or polyline length values count of blocks in drawing - this can have a simple or complex answer if attributes get involved. Each of these has been done numerous times. The next question is so get the answers then what a Table to Excel to a file ? So google 3 times. Make them work 1 at a time rather than all 3 in one go. Quote
tombu Posted June 29, 2022 Posted June 29, 2022 For the blocks check out: http://www.lee-mac.com/blockcounter.html and https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/create-a-legend-with-lisp/td-p/9180583 Quote
PoetEngineer Posted June 29, 2022 Author Posted June 29, 2022 Thank you everyone. I'm proud to be have friends like yours Quote
mhupp Posted June 29, 2022 Posted June 29, 2022 I think we need a poem. but that might have more to do with bio fuel so i won't hold my breath. 1 Quote
PoetEngineer Posted June 29, 2022 Author Posted June 29, 2022 I found a lisp for hatch area to table but there is a problem that is about description of layer. if you look at the file those I share with you then you'll see dwg file has like "LOT 50" etc. layer description. in addition when I using this lisp I can't see my hatch pattern. So what's wrong with my files. my second question is how can I create a layer with "LOT 50" description? (setq b(command "-LAYER" "M" "____00-AF-MAHAL ÖLÇÜLENDİRME " "LT" "Continuous" "d" LOT 50" "" "LW" "0.50" "" "C" "20" "" "")) ) Is that correct? if it's not, please tell me what I do wrong.Jamal Hatch Area2-in current units (1).dwg HT2-HATCH AREA LEGEND CURRENT UNITS.LSP Quote
PoetEngineer Posted June 29, 2022 Author Posted June 29, 2022 6 minutes ago, mhupp said: I think we need a poem. but that might have more to do with bio fuel so i won't hold my breath. I'll share with you a poem that written by me if you know turkish let's read together Sözcüklerle reddetsende beni kendinden arkadamı dönüpte gidemiyorum ki senden zifiri karanlık gecelerde amansız hasretinden prangalar vurulur bana yüreğinden sürgünken . . . 1 Quote
tombu Posted June 29, 2022 Posted June 29, 2022 1 hour ago, PoetEngineer said: I found a lisp for hatch area to table but there is a problem that is about description of layer. if you look at the file those I share with you then you'll see dwg file has like "LOT 50" etc. layer description. in addition when I using this lisp I can't see my hatch pattern. So what's wrong with my files. my second question is how can I create a layer with "LOT 50" description? (setq b(command "-LAYER" "M" "____00-AF-MAHAL ÖLÇÜLENDİRME " "LT" "Continuous" "d" LOT 50" "" "LW" "0.50" "" "C" "20" "" "")) ) Your lisp code appears to be missing a " before LOT 50" and has too many closing parenthesis ). 1 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.