Filtering instances in CoCreate Modeling (08 Dec 2017)

Another interesting user question from the German user forum on CoCreate Modeling: Starting with a list of selected objects, how do I filter out shared instances?

The magic sauce: oli:sd-inq-obj-contents-sysid. The following code uses content sysids as the keys for a hash table. The unique-objects function returns the filtered list, i.e. a list which contains only one representative for any given number of shared instances.

(in-package :de.clausbrod.filterinstances)
(use-package :oli)

(defun unique-objects(objects) (let ((ht (make-hash-table :test 'equal))) (dolist (obj objects) (setf (gethash (oli:sd-inq-obj-contents-sysid obj) ht) obj)) (loop for obj being the hash-values of ht collect obj)))



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



to top

You are here: Blog > DefinePrivatePublic20171208FilterInstances

r1.1 - 08 Dec 2017 - 13:12 - ClausBrod to top

Blog
This site
RSS

  2017: 12 - 11 - 10
  2016: 10 - 7 - 3
  2015: 11 - 10 - 9 - 4 - 1
  2014: 5
  2013: 9 - 8 - 7 - 6 - 5
  2012: 2 - 10
  2011: 1 - 8 - 9 - 10 - 12
  2010: 11 - 10 - 9 - 4
  2009: 11 - 9 - 8 - 7 -
     6 - 5 - 4 - 3
  2008: 5 - 4 - 3 - 1
  2007: 12 - 8 - 7 - 6 -
     5 - 4 - 3 - 1
  2006: 4 - 3 - 2 - 1
  2005: 12 - 6 - 5 - 4
  2004: 12 - 11 - 10
  C++
  CoCreate Modeling
  COM & .NET
  Java
  Mac
  Lisp
  OpenSource
  Scripting
  Windows
  Stuff
Changes
Index
Search
Maintenance
Impressum
Datenschutzerklärung
Home



Jump:

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