Jump to content

How to Check if Dynamic Block has Linear parameters


Recommended Posts

Posted (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

image.png.ac93a19dc84c8f9a281c34d953d36643.png

Edited by handasa
Posted

u would need to go into block editor, then parameters manager (command _PARAMETERS).

It would be on the list.

 

-ChriS

Posted
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.

Posted

thanks Magnum,i want to get the property type not the property name

Posted
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
)

 

Posted (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 by Lee Mac
  • Like 1
Posted
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

  • 3 years later...
Posted

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..

 

 

Posted
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.

Posted (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 by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...