TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: nobody on March 03, 2013, 05:34:38 AM
-
I am trying to filter an entsel by checking if a vla object is a "AeccDbFeatureLine" using an "if" statement. for example:
(if (= objname "AeccDbFeatureLine")(do something)(else quit command)....
Any thoughts about this? I'd like to keep the entsel for it's single object selection behavior and can't find how to force a filter on it.
Thanks!
-
Not sure:
(if(setq obj (ssget "_:S:E" '((0 . "AECC_FEATURE_LINE"))))
(do something)
)
-
Not sure:
(if(setq obj (ssget "_:S:E" '((0 . "AECC_FEATURE_LINE"))))
(do something)
)
Thanks PBE... that was my alternate approach... trying to avoid the ssget function for this specific scenerio...really wish they built in filtering with entsel.
-
really wish they built in filtering with entsel.
Here is a simple alternative:
;; Select if Object - Lee Mac
;; Continuously prompts the user for selection of an
;; entity matching the given entity type pattern.
;;
;; Arguments:
;; msg - Selection prompt
;; typ - Entity type wildcard pattern, e.g. "*LINE"
;;
;; Returns: ename of selected entity, else nil
(defun LM:SelectIfObject ( msg typ / ent )
(while
(progn (setvar 'errno 0) (setq ent (car (entsel msg)))
(cond
( (= 7 (getvar 'errno))
(princ "\nMissed, try again.")
)
( (= 'ename (type ent))
(if (not (wcmatch (cdr (assoc 0 (entget ent))) (strcase typ)))
(princ "\nInvalid object selected.")
)
)
)
)
)
ent
)
For your case, call with:
(LM:SelectIfObject "\nSelect Feature Line: " "AECC_FEATURE_LINE")
-
Thanks!! :-)
really wish they built in filtering with entsel.
Here is a simple alternative:
;; Select if Object - Lee Mac
;; Continuously prompts the user for selection of an
;; entity matching the given entity type pattern.
;;
;; Arguments:
;; msg - Selection prompt
;; typ - Entity type wildcard pattern, e.g. "*LINE"
;;
;; Returns: ename of selected entity, else nil
(defun LM:SelectIfObject ( msg typ / ent )
(while
(progn (setvar 'errno 0) (setq ent (car (entsel msg)))
(cond
( (= 7 (getvar 'errno))
(princ "\nMissed, try again.")
)
( (= 'ename (type ent))
(if (not (wcmatch (cdr (assoc 0 (entget ent))) (strcase typ)))
(princ "\nInvalid object selected.")
)
)
)
)
)
ent
)
For your case, call with:
(LM:SelectIfObject "\nSelect Feature Line: " "AECC_FEATURE_LINE")
-
Here are some old routines to look at.
http://www.theswamp.org/index.php?topic=19808.0
-
Here are some old routines to look at.
http://www.theswamp.org/index.php?topic=19808.0
Thank you CAB! I see several approaches in there. Really appreciate it.