Jump to content

Entity in dyn. block - visible or not


VAC

Recommended Posts

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 by VAC
Link to comment
Share on other sites

  • VAC changed the title to Entity in dyn. block - visible or not

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 by Emmanuel Delay
Link to comment
Share on other sites

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 by VAC
Link to comment
Share on other sites

I updated the code.

I forgot dfx. Refresh the page, copy paste again.

 

Edit:  Happy with this?

Does it work ?

Edited by Emmanuel Delay
Link to comment
Share on other sites

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