Author Topic: is it smart / good to use vlax-get-property 'objectname to filter  (Read 2059 times)

0 Members and 1 Guest are viewing this topic.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
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!

pBe

  • Bull Frog
  • Posts: 402
Re: is it smart / good to use vlax-get-property 'objectname to filter
« Reply #1 on: March 03, 2013, 07:25:50 AM »

Not sure:
Code: [Select]
(if(setq obj (ssget "_:S:E" '((0 . "AECC_FEATURE_LINE"))))
(do something)
)





nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: is it smart / good to use vlax-get-property 'objectname to filter
« Reply #2 on: March 03, 2013, 08:53:24 AM »

Not sure:
Code: [Select]
(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.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: is it smart / good to use vlax-get-property 'objectname to filter
« Reply #3 on: March 03, 2013, 09:01:11 AM »
really wish they built in filtering with entsel.

Here is a simple alternative:

Code: [Select]
;; 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:
Code: [Select]
(LM:SelectIfObject "\nSelect Feature Line: " "AECC_FEATURE_LINE")

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: is it smart / good to use vlax-get-property 'objectname to filter
« Reply #4 on: March 03, 2013, 09:12:09 AM »
Thanks!!  :-)

really wish they built in filtering with entsel.

Here is a simple alternative:

Code: [Select]
;; 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:
Code: [Select]
(LM:SelectIfObject "\nSelect Feature Line: " "AECC_FEATURE_LINE")

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: is it smart / good to use vlax-get-property 'objectname to filter
« Reply #5 on: March 03, 2013, 01:18:12 PM »
Here are some old routines to look at.
http://www.theswamp.org/index.php?topic=19808.0
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: is it smart / good to use vlax-get-property 'objectname to filter
« Reply #6 on: March 03, 2013, 01:50:45 PM »
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.