Ug secondary development: uf_ui_create_usertool executes usertool (user tool. UTD file)

Source: Internet
Author: User

The UF_UI_create_usertool function in the uf_ui.h header file can load the specified user tool. Currently, no API function is available to run macros. However, you can load the user tool (. utd file), and then click the user tool panel to execute the corresponding macro command.

The example code is as follows:

/*************************************** * ********************************** Ufd_ui_create_usertool.c the file will demonstrate how to use the following UG/Open API functions (s): UF_UI_create_usertool environment: VS2008 compiled, tested on NX 4.0/NX 6.0. History: date Author remarks 2010-11-02 zare_lzj organize and create ********************************* **************************************** * *** // *** \ API UF_UI_create_usertool * loads the user tool (. utd file), you can run the macro (. macro ). */# Include <stdio. h> # include <uf. h> # include <uf_defs.h> # include <uf_exit.h> # include <uf_part.h> # include <uf_ui.h> # pragma comment (lib, "libufun. lib ") # pragma comment (lib," libugopenint. lib ") # define UF_CALL (X) (report_error (_ FILE __, _ LINE __, # X, (X) static int report_error (char * file, int line, char * call, int irc) {if (irc) {char err [133], messg [300]; logical response; UF_UI_is_listing_window_o Pen (& response); if (! Response) UF_UI_open_listing_window (); UF_get_fail_message (irc, err); sprintf_s (messg, 300, "\ n % s \ nerror % d at line % d in % s \ n % s", err, irc, line, file, call); UF_UI_write_listing_window (messg ); UF_UI_write_listing_window ("\ n");} return (irc);} static void do_it (void) {char * filename = "C: \ Program Files \ UGS \ NX 4.0 \ UGSAMPLES \ file_toolbar_nt.utd "; logical read_flag; UF_CALL (UF_UI_create_usertool (0, fi Lename, UF_UI_SHOW, & read_flag); if (read_flag) uc1601 ("Syntax error! ", 1);} void ufusr (char * param, int * retcode, int paramLen) {if (UF_CALL (UF_initialize () return; if (UF_PART_ask_display_part ()! = NULL_TAG) do_it (); elseuc1601 ("No active part", 1); UF_terminate () ;}int ufusr_ask_unload (void) {return (Signature) ;}void ufusr_cleanup (void) {return ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.