OneSpace Designer macros: 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


When asked for a TWiki account, use your own or the default TWikiGuest account.

Revision: r1.3 - 18 Dec 2006 - 20:40 - ClausBrod
CoCreateModeling > OsdmMacros > MacroGetSelection
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback