Author Topic: Looking for a Qselect routine...  (Read 2356 times)

0 Members and 1 Guest are viewing this topic.

AVCAD

  • Guest
Looking for a Qselect routine...
« on: July 10, 2013, 11:00:31 AM »
So I have become in need for a Qselect routine...I use Qselect to select COGO points (Civil) by Raw Description so that I can move the selected to a certain layer. I know when you set up the point styles and what not you can have this automated...the company i work for did not set it up this way and I dont want to remake the template file, they are really iffy about me doing that stuff so I just work around it...i know its dumb but we all deal with it I am sure.

Anyways...i do this same routine over and over again which is really time consuming...does anyone know of a routine that is available or how to make one?

Thanks in advance.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Looking for a Qselect routine...
« Reply #1 on: July 10, 2013, 12:14:37 PM »
Are you talking about filter?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

AVCAD

  • Guest
Re: Looking for a Qselect routine...
« Reply #2 on: July 10, 2013, 12:28:06 PM »
if it works sure...but I currently use Qselect

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Looking for a Qselect routine...
« Reply #3 on: July 10, 2013, 12:49:29 PM »
This should work for you:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:qselpts (/ *ACAD* *AECCAPP* *AECCDOC* APPSTR DESC GRPS POINT POINT#S POINTS QBLDR TMPGRP VRSN)
  2.     (vl-load-com)
  3.   (cond ((vl-string-search "R16.2" vrsn)(setq appstr "3.0"));;2006
  4.         ((vl-string-search "R17.0" vrsn)(setq appstr "4.0"));;2007
  5.         ((vl-string-search "R17.1" vrsn)(setq appstr "5.0"));;2008
  6.         ((vl-string-search "R17.2" vrsn)(setq appstr "6.0"));;2009
  7.         ((vl-string-search "R18.0" vrsn)(setq appstr "7.0"));;2010
  8.         ((vl-string-search "R18.1" vrsn)(setq appstr "8.0"));;2011
  9.         ((vl-string-search "R18.2" vrsn)(setq appstr "9.0"));;2012
  10.         ((vl-string-search "R19.0" vrsn)(setq appstr "10.0"));;2013
  11.         ((vl-string-search "R19.1" vrsn)(setq appstr "10.3"));;2014
  12.         (t (alert "This version of C3D not supported!"))
  13.         )
  14.   (if (and appstr
  15.            (or *acad*
  16.                (setq *acad* (vlax-get-acad-object))
  17.                )
  18.            (or *AeccApp*
  19.                (setq *AeccApp* (vla-getinterfaceobject *acad*
  20.                                  (strcat "AeccXUiLand.AeccApplication." appstr)))
  21.                )
  22.            (or *AeccDoc*
  23.                (setq *AeccDoc* (vlax-get *AeccApp* 'ActiveDocument))
  24.                )
  25.            (setq ss (ssadd))
  26.            )
  27.     (progn
  28.       (setq desc (getstring "\nPlease enter the Raw Description to filter on: " t)
  29.             grps (vlax-get *AeccDoc* 'PointGroups)
  30.             tmpgrp (vlax-invoke grps 'Add "__TEMP__")
  31.             )
  32.       (setq qbldr (vlax-get tmpgrp 'querybuilder))
  33.       (vlax-put qbldr 'IncludeRawDescriptions desc)
  34.       (if (> (length (setq point#s (vlax-get tmpgrp 'Points))) 0)
  35.         (progn
  36.           (setq points (vlax-get *AeccDoc* 'Points))
  37.           (foreach pt# point#s
  38.             (setq point (vlax-invoke points 'Find pt#))
  39.             (ssadd (vlax-vla-object->ename point) ss)
  40.             )
  41.           )
  42.         )
  43.       (vlax-invoke qbldr 'clear)
  44.       (vlax-invoke grps 'remove "__TEMP__")
  45.       )
  46.     )
  47.   (sssetfirst ss ss)
  48.   (princ)
  49.   )

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Looking for a Qselect routine...
« Reply #4 on: July 11, 2013, 04:41:08 PM »
I use this:

Code: [Select]
(defun c:SP (/ flt ss add i e o)
  ;; Select AECC (Civil 3D) points
  ;; Alan J. Thompson, 09.08.10 / 05.03.11 (rewrite)

  (if (and (/= (setq flt (strcase (getstring T "\nAecc Point Description Selection Filter: "))) "")
           (setq ss (ssget "_A" '((0 . "AECC_COGO_POINT"))))
      )
    (progn
      (setq add (ssadd))
      (repeat (setq i (sslength ss))
        (setq e (ssname ss (setq i (1- i)))
              o (vlax-ename->vla-object e)
        )
        (if (vl-some '(lambda (prop / c)
                        (and (not (vl-catch-all-error-p
                                    (setq c (vl-catch-all-apply 'vlax-get-property (list o prop)))
                                  )
                             )
                             (wcmatch (strcase c) flt)
                        )
                      )
                     '(Description FullDescription RawDescription)
            )
          (ssadd e add)
        )
      )
      (sssetfirst nil add)
      (ssget "_I")
    )
  )
  (princ)
)
(vl-load-com)
(princ)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox