CoCreate 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


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

to top

You are here: CoCreateModeling > OsdmMacros > MacroGetSelection

r1.5 - 24 Jul 2009 - 19:55 - ClausBrod to top

CoCreateModeling
CoCreate ModelingRSS
FAQ
  Introduction
  Hardware
  Operating system
  Memory management
  File handling
  Installation
  Licensing
  Graphics
  App. knowhow
  Lisp
    Learning
    Programming
    Debugging
    DDE
    Compiler
    Customization
  Troubleshooting
  Links
Code examples
Viewbench
News
Changes
Index
Search
Impressum
Home

  • My links
  • Show me topics of interest

TWiki

Welcome


TWiki Web TWiki Web Home Changes Topics Index Search


TWiki Webs Atari Blog Main OneSpaceModeling? Sandbox TWiki TWiki Webs Atari Blog Main OneSpaceModeling? Sandbox TWiki

Jump:

Copyright © 1999-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback