handasa Posted December 14, 2020 Posted December 14, 2020 (edited) Hello i need a way to check if a dynamic block has a linear parameter or Not BY autolisp. i don't need the value itself.i just wanna check if it has the type of "linear parameter" or not thanks in advance Edited December 15, 2020 by handasa Quote
ammobake Posted December 15, 2020 Posted December 15, 2020 u would need to go into block editor, then parameters manager (command _PARAMETERS). It would be on the list. -ChriS Quote
handasa Posted December 15, 2020 Author Posted December 15, 2020 6 hours ago, ammobake said: u would need to go into block editor, then parameters manager (command _PARAMETERS). It would be on the list. -ChriS thank you ChriS.i want a way to check without using the bedit command. Quote
Magnum Z Posted December 15, 2020 Posted December 15, 2020 Here's a couple resources I found in a quick search. That is if a Lisp is what you're after. *whisper* - You didn't mention that part by the way. https://www.theswamp.org/index.php?topic=49681.0 https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/obtaining-dynamic-block-property-information-with-autolisp/td-p/5127510 Quote
handasa Posted December 15, 2020 Author Posted December 15, 2020 thanks Magnum,i want to get the property type not the property name Quote
Magnum Z Posted December 15, 2020 Posted December 15, 2020 This looks like it'll take time to understand, but this might be your best bet. http://poleshchuk.spb.ru//cad/2009/tainypode.htm Quote
handasa Posted December 15, 2020 Author Posted December 15, 2020 3 minutes ago, Magnum Z said: This looks like it'll take time to understand, but this might be your best bet. http://poleshchuk.spb.ru//cad/2009/tainypode.htm Thanks Alot.i found a lisp written by Lee Mac and i modified it a little bit to check if the block has Stretch parameters or not. it will return a list of the parameters names (defun is-stretched (blk / plst) (if (and (vlax-property-available-p blk 'effectivename) (setq blk (vla-item (vla-get-blocks (vla-get-document blk)) (vla-get-effectivename blk) ) ) (= :vlax-true (vla-get-isdynamicblock blk)) (= :vlax-true (vla-get-hasextensiondictionary blk)) (mapcar '(lambda ( pair ) (and (= 360 (car pair)) (or (wcmatch (cdr (assoc 0 (entget (cdr pair)))) "BLOCKLINEARPARAMETER") (wcmatch (cdr (assoc 0 (entget (cdr pair)))) "BLOCKPOLARPARAMETER") ) (setq plst (cons (cdr (assoc 305 (entget (cdr pair)))) plst)) ) ) (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary blk)) "ACAD_ENHANCEDBLOCK" ) ) ) ) plst ) Quote
Lee Mac Posted December 15, 2020 Posted December 15, 2020 (edited) Perhaps: (defun linearparam-p ( blk / ent ) (and (setq ent (tblobjname "block" blk)) (setq ent (cdr (assoc 360 (member '(102 . "{ACAD_XDICTIONARY") (entget (cdr (assoc 330 (entget ent)))))))) (vl-some '(lambda ( x ) (and (= 360 (car x)) (= "BLOCKLINEARPARAMETER" (cdr (assoc 0 (entget (cdr x))))))) (dictsearch ent "acad_enhancedblock")) ) ) _$ (linearparam-p "dynamic_block") T Edited December 15, 2020 by Lee Mac 1 Quote
handasa Posted December 16, 2020 Author Posted December 16, 2020 21 hours ago, Lee Mac said: Perhaps: (defun linearparam-p ( blk / ent ) (and (setq ent (tblobjname "block" blk)) (setq ent (cdr (assoc 360 (member '(102 . "{ACAD_XDICTIONARY") (entget (cdr (assoc 330 (entget ent)))))))) (vl-some '(lambda ( x ) (and (= 360 (car x)) (= "BLOCKLINEARPARAMETER" (cdr (assoc 0 (entget (cdr x))))))) (dictsearch ent "acad_enhancedblock")) ) ) _$ (linearparam-p "dynamic_block") T thanks Lee.this did the trick.thanks alot Quote
A.Lach Posted August 7 Posted August 7 Hi, It is possible to change this code to check if block contain a visibility parameter? I have tried to do it based on your last code, but with no luck.. Quote
Lee Mac Posted August 7 Posted August 7 3 hours ago, A.Lach said: It is possible to change this code to check if block contain a visibility parameter? I have tried to do it based on your last code, but with no luck.. Sure - (defun visibilityparam-p ( blk / ent ) (and (setq ent (tblobjname "block" blk)) (setq ent (cdr (assoc 360 (member '(102 . "{ACAD_XDICTIONARY") (entget (cdr (assoc 330 (entget ent)))))))) (vl-some '(lambda ( x ) (and (= 360 (car x)) (= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr x))))))) (dictsearch ent "acad_enhancedblock")) ) ) Alternatively, you could use my Get Visibility Parameter Name function, or the function I posted here. Quote
BIGAL Posted August 7 Posted August 7 (edited) Multi radio buttons.lspUsing Lee's great code Get visibility you can get all the values and pop them into a DCL so choose which one to use. An example, you need to download Lee's dynamic block lisp and give it a name edit code to suit. ; Change dynamic block properties when inserting look at properties available. ; By Alan H June 2022 ;; Get Dynamic Block Property Allowed Values - Lee Mac ;; Returns the allowed values for a specific Dynamic Block property. ;; Set Dynamic Block Visibility State - Lee Mac ;; Sets the Visibility Parameter of a Dynamic Block (if present) to a specific value (if allowed) ;; Get Visibility Parameter Name - Lee Mac ;; Returns the name of the Visibility Parameter of a Dynamic Block (if present) (defun insdynv (blkname / pt obj lst ans) (if (not LM:setdynpropvalue )(load "Lee-mac Dynamic block get-put")) (setq pt (getpoint "\nPick a pt for block ")) (command "-insert" blkname "s" 1.0 pt 0) (setq obj (vlax-ename->vla-object (entlast))) (setq visval (LM:getvisibilityparametername obj)) (setq lst (LM:getdynpropallowedvalues obj visval)) (setq lst (cons "Please choose" lst)) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (not AHbut)(setq AHbut 1)) (setq ans (ah:butts 1 "v" lst)) (LM:SetVisibilityState obj ans) (princ) ) Edited August 7 by BIGAL 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.