Aftertouch Posted April 13, 2023 Posted April 13, 2023 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? Quote
BIGAL Posted April 14, 2023 Posted April 14, 2023 (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 April 14, 2023 by BIGAL Quote
Aftertouch Posted April 14, 2023 Author Posted April 14, 2023 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. Quote
BIGAL Posted April 14, 2023 Posted April 14, 2023 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) Quote
ronjonp Posted April 14, 2023 Posted April 14, 2023 This ? (ssget "_X" '((0 . "HATCH") (-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}"))) ) ) 1 Quote
Aftertouch Posted April 18, 2023 Author Posted April 18, 2023 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 ") ) ) ) Quote
ronjonp Posted April 18, 2023 Posted April 18, 2023 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) ) 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.