CoCreate Modeling code examples: List modified parts

This is a trivial variation of MacroDeleteMatchingParts. Instead of checking whether the name of a part in a selection matches a given pattern, we check its modification status; if it has been modified since it was loaded, it will be listed in the output box.

The dialog expects a list of parts as input; if you want to check the modification status of all parts in an assembly, use a "recursive/in assembly" selection.

Unfortunately, this code does not work as expected for parts loaded from the database. Future versions of CoCreate Modeling will probably address this, and I'll update the code below when this happens.

;; Description:  Lists modified parts in a selection
;; Author:       Claus Brod
;; Created:      10/26/2005 14:00    
;; Language:     Lisp
;; (C) Copyright 2005 Claus Brod, all rights reserved
(use-package :oli)

(sd-defdialog 'LIST_MODIFIED_PARTS
  :dialog-title "List modified parts" :toolbox-button t

  :variables '(
    (parts :value-type :part-assembly :multiple-items t :modifies nil))

  :local-functions '(
    (list-modified (item)
      (when (sd-inq-obj-contents-modified-p item)
        (display (format nil "Modified: ~A~%" (sd-inq-obj-pathname item))))))

  :ok-action '(mapc #'list-modified parts)

-- ClausBrod - 26 Oct 2005

OSDM 2006 fixes the issue described above by adding a new keyword parameter :check-database to sd-inq-obj-contents-modified-p. Here's the new version of the local function list-modified:

    (list-modified (item)
      (when (sd-inq-obj-contents-modified-p item :check-database t)
        (display (format nil "Modified: ~A~%" (sd-inq-obj-pathname item))))))

-- ClausBrod - 27 Jan 2006

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

to top

You are here: CoCreateModeling > OsdmMacros > MacroListModifiedParts

r1.11 - 24 Jul 2009 - 19:56 - ClausBrod to top

CoCreate ModelingRSS
  Operating system
  Memory management
  File handling
  App. knowhow
Code examples

  • My links
  • Show me topics of interest



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


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