I think I need to stop over thinking this..
;;Function to add a PointGroup if it doesn't exist.
(defun CreatePG (grpname / C3D C3Ddoc exists grps)
(vl-load-com)
(if (and (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
C3D (vl-registry-read C3D "Release")
C3D (substr
C3D
1
(vl-string-search
"."
C3D
(+ (vl-string-search "." C3D) 1)
)
)
C3D (vla-getinterfaceobject
(vlax-get-acad-object)
(strcat "AeccXUiLand.AeccApplication." C3D)
)
)
(setq C3Ddoc (vla-get-activedocument C3D))
(setq grps (vlax-get C3Ddoc 'pointgroups))
)
(progn
(vlax-for pg grps
(if (eq (vlax-get pg 'name) grpname)
(setq exists pg)
)
)
(if (not exists)
(setq exists (vlax-invoke-method grps 'Add grpname))
)
)
)
exists
)
(defun intstorangedstring (ints / sorted result x y )
(setq sorted (vl-sort ints '>)
x (car sorted)
sorted (cdr sorted)
result (list (vl-princ-to-string x))
)
(while (setq y (car sorted))
(setq sorted (cdr sorted))
(cond
((and (= (1+ y) x) (= (1- y) (car sorted)))
(if (/= (car result) "-") (setq result (cons "-" result)))
)
((= (car result) "-")
(setq result (cons (vl-princ-to-string y) result))
)
((setq result (cons (vl-princ-to-string y) (cons "," result))))
)
(setq x y)
)
(apply 'strcat result)
)
;;once the above is loaded, call the function with the desired PointGroup name
(setq pg (createPG "NO DISPLAY"))
(setq pgquery (vlax-get pg 'querybuilder))
;;(setq pnString (intstorangedstring '(1 3 4 5 8 10 11 14 15 16)))
(setq pnString "1-10,20-25")
(vlax-put pgquery 'includenumbers pnString)