boheng Posted December 22, 2017 Share Posted December 22, 2017 :Dthank you very much!!!!!! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 22, 2017 Share Posted December 22, 2017 have a look at this code snippet should help (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes) (if (= oldtag1 (strcase ([color="red"]vla-get-tagstring[/color] att))) Quote Link to comment Share on other sites More sharing options...
AlexP Posted July 7, 2018 Share Posted July 7, 2018 I get the same thing. Have you managed to get the Lisp to copy/paste the Block Description on the Multileader? This is what happens when using the Lisp: Command: TEST Select block: Specify leader landing location: _.mleader Specify leader arrowhead location or [leader Landing first/Content first/Options] : _non Specify leader landing location: _non Specify landing distance : *Description of Block appears in command line* Specify landing distance : And then it disappears - Opens an empty Text box for me to write a Text on the MLeader.. The BNameLabel seems to work though Quote Link to comment Share on other sites More sharing options...
m1r Posted May 6, 2019 Share Posted May 6, 2019 On 6/12/2013 at 12:15 AM, alanjt said: (defun c:BNameLabel (/ ent entl obj) (cond ((not (setq ent (car (entsel "\nSelect block: "))))) ((not (eq (cdr (assoc 0 (entget ent))) "INSERT")) (princ "\nInvalid object!")) ((setq pt (getpoint "\nSpecify first point: ")) (setq entl (entlast)) (vl-cmdf "_.mleader" "_non" pt "\\") (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (vl-cmdf "")) (if (not (equal entl (setq entl (entlast)))) (vla-put-textstring (vlax-ename->vla-object entl) (vlax-get-property (setq obj (vlax-ename->vla-object ent)) (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name ) ) ) ) ) ) (princ) ) (vl-load-com) (princ) This is great, but someone can do the same as this, but to get the layer name? Many Thanks Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 15, 2019 Share Posted May 15, 2019 On 5/6/2019 at 3:57 AM, m1r said: This is great, but someone can do the same as this, but to get the layer name? Many Thanks Replace: (vlax-get-property (setq obj (vlax-ename->vla-object ent)) (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name ) ) with: (cdr (assoc 8 (entget ent))) Quote Link to comment Share on other sites More sharing options...
NicoleC Posted January 6, 2020 Share Posted January 6, 2020 Hi...I've been trying to use the lisp codes in this conversation to automatically label a block with its name, description or, better yet, its defined attribute. So far, I've only been able to get a multileader with a text field that prompts me to enter the tag number manually. I'm wanting it to read the blocks information and automatically output this in the text field. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
whysoserious Posted June 6, 2021 Share Posted June 6, 2021 Can somebody modify this code so that it reads a certain attribute in the block? And if possible, the text height of the multileader to be chosen by the user? I tried modify this myself but with no luck even though so much material can be found, I get all sorts of errors which I have no idea how to fix them. Thank you Quote Link to comment Share on other sites More sharing options...
noeljarod Posted December 14, 2021 Share Posted December 14, 2021 On 3/29/2011 at 11:11 AM, alanjt said: I was wondering if this can be updated/changed, so the TEXT on the multileade becomes a FIELD which points to the block name, so every time I change block's name definition it will be automatically updated on the multileader. Thanks in advance! Quote (defun c:BNameLabel (/ obj lastentity ent) (vl-load-com) (if (setq obj (car (entsel "\nSelect block: "))) (if (eq (cdr (assoc 0 (entget obj))) "INSERT") (progn (setq lastentity (entlast)) (vl-cmdf "_.mleader" "_non" (trans (vlax-get (setq obj (vlax-ename->vla-object obj)) 'InsertionPoint) 0 1) PAUSE ) (while (eq 1 (logand 1 (getvar 'CMDACTIVE))) (vl-cmdf "")) (if (not (equal lastentity (setq ent (entlast)))) (vla-put-textstring (vlax-ename->vla-object ent) (vlax-get-property obj (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name ) ) ) ) ) (princ "\nInvalid object!") ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 16, 2021 Share Posted December 16, 2021 There is an issue with this request that in a field a object ID is used. So if you change the block you will need to update the block ID in the field text, its possibly easier to erase and recreate. Modify the code previously posted. Quote Link to comment Share on other sites More sharing options...
Steffen P. Duvander Posted 23 hours ago Share Posted 23 hours ago Hello, I've been trying to modify this Lisp routine, to create Fields that shows the Visibility State of the Dynamic Block, in uppercase if possible. I know what to put in the Field command to get what i want, but i cant figure out how to code that into the Lisp routine. I've been googling for the past week to find a solution, but my skills in AutoLisp is limited. Is there anyway to do it? ; modified lsp found on : [url]http://www.cadtutor.net/forum/showthread.php?39301-Block-into-multileader-text/page2&highlight=leader[/url] (defun c:BLabel (/ blk entl pt visname) (cond ((not (setq blk (car (entsel "\nSelect block: "))))) ((not (eq (cdr (assoc 0 (entget blk))) "INSERT")) (princ "\nInvalid object!")) ((setq pt (getpoint "\nSpecify first point: ")) (setq entl (entlast) blk (vlax-ename->vla-object blk)) (vl-cmdf "_.mleader" "_non" pt "\\") (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (vl-cmdf "")) (if (and (not (equal entl (setq entl (entlast)))) (setq entl (vlax-ename->vla-object entl))) (if (setq visname (GetBVis blk)) (vla-put-textstring entl visname) (vla-put-textstring entl (vlax-get-property blk (if (vlax-property-available-p blk 'EffectiveName) 'EffectiveName 'Name)))))) ) (princ) ) ; just some ccp (cut copy paste) from my RlxBlk.lsp ; (GetBVis (vlax-ename->vla-object (car (entsel)))) ; get current visibility name block object (defun GetBVis ( %blk / blk dic bvp bvn) (if (and (vl-every '(lambda (p)(vlax-property-available-p %blk p)) '(isdynamicblock hasextensiondictionary effectivename)) (setq blk (vla-item (vla-get-blocks (vla-get-document %blk)) (vla-get-effectivename %blk))) (setq dic (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary blk)) "ACAD_ENHANCEDBLOCK")) (setq bvp (findaso "BLOCKVISIBILITYPARAMETER" (massoc 360 dic))) (setq bvn (cdr (assoc 301 bvp)))) (vl-some '(lambda (p) (if (= (vla-get-PropertyName p) bvn) (vlax-get p 'Value))) (vlax-invoke %blk 'getDynamicBlockProperties)))) (defun massoc ($i $l / a l)(while (setq a (assoc $i $l))(setq l (cons (cdr a) l) $l (cdr (member a $l))) l)) (defun FindAso ($v %l) (vl-some (function (lambda(x) (if (= $v (cdr (assoc 0 (setq e (entget x))))) e nil))) %l)) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted 9 hours ago Share Posted 9 hours ago Yes is simple answer. Look at the bottom line the output of the field statement, you have to duplicate this, you can copy it and paste to notepad then convert to a lisp strcat, you need to select the object to get the OBJECTID the number you see. 22735........ BUT it is different for every dwg or object so can use this. (setq objid (rtos (vla-get-Objectid obj) 2 0)) 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.