Creo Parametric TOOLKIT User's Guide - PTC

Transcription

Creo Parametric TOOLKITUser’s Guide5.0.0.0

Copyright 2018 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.User and training guides and related documentation from PTC Inc. and its subsidiary companies (collectively"PTC") are subject to the copyright laws of the United States and other countries and are provided under alicense agreement that restricts copying, disclosure, and use of such documentation. PTC hereby grants to thelicensed software user the right to make copies in printed form of this documentation if provided on softwaremedia, but only for internal/personal use and in accordance with the license agreement under which theapplicable software is licensed. Any copy made shall include the PTC copyright notice and any otherproprietary notice provided by PTC. Training materials may not be copied without the express written consentof PTC. This documentation may not be disclosed, transferred, modified, or reduced to any form, includingelectronic media, or transmitted or made publicly available by any means without the prior written consent ofPTC and no authorization is granted to make copies for such purposes. Information described herein isfurnished for general information only, is subject to change without notice, and should not be construed as awarranty or commitment by PTC. PTC assumes no responsibility or liability for any errors or inaccuraciesthat may appear in this document.The software described in this document is provided under written license agreement, contains valuable tradesecrets and proprietary information, and is protected by the copyright laws of the United States and othercountries. It may not be copied or distributed in any form or medium, disclosed to third parties, or used in anymanner not provided for in the software licenses agreement except with written prior approval from PTC.UNAUTHORIZED USE OF SOFTWARE OR ITS DOCUMENTATION CAN RESULT IN CIVILDAMAGES AND CRIMINAL PROSECUTION.PTC regards software piracy as the crime it is, and we view offenders accordingly. We do not tolerate thepiracy of PTC software products, and we pursue (both civilly and criminally) those who do so using all legalmeans available, including public and private surveillance resources. As part of these efforts, PTC uses datamonitoring and scouring technologies to obtain and transmit data on users of illegal copies of our software.This data collection is not performed on users of legally licensed software from PTC and its authorizeddistributors. If you are using an illegal copy of our software and do not consent to the collection andtransmission of such data (including to the United States), cease using the illegal version, and contact PTC toobtain a legally licensed copy.Important Copyright, Trademark, Patent, and Licensing Information: See the About Box, or copyrightnotice, of your PTC software.UNITED STATES GOVERNMENT RIGHTSPTC software products and software documentation are “commercial items” as that term is defined at 48 C.F.R. 2.101. Pursuant to Federal Acquisition Regulation (FAR) 12.212 (a)-(b) (Computer Software) (MAY 2014)for civilian agencies or the Defense Federal Acquisition Regulation Supplement (DFARS) at 227.7202-1(a)(Policy) and 227.7202-3 (a) (Rights in commercial computer software or commercial computer softwaredocumentation) (FEB 2014) for the Department of Defense, PTC software products and softwaredocumentation are provided to the U.S. Government under the PTC commercial license agreement. Use,duplication or disclosure by the U.S. Government is subject solely to the terms and conditions set forth in theapplicable PTC software license agreement.PTC Inc., 140 Kendrick Street, Needham, MA 02494 USA

ContentsAbout This Guide .18Fundamentals .21Introduction to Creo Parametric TOOLKIT .22Online Documentation in Creo Parametric TOOLKIT APIWizard.22Creo Parametric TOOLKIT Style .23Installing Creo Parametric TOOLKIT .26Developing a Creo Parametric TOOLKIT Application .34Creo Parametric TOOLKIT Support for Creo Applications .52User-Supplied Main .52Asynchronous Mode .53Creo Parametric TOOLKIT Techniques .54Visit Functions .60Support for Creo Model Names and Files Paths .62Wide Strings.63String and Widestring Functions .64Accessing LearningConnector .65Core: Models and Model Items .67Modes .68Models.68Model Items .78Version Stamps .80Layers .81Notebook .86Visiting Displayed Entities .87Core: Solids, Parts, and Materials.88Solid Objects .89Part Objects . 110Material Objects . 111Core: Features. 118Feature Objects. 119Visiting Features. 119Feature Inquiry . 119Feature Geometry . 125Manipulating Features. 125Manipulating Features based on Regeneration Flags . 128Feature Dimensions. 130Manipulating Patterns . 130Creating Local Groups . 1323

Read Access to Groups . 132Updating or Replacing UDFs . 135Placing UDFs . 136The UDF Input Data Structure ProUdfdata. 138Reading UDF Properties . 144Notification on UDF Library Creation . 148Core: 3D Geometry . 149Geometry Objects. 150Visiting Geometry Objects . 151Tessellation . 160Evaluating Geometry . 163Geometry Equations . 166Ray Tracing. 172Measurement . 173Geometry as NURBS . 176Interference. 177Faceted Geometry . 179Core: Relations . 181Relations. 182Adding a Customized Function to the Relations Dialog in Creo Parametric. 184Core: Parameters. 187Parameter Objects. 188Parameter Values . 189Accessing Parameters . 189Designating Parameters Windchill Servers . 195Restricted Parameters . 195Table-Restricted Parameters . 196Driven Parameters. 198Core: Coordinate Systems and Transformations . 199Coordinate Systems . 200Coordinate System Transformations . 202Core: Family Tables. 207Family Table Objects. 208Family Table Utilities . 208Visiting Family Tables. 208Operations on Family Table Instances . 209Operations on Family Table Items . 211Core: External Data . 212Introduction to External Data . 213Storing External Data . 214Retrieving External Data . 216Core: Cross Sections. 218Listing Cross Sections. 219Extracting Cross-Sectional Geometry. 2194Creo Parametric TOOLKITUser’s Guide

Visiting Cross Sections. 222Creating and Modifying Cross Sections . 222Mass Properties of Cross Sections. 228Line Patterns of Cross Section Components . 229Core: Utilities . 234Configuration Options . 235Registry File Data . 235Trail Files . 236Creo Parametric License Data . 236Current Directory . 236File Handling . 236Wide Strings. 239Freeing Integer Outputs . 240Running Creo ModelCHECK . 241Core: Asynchronous Mode. 250Overview. 251Simple Asynchronous Mode . 252Full Asynchronous Mode . 255User Interface: Messages . 257Writing a Message Using a Popup Dialog . 258Writing a Message to the Message Window . 258Message Classification . 261Writing a Message to an Internal Buffer . 262Getting Keyboard Input . 263Using Default Values. 263User Interface: Ribbon Tabs, Groups, and Menu Items. 265Creating Ribbon Tabs, Groups, and Menu Items . 266About the Ribbon Definition File . 267Localizing the Ribbon User Interface Created by Creo Parametric TOOLKITApplications . 271Tab Switching Events . 271Support for Legacy Pro/TOOLKIT Applications. 272Migration of Legacy Pro/TOOLKIT Applications. 273User Interface: Menus, Commands, and Popupmenus. 274Introduction . 275Menu Buttons and Menus. 275Designating Commands . 283Popup Menus . 288Menu Manager Buttons and Menus. 293Customizing the Creo Parametric Navigation Area . 308Entering Creo Parametric Commands . 311User Interface: Dialogs . 316Introduction . 318UI Components . 319Cascade Button. 330Contents5

Checkbutton. 331Drawing Area . 333Input Panel. 342Label . 345Layout . 347List . 349Menubar . 352Menupane. 353Optionmenu . 355Progressbar . 357Pushbutton. 359Radiogroup . 361Separator. 363Slider . 364Spinbox . 366Tab . 368Table . 371Textarea. 379Thumbwheel . 382Tree. 384Master Table of Resource File Attributes. 396Using Resource Files . 413User Interface: Dashboards . 437Introduction to Dashboards. 438Dashboard . 438Dashboard Page . 440User Interface: Basic Graphics . 444Manipulating Windows . 445Flushing the Display Commands to Window . 450Solid Orientation . 450Graphics Colors and Line Styles . 453Displaying Graphics . 457Displaying Text . 458Validating Text Styles . 460Display Lists. 460Getting Mouse Input. 461Cosmetic Properties . 462Creating 3D Shaded Data for Rendering. 467User Interface: Selection. 470The Selection Object. 471Interactive Selection . 474Highlighting . 478Selection Buffer . 479User Interface: Curve and Surface Collection . 482Introduction to Curve and Surface Collection . 4836Creo Parametric TOOLKITUser’s Guide

Interactive Collection. 484Accessing Collection object from Selection Buffer . 487Adding a Collection Object to the Selection Buffer . 488Programmatic Access to Collections . 488Access of Collection Object from Feature Element Trees . 498Programmatic Access to Legacy Collections . 499Example 1: Interactive Curve Collection using Creo Parametric TOOLKIT. 500Example 2: Interactive Surface Collection using Creo ParametricTOOLKIT . 500User Interface: Animation. 502Introduction . 503Animation Objects . 504Animation Frames . 504Playing Animations . 505Annotations: Annotation Features and Annotations . 508Overview of Annotation Features . 509Creating Annotation Features . 509Redefining Annotation Features. 510Visiting Annotation Features . 511Creating Datum Targets . 511Visiting Annotation Elements . 512Accessing Annotation Elements. 513Modification of Annotation Elements . 515Automatic Propagation of Annotation Elements. 518Detail Tree . 519Access to Annotations. 520Converting Annotations to Latest Version . 524Annotation Text Styles. 524Annotation Orientation . 525Annotation Associativity . 527Interactive Selection . 529Display Modes. 529Designating Dimensions and Symbols. 529Dimensions . 530Notes. 561Geometric Tolerances . 569Accessing Set Datum Tags. 569Accessing Set Datums for Datum Axes or Planes. 573Surface Finish Annotations. 574Symbol Annotations . 576Annotations: Geometric Tolerances . 579Geometric Tolerance Objects. 580Visiting Geometric Tolerances. 580Reading Geometric Tolerances. 581Creating a Geometric Tolerance. 584Deleting a Geometric Tolerance . 590Contents7

Validating a Geometric Tolerance. 590Geometric Tolerance Layout . 590Additional Text for Geometric Tolerances . 591Geometric Tolerance Text Style. 592Prefix and Suffix for Geometric Tolerances . 593Parameters for Geometric Tolerance Attributes . 594Annotations: Designated Area Feature. 595Introduction to Designated Area Feature . 596Feature Element Tree for the Designated Area. 596Accessing Designated Area Properties. 598Data Management: Windchill Operations . 600Introduction . 601Accessing a Windchill Server from a Creo Parametric Session. 601Accessing the Workspace . 604Workflow to Register a Server. 606Aliased URL . 606Server Operations . 607Utility APIs . 622

Support for File Names in Non-Creo Models . 706 Character Support for File Names in Non-Creo Models. 706 Working with Multi-CAD Models in Creo Parametric TOOLKIT . 707 8 Creo Parametric TOOLKITUser's Guide