ARGV Posted July 3, 2009 Share Posted July 3, 2009 Does anyone know where autocad hides the block description field? I can't find it using VLISP or regular LISP?? I looked in XDATA and didn't find anything there either.. ?? thanks. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 3, 2009 Share Posted July 3, 2009 Something like this? (defun getDesc (blk / Com) (cond ((not (vl-catch-all-error-p (vl-catch-all-apply (function (lambda ( ) (setq com (vla-get-Comments (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blk)))))))) Com) (t nil))) (defun c:test (/ ent) (if (and (setq ent (car (entsel "\nSelect Block: "))) (eq "INSERT" (cdadr (entget ent)))) (if (setq Com (getDesc (cdr (assoc 2 (entget ent))))) (alert Com))) (princ)) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
ARGV Posted July 3, 2009 Author Share Posted July 3, 2009 Something like this? (defun getDesc (blk / Com) (cond ((not (vl-catch-all-error-p (vl-catch-all-apply (function (lambda ( ) (setq com (vla-get-Comments (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blk)))))))) Com) (t nil))) (defun c:test (/ ent) (if (and (setq ent (car (entsel "\nSelect Block: "))) (eq "INSERT" (cdadr (entget ent)))) (if (setq Com (getDesc (cdr (assoc 2 (entget ent))))) (alert Com))) (princ)) (vl-load-com) Yes thanks. I didn't know about the vla-get-comments command, and apparently never tried finding it. ?? thank you. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 3, 2009 Share Posted July 3, 2009 Yes thanks. I didn't know about the vla-get-comments command, and apparently never tried finding it. ?? thank you. No problem - I had never tried looking for Descriptions before today, so I just did a bit of experiementing and found it there Quote Link to comment Share on other sites More sharing options...
ARGV Posted July 4, 2009 Author Share Posted July 4, 2009 No problem - I had never tried looking for Descriptions before today, so I just did a bit of experiementing and found it there yeah, I could swear I had tried looking up "comment" in the apropos window. Anyways, now the bonus question is, how do you ADD comments to a block. From what I've read, you can add comments inside the summaryinfo object, but I haven't been able to add comments to a block.... ?? Thanks, Lee. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 4, 2009 Share Posted July 4, 2009 Anyways, now the bonus question is, how do you ADD comments to a block. From what I've read, you can add comments inside the summaryinfo object, but I haven't been able to add comments to a block.... ?? This seems to work for me: (defun PutDesc (blk Desc) (cond ((not (vl-catch-all-error-p (vl-catch-all-apply (function (lambda ( ) (vla-put-Comments (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blk) Desc)))))) Desc) (t nil))) (defun c:test (/ ent Com) (if (and (setq ent (car (entsel "\nSelect Block: "))) (eq "INSERT" (cdadr (entget ent))) (setq Com (getstring t "\nSpecify Comments: "))) (PutDesc (cdr (assoc 2 (entget ent))) Com)) (princ)) Quote Link to comment Share on other sites More sharing options...
ARGV Posted July 5, 2009 Author Share Posted July 5, 2009 This seems to work for me: (defun PutDesc (blk Desc) (cond ((not (vl-catch-all-error-p (vl-catch-all-apply (function (lambda ( ) (vla-put-Comments (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blk) Desc)))))) Desc) (t nil))) (defun c:test (/ ent Com) (if (and (setq ent (car (entsel "\nSelect Block: "))) (eq "INSERT" (cdadr (entget ent))) (setq Com (getstring t "\nSpecify Comments: "))) (PutDesc (cdr (assoc 2 (entget ent))) Com)) (princ)) alrighty then.. I tried a more direct approach and it didn't seem to work, but maybe I missed something. thanks! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 5, 2009 Share Posted July 5, 2009 alrighty then.. I tried a more direct approach and it didn't seem to work, but maybe I missed something. thanks! Cool, anything else, just ask Quote Link to comment Share on other sites More sharing options...
kheajohn Posted November 10, 2012 Share Posted November 10, 2012 Cool, anything else, just ask Hi Lee-Mac, Can you enhance further this lisp so i can get the description of a Block or Layer description and use the info in Labeling/tagging? regards, richard Quote Link to comment Share on other sites More sharing options...
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.