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

Miscellaneous Utilities

sd-rgb-to-hsl
sd-hsl-to-rgb
sd-color-to-rgb
sd-rgb-to-color

sd-sys-to-user-units
sd-user-to-sys-units

sd-intf

sd-display-error
sd-display-help-page
sd-display-message
sd-display-warning
sd-display-question
sd-display-alert
sd-display-url

sd-redraw-vp
sd-request-redraw-vp
sd-vp-add-title-postfix
sd-remove-add-title-postfix

sd-render-to-file

sd-call-win-command-by-sysid

sd-show-console-window
sd-hide-console-window
sd-browse-for-folder

SD-RGB-TO-HSL  [function]

(sd-rgb-to-hsl rgb-color)
Description:
Returns a vector containing the hsl (hue,saturation,luminance) equivalent of the rgb (red,green,blue) input vector.

Parameters:
rgb-color {GPNT3D} - the rgb color vector to be converted

Return Value:
hsl-vector {GPNT3D} - the hsl equivalent color vector

Function Index Top of Page

SD-HSL-TO-RGB  [function]

(sd-hsl-to-rgb hsl-color)
Description:
Returns a vector containing the rgb equivalent of the hsl input vector.

Parameters:
hsl-color {GPNT3D} - the hsl color vector to be converted

Return Value:
rgb-vector {GPNT3D} - the rgb equivalent color vector

Function Index Top of Page

SD-COLOR-TO-RGB  [function]

(sd-color-to-rgb color)
Description:
Returns a vector containing the rgb (red, green, blue) equivalent of the color input (Starbase).

Parameters:
color {FIXNUM} - the color value (Starbase) to be converted

Return Value:
rgb-vector {GPNT3D} - the rgb equivalent color

Function Index Top of Page

SD-RGB-TO-COLOR  [function]

(sd-rgb-to-color rgb-value)
Description:
Returns a color value (Starbase) equivalent to the passed rgb (red, green, blue) vector.

Parameters:
rgb-value {GPNT3D} - the rgb vector to be converted

Return Value:
color {FIXNUM} - the color value (Starbase)

Function Index Top of Page

SD-SYS-TO-USER-UNITS  [function]

(sd-sys-to-user-units unit-type value)
Description:
Converts a value from internal system units (mm, rad, g), to the current user units.

Parameters:
unit-type {KEYWORD}, value {} - must be one of the following pairs:
        :length  {NUMBER}
        :area    {NUMBER}
        :volume  {NUMBER}
        :angle   {NUMBER}
        :mass    {NUMBER}
        :density {NUMBER}
        :inertia {NUMBER}
        :2d-crd  {GPNT2D}
        :3d-crd  {GPNT3D}
        :axis    {LIST '(GPNT3D GPNT3D)}
Return Value:
value - the converted value
nil
if the value could not be converted (for example, the unit-type is not a recognized type).

Function Index Top of Page

SD-USER-TO-SYS-UNITS  [function]

(sd-user-to-sys-units unit-type value)
Description:
Converts a value from user units, to the current internal system units (mm, rad, g).

Parameters:
unit-type {KEYWORD}, value {} - must be one of the following pairs:
        :length  {NUMBER}
        :area    {NUMBER}
        :volume  {NUMBER}
        :angle   {NUMBER}
        :mass    {NUMBER}
        :density {NUMBER}
        :inertia {NUMBER}
        :2d-crd  {GPNT2D}
        :3d-crd  {GPNT3D}
        :axis    {LIST '(GPNT3D GPNT3D)}
Return Value:
value - the converted value
nil
if the value could not be converted (for example, the unit-type is not a recognized type).

Function Index Top of Page

SD-INTF  [function]

(sd-intf connection command :external-format external-format)
Description:
This function allows you to communicate with other Creo Elements/Direct applications like Creo Elements/Direct Drafting or WorkManager.

Parameters:
connection {STRING}
Name of the interlink connection. The following list shows the names of connections which will be available to other Creo Elements/Direct applications (established via accept_connections):
  • "HP ME10 IL" - Creo Elements/Direct Drafting
  • "SolidDesigner IL" - Creo Elements/Direct Modeling
  • "HP PEWM IL" - WorkManager
command {STRING} - command which shall be called in the other application
external-format {KEYWORD :legacy}
Optional parameter to specify the encoding of the inter-process communication. For details on string encoding see here.
The currently supported encodings are:
  • :legacy - Encoding of the OneSpace product suite up to revision 2006 (rev. 14) - this encoding can be used to communicate with any version of the OneSpace product suite, characters that cannot be converted will be lost.
  • :utf-8 - Unicode encoding - lossless communmication with products starting with the OneSpace 2007 (rev. 15) suite.

Return Value:
t - if command could be passed via connection
nil - otherwise

Example:
  (sd-intf "HP ME10 IL" "line 0,0 100,100")

Function Index Top of Page

SD-DISPLAY-ERROR  [function]

(sd-display-error message :help-action help-action)
Description:
Displays the message in the error box and waits for acknowledgement.

Parameters:
message {STRING} - The text to display.
:help-action {LISP-Form [nil]}
If a help action is specified a push button will appear in the error dialog. Pressing the button will execute the help action. Since this dialog runs in a modal loop the action rather displays, for example, a help page in a browser window than shows another dialog shell.

Return value:
t - in all cases

Example:
(setq a-value 42)
(sd-display-error (format nil "Value ~S is too large for this operation."
                          a-value)
                  :help-action '(sd-display-url "http://www.ptc.com"))

Function Index Top of Page

SD-DISPLAY-HELP-PAGE  [function]

(sd-display-help-page :context context-name :pageId page-name)
Description:
Generates a help request in the context context-name with the page Id page-name. If the page exists in the specified context, help will pop up the requested information.

Parameters:
:context {STRING ["pesd"]} - the context name
:pageId {STRING} - the page identifier name

Return value:
t - if help page exists and could be displayed
nil - help page in given context does not exist

Examples:
(sd-display-help-page :context "Help" :pageId "INTRODUCTION")
(sd-display-help-page :pageId "RECTANGLE")

Function Index Top of Page

SD-DISPLAY-MESSAGE  [function]

(sd-display-message message :title title :push button-label  :help-action help-action)
Description:
Displays the message in the message box and waits for acknowledgement.
Note: If a command (sd-defdialog) contains a call to this function a playback of a recorder file containing this command will stop and will require manual interaction. This problem can be avoided by integrating the confirmation interaction into the command railroad as described in the Dialog Generator Manual.

Parameters:
message {STRING}
The text to display.
:title {STRING ["Message"]}
Optional parameter to specify the message box title.
:push {STRING ["OK"]}
Optional parameter to specify the button label.
:help-action {LISP-Form [nil]}
Optional parameter to specify a help action, see sd-display-error.

Return value:
t - in all cases

Example:
(setq a-number 42)
(sd-display-message (format nil "You have checked ~S entities." a-number))

Function Index Top of Page

SD-DISPLAY-WARNING  [function]

(sd-display-warning message
                    :title title :push-1 button1-label :push-2 button2-label
                    :severity severity :help-action help-action :push-other other-button-label)
Description:
Displays the message in the warning box and waits for acknowledgement. The user input is returned as result of the function.
Note: If a command (sd-defdialog) contains a call to this function a playback of a recorder file containing this command will stop and will require manual interaction. This problem can be avoided by integrating the confirmation interaction into the command railroad as described in the Dialog Generator Manual.

Parameters:
message {STRING}
The text to display.
:title {STRING ["Warning"]}
Optional parameter to specify the warning box title.
:push-1 {STRING ["Continue"]}
Optional parameter to specify the label of button1.
:push-2 {STRING ["Cancel"]}
Optional parameter to specify the label of button2.
:severity {KEYWORD [:none]}
Specifies the color of the exclamation mark and the border that drawn around the text of the warning window.
  • :none - default color
  • :low - yellow
  • :medium - orange
  • :high - red
:help-action {LISP-Form [nil]}
Optional parameter to specify a help action, see sd-display-error.
:push-other {STRING [""]}
Optional parameter to specify the label of an "Other" button. If specified, the other button is placed between the first and second button.

Return value:
:yes - The user pressed the first button. (continue)
:no - The user pressed the second button. (abort)
:other - The user pressed the other button. (other)

Example:
(setf input (sd-display-warning "The value is in a critical range. Do you really want to accept it?"))
(if (eql input :yes)
     (do-it)
  (return)
  )

Function Index Top of Page

SD-DISPLAY-QUESTION  [function]

(sd-display-question message
                     :title title :push-1 button1-label :push-2 button2-label)
Description:
Displays the message in the question box and waits for acknowledgement. The user input is returned as result of the function.
Note: If a command (sd-defdialog) contains a call to this function a playback of a recorder file containing this command will stop and will require manual interaction. This problem can be avoided by integrating the confirmation interaction into the command railroad as described in the Dialog Generator Manual.

Parameters:
message {STRING}
The text to display.
:title {STRING ["Question"]}
Optional parameter to specify the question box title.
:push-1 {STRING ["Yes"]}
Optional parameter to specify the label of button1.
:push-2 {STRING ["No"]}
Optional parameter to specify the label of button2.

Return value:
:yes - The user pressed the first button.
:no - The user pressed the second button.

Example:
(setf input (sd-display-question "Do you really want to perform this action?"))
(if (eql input :yes)
     (do-it)
  (return)
  )

Function Index Top of Page

SD-DISPLAY-ALERT  [function]

(sd-display-alert message
                  :icon icon
                  :auto-close-time auto-close-time
                  :desktop-relative desktop-relative)
Description:
Displays the message in a small popup window which appears either in the lower right corner of the desktop or in the lower right corner of the application frame's viewport area. The window automatically disappears after the specified close time elapsed or can be closed manually by pressing the close button.

Parameters:
message {STRING}
The text to display.
:icon {KEYWORD [:warning]}
Optional parameter to specify the icon to be displayed. Available icons are:
  • :info
  • :error
  • :warning
  • :question
  • :success
:auto-close-time {FIXNUM [5]}
Optional parameter to specify the time in seconds after the alert window closes automatically.
:desktop-relative {BOOLEAN [nil]}
Optional parameter to specify whether the window appears in the lower right corner of the desktop or of the viewport area.

Return value:
t - successfully displayed
nil - otherwise

Example:
(sd-display-alert "The action terminated successfully." :icon :success)

Function Index Top of Page

SD-DISPLAY-URL  [function]

(sd-display-url url)
Description:
Tries to display the specified URL in Creo Elements/Direct Modeling's help browser (e.g. Netscape).
NOTE: If you want to display a HTML file, simply pass its filename to this function instead of prefixing it with file:.

Parameters:
url {STRING} - the URL to display

Return value:
t - in all cases

Example:
(sd-display-url "http://www.ptc.com")
(sd-display-url "c:/temp/index.html")
(sd-display-url "/users/joe/home.html")

Function Index Top of Page

SD-REDRAW-VP  [function]

(sd-redraw-vp &optional viewport)
Description:
This function causes the immediate redraw of viewport. If no viewport is specified, all existing viewports will be redrawn.

Parameters:
viewport {STRING}
Optional parameter. Pass the name of an existing viewport if just this viewport should be redrawn. Omit this parameter to redraw all existing viewports.

Return value:
t - in all cases

Function Index Top of Page

SD-REQUEST-REDRAW-VP  [function]

(sd-request-redraw-vp &optional viewport)
Description:
This function causes a redraw of viewport with the next interactive event. That way you can delay redraws until the next interactive event. Even if multiple redraws were requested, just one will be done on interactive event.
If no viewport is specified, all existing viewports will request to be redrawn.

Parameters:
viewport {STRING}
Optional parameter. Pass the name of an existing viewport if just this viewport should be redrawn. Omit this parameter to redraw all existing viewports.

Return value:
t - in all cases

Function Index Top of Page

SD-VP-ADD-TITLE-POSTFIX  [function]

(sd-vp-add-title-postfix viewport postfix)
Description:
This function adds the postfix string to the viewport name within the title of the viewport

Parameters:
viewport {STRING}
postfix {STRING}

Return value:
nil - in all cases

Function Index Top of Page

SD-RENDER-TO-FILE  [function]

(sd-render-to-file filename width height 
                    :viewport viewport
                    :keep-viewport-aspect-ratio keep-viewport-aspect-ratio
                    :format format
                    :quality quality)
Description:
This function generates a photo-realistic rendering of the model currently displayed in viewport and stores it in filename.

Parameters:
filename {STRING}
The name of the file to store the image into. No checks are done about existence of this file. The function tries to open the file for writing and returns with an error if this fails. Otherwise the current file content is silently overwritten. The extension of the given filename should match the specified format.
width {NUMBER}
The width of the rendered image. The parameter might be ignored if keep-viewport-aspect-ratio is set to t.
height {NUMBER}
The height of the rendered image. The parameter might be ignored if keep-viewport-aspect-ratio is set to t.
:viewport {STRING [nil]}
Optional parameter. The name of the viewport to use for rendering. If omitted or set to nil the current viewport is used.
:keep-viewport-aspect-ratio {BOOLEAN [t]}
Optional parameter. If set to t the image will be generated using the same aspect ratio as used by the viewport window. In this case the smaller value of width and height is ignored; the new value is calculated using the larger of both values and the viewport windows aspect ratio.
:format {KEYWORD [:jpg]}
Optional parameter. Specifies which image format is used to generated the image file. Available formats are
  • :jpg or :jpeg
  • :tif or :tiff
  • :bmp
  • :png
:quality {KEYWORD [:current]}
Optional Parameter. Specifies a quality parameter to generate the image.
  • :fast
  • :accurate
  • :current - Use the settings as currently specified in the Rendering Settings dialog of the Rendering module.

Return value:
t - on success
:interrupt - If the rendering has been interrupted.
nil - otherwise

Function Index Top of Page

SD-VP-REMOVE-TITLE-POSTFIX  [function]

(sd-vp-remove-title-postfix viewport)
Description:
This function removes any postfix string (added with the function above) from the viewport name within the title of the viewport

Parameters:
viewport {STRING}

Return value:
nil - in all cases

Function Index Top of Page

SD-CALL-WIN-COMMAND-BY-SYSID  [function]

(sd-call-win-command-by-sysid sysid)
Description:
This function performs commands depending on the sysid passed. The sysids for the commands can be found in personality\sd_customize\sd_avail_cmds.cmd.

Parameters:
sysid {NUMBER} Specifies the type of command that will be executed.

Return value:
t - success
nil - failure

Example:
tile window horizontal
(sd-call-win-command-by-sysid 57651)

Function Index Top of Page

SD-SHOW-CONSOLE-WINDOW  [function]

(sd-show-console-window)
Description:
This function opens the console window. No action when the console window is already open.

Remark:
When starting Creo Elements/Direct Modeling with the -v / -verbose option the console window is opened automatically. To have this console window minimized start Creo Elements/Direct Modeling with -vm.

Return value:
t - success
nil - failure

Example:
(sd-show-console-window)

Function Index Top of Page

SD-HIDE-CONSOLE-WINDOW  [function]

(sd-hide-console-window)
Description:
This function closes the console window. No action when the console window is already closed.

Return value:
t - success
nil - failure

Example:
(sd-hide-console-window)

Function Index Top of Page

SD-BROWSE-FOR-FOLDER  [function]

(sd-browse-for-folder prompttext)
Description:
This function displays a dialog which lets the user choose a directory.

Parameters:
prompttext {STRING} Prompt text to display in the dialog

Return value:
directory path {STRING} on success
nil - failure

Example:
(setf dest-dir (sd-browse-for-folder "Choose destination directory:"))
[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]
© 2023 Parametric Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved