Some quick notes on performance.
This code --
(SSRemoveIf
'(lambda (ename)
(< (vla-get-length
(vlax-ename->vla-object ename)
)
10 ;; remove all lines less than 10 units long
)
)
(ssget "x" '((0 . "line")))
)
Is fine if the code will be executed once, but if the code will be executed multiple times, say in a process loop, better performance will be realized by committing the functionality to a formal function. This would remove the overhead associated with the creation of the temporary function for each iteration.
Example --
(defun Foo (ename)
(< (vla-get-length
(vlax-ename->vla-object ename)
)
10 ;; remove all lines less than 10 units long
)
)
(repeat n
(cond
( (setq ss
(SSRemoveIf
'Foo ;; note, quoted function
(ssget "x" '((0 . "line")))
)
)
;; now do something with the selection set ...
)
)
)
Still better performance can be realized if we remove the need for the function to be quoted:
(defun SSRemoveIf ( UnquotedFunction ss / i ename )
(cond
( (eq 'pickset (type ss))
(repeat (setq i (sslength ss))
(if
(UnquotedFunction
(setq ename
(ssname ss (setq i (1- i)))
)
)
(ssdel ename ss)
)
)
(if (< 0 (sslength ss)) ss)
)
)
)
Now call it using an unquoted function --
(SSRemoveIf
Foo ;; note, unquoted function call
(ssget "x" '((0 . "line")))
)
Finally1, if you are writing an application that must run as fast as possible, using generic functions / structures like above are probably not the way to go. In that case I would likely hand roll each function specifically for each task.
Finally2, also note that there are differences between activex calls and dxf equivalents -- sometimes activex wins, sometimes it doesn't. You may have to do some benching.
Enjoy.