OneSpace Designer code examples: Using get_selection
get_selection
is one of the most powerful APIs in the Integration
Kit. It can be used to perform all kinds of selections in the model.
All the selection criteria which you find in the UI are available; in addition
you can specify filter functions which are called during selection.
But this is advanced usage; let's start with something
very simple:
Using
get_selection
to list all names of parts in an assembly. Not very
useful in itself, but you can start building your own selections
from there.
; -*-Lisp-*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; File: allparts.lsp
; Description: Trivial get_selection usage example
; Author: Claus Brod
; Language: Lisp
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :clausbrod.de)
(use-package :oli)
(sd-defdialog 'LIST_PART_NAMES
:dialog-title "List part names in assembly"
:toolbox-button t
:variables '(
(assembly :value-type :assembly :modifies nil))
:ok-action '
(dolist (part (sd-call-cmds
(get_selection :focus_type *sd-part-seltype*
:select :recursive
:in_assembly assembly)))
(display (sd-inq-obj-basename part)))
)
--
ClausBrod
to top