VAC Posted September 13, 2023 Posted September 13, 2023 (edited) Hi, how to get information in LISP about any entity in the dyn. block, in which visibility state it is visible or not? The goal is to read values of only actually visible attributes (in the current visibility state) . I have just functions that give me: block name, attribute name and value, visibility parameter name, current visibility state name. I do not know, where it is stored? Many thanks Edited September 16, 2023 by VAC Quote
Emmanuel Delay Posted September 18, 2023 Posted September 18, 2023 (edited) I got a solution. Here I list all attributes in a list (tag value visible) Is this what you're looking for? I can further filter out the invisible attributes if you wish (Just updated, a function was missing, sorry) (defun dxf (code ent / ) (if (entget ent) (if (assoc code (entget ent)) (cdr (assoc code (entget ent))) ) ) ) ;; reads attributes - prints if the block is visible (defun items_of_block_atts ( ent / atts tag val is_visible) (setq atts (list)) (while (not (eq "SEQEND" (dxf 0 (setq ent (entnext ent))))) ;;(setq type (dxf 0 ent)) ;; LINE, CIRCLE, ATTDEF, ... ;(setq layer (dxf 8 ent)) ;; layer (setq tag (dxf 2 ent)) ;; tag (setq val (dxf 1 ent)) ;; value of a text, or attribute ... (setq is_visible (if (= :vlax-true (vla-get-visible (vlax-ename->vla-object ent))) "visible" "invisible" ) ) (setq atts (append atts (list (list tag val is_visible) ))) ;;(princ "\n\n") ;;(princ tag) ;;(princ " - Is visible: ") ;;(princ (vla-get-visible (vlax-ename->vla-object ent))) ) ;; atts ) (defun c:test3 ( / ) (princ "\nSelect block with visibulity state: ") (setq ent (SSNAME (SSGET '((0 . "INSERT"))) 0)) (princ "\nAttributes in the insert: \n") (items_of_block_atts ent) ) Edited September 18, 2023 by Emmanuel Delay Quote
VAC Posted September 18, 2023 Author Posted September 18, 2023 (edited) Hi, thank you,but : ; chyba: no function definition: DXF? I found this on web somehow and it works: MANY THANKS (defun dxf (code something) (if something (cdr (assoc code (cond ((= 'ename (type something)) (entget something)) ((and (= 'list (type something)) (vl-every 'vl-consp something)) something) ((= 'vla-object (type something)) (entget (vlax-vla-object->ename something))) ) ) ) ) ) Edited September 18, 2023 by VAC Quote
Emmanuel Delay Posted September 18, 2023 Posted September 18, 2023 (edited) I updated the code. I forgot dfx. Refresh the page, copy paste again. Edit: Happy with this? Does it work ? Edited September 18, 2023 by Emmanuel Delay 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.