[Previous Page] [Next Page] [Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]

Modeling/Annotator Communication: Dialog Generation

Table of Contents

General overview

Writing dialogs for the Annotation module is almost as easy as writing dialogs for the core product.

There are just a few things to take care of.

Selection of Annotator objects

Syntax

Annotator objects can be selected using the keywords

:selection
requires a list of select foci.
:select-attribute
is an optional keyword and can be set to

Result

The result returned after having picked into the viewport can be used to inquire

Example

Task: "Write a dialog to delete lines and circles created by the user"

Solution 1: using sd-get-annotator-position:

;; this is Creo Elements/Direct Modeling LISP code
(in-package :oli)
(sd-defdialog 'sd-delete-user-line-circle
  :dialog-control :sequential-loop
  :variables '(
      (delete-start
        :selection
            (*sd-anno-line-seltype* *sd-anno-circle-seltype*)
        :select-attribute
            :docu-user-geo-only
        :prompt-text
            ("Pick lines/circles to be deleted" 1)
        :after-input
            (sd-execute-annotator-command :cmd
              (format nil
                "DELETE SELECT GLOBAL ~A CONFIRM END"
                (sd-get-annotator-position
                  :object delete-start)
              ))
      )
    )
  )

Solution 2: using sd-get-annotator-reference

;; this is Creo Elements/Direct Modeling LISP code
(in-package :oli)
(sd-defdialog 'sd-delete-user-line-circle
  :dialog-control :sequential-loop
  :variables '(
      (delete-start
        :selection
            (*sd-anno-line-seltype* *sd-anno-circle-seltype*)
        :select-attribute
            :docu-user-geo-only
        :prompt-text
            ("Pick lines/circles to be deleted" 1)
        :after-input
            (sd-execute-annotator-command :cmd
              (format nil
                "DELETE SELECT GLOBAL POINTER ~A CONFIRM END"
                (sd-get-annotator-reference
                  :object delete-start)
              ))
      )
    )
  )

Receiving a raw pick

Sometimes it is required not to select an existing Annotator object but to simply get a certain position in 2D space by picking into empty space. Creating a polygon of lines is a typical task requiring this functionality.
To get a point simply set the value type

:docupntcnp

The LISP object returned is of type GPNTDOCU.

GPNTDOCU [structure]

(gpntdocu_x gpntdocu)
(gpntdocu_y gpntdocu)
Description:
The structure used to represent the x,y coordinates of a 2d point in the Annotation view port.
Slots:
x {LONG-FLOAT [0.0]} - the x coordinate of the 2d point
y {LONG-FLOAT [0.0]} - the y coordinate of the 2d point

Example

Task: "Write a dialog to create rectangles"

;; this is Creo Elements/Direct Modeling LISP code
(in-package :oli)
(sd-defdialog 'sd-am_geo_rectangle
  :dialog-control :sequential-loop
  :variables '(
      (rectangle-start
        :value-type :docupntcnp
        :prompt-text ("Indicate corner of rectangle" 1)
        :after-input (sd-execute-annotator-command :cmd
                       (format nil "LINE ASSIST RECTANGLE ~A,~A"
                                   (gpntdocu_x rectangle-start)
                                   (gpntdocu_y rectangle-start)))
      )
      (rectangle-end
        :value-type :docupntcnp
        :prompt-text ("Indicate opposite corner of rectangle" 2)
        :after-input (sd-execute-annotator-command :cmd
                       (format nil "~A,~A"
                                   (gpntdocu_x rectangle-end)
                                   (gpntdocu_y rectangle-end)))
        :next-variable rectangle-start
      )
    )
  :ok-action '(sd-execute-annotator-command :cmd "end")
  :cancel-action '(sd-execute-annotator-command :cmd "end")
  )
[Previous Page] [Next Page] [Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]
© 2024 Parametric Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved