Jump to content

Recommended Posts

Posted

Hi all,

 

im having some issues with selecting annotative hatches.

In the vlax-dump-object there isnt any reference to annotative of a hatch.

In  the DXF groups there doesnt seems to be one either.

 

Only when i create a new annotative hatch, it adds DXF groep 102, wich i think is for annotative...

But when i turn annotative of, the 102 group is still there....

 

How can i make a ssget for only annotative hatches, wich is fool-proof?

Posted (edited)

It sounds like a lot of other selections CAD does not add a DXF code if not required, so can use the 102 to check does exist.

 

(setq sel (ssget "_X" (list '(0 . "HATCH")  '(102 . "{ACAD_XDICTIONARY"))))

 

Edited by BIGAL
Posted

Hi @BIGAL,

problem with the DXF group 102 is, when i turn off the 'Annotative' property. The DXF grou p102 stays present in the data of the entity.

 

So if a hatch was annotative originaly, but not anymore... above code will still select it. :-<

 

Stupid hatches. :D

Posted

Using filter helps only get hatch with a 102, but need to check deeper, an example.

 

(defun c:wow ()
(setq entp (car (entsel "\nPick objects ")))
(setq xdata (cadr (assoc -3 (entget ent '("AcadAnnotative")))))
(if (= (cdr (nth 4 xdata)) 1)
(alert "is annotative ")
(alert "Is not annotative ")
)
)
(c:wow)

 

 

Posted

This ?

(ssget
  "_X"
  '((0 . "HATCH")
    (-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}")))
   )
)

 

  • Like 1
Posted

Sorry for the late responce,

@BIGAL and @ronjonp

With some small mods, this is the final product that seems to work! 😁

This covers all options:

- Hatch created as non-annotative

- Hatch created as annotative and still is

- Hatch created as annotative, but had been changed to non-annotative.

This last option still holds the xdata, but the (nth 4 xdata) doesnt return 1 anymore. 👍

 

(defun c:wow ( / entp xdata )
	(setq entp (car (entsel "\nPick object: ")))
	(setq xdata (cadr (assoc -3 (entget entp '("AcadAnnotative")))))
	(if xdata
		(progn
			(if (= (cdr (nth 4 xdata)) 1)
				(alert "is annotative ")
				(alert "Is not annotative ")
			)
		)
		(progn
				(alert "Is not annotative ")
		)
	)
)

 

Posted

Glad you got something working :)

 

Here's your code refactored a bit with some error checking.

(defun c:wow (/ entp)
  (if (setq entp (car (entsel "\nPick object: ")))
    (if	(= 1 (cdaddr (cdadr (assoc -3 (entget entp '("AcadAnnotative"))))))
      (alert "Is annotative ")
      (alert "Is not annotative ")
    )
  )
  (princ)
)

 

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