CoCreate Modeling: Listing parts in Annotation views

The Integration Kit also has quite a number of inquiries which help with traversing the structure of a drawing. However, it can be a little tricky to get this right because of the involved data structures. Here is some code to get you started - it inquires the current viewset and, for each view in the viewset, lists the 3D parts which are in the component lists of those views.

;; -*-Lisp-*-
;; Description:  List parts in Annotation views
;; Author:       Claus Brod  
;; Language:     Lisp
;; (C) Copyright 2006 Claus Brod, all rights reserved
(use-package :oli)

;; list all 3D parts in the component list of an Annotation view
(defun list-parts-in-view(view)
  (let ((viewstruct (oli:sd-am-inq-view (getf view :view-2d))))
    (display (format nil "~%Parts in view ~A:~%"
           (oli:sd-inq-obj-pathname (getf view :view-3d))))
    (when viewstruct
      (dolist (comp (sd-am-view-struct-parts-3d viewstruct))
        (display (oli:sd-inq-obj-pathname comp))))))

;; traverse all views in viewset
(defun list-parts-in-viewset(viewset)
  (let ((viewsetstruct (sd-am-inq-view-set viewset)))
    (dolist (view (sd-am-view-set-struct-views viewsetstruct))
      (list-parts-in-view view))))

;; start from current viewset
(setf currviewset (oli:sd-am-inq-curr-view-set))
(list-parts-in-viewset currviewset)

-- ClausBrod - 23 Jan 2006

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

Revision: r1.6 - 30 Jul 2021 - 14:35 - ClausBrod
CoCreateModeling > OsdmMacros > MacroPartsInAnnotationViews
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