About the external mode of UG

Source: Internet
Author: User

Someone asked me about the ug external mode.

This is a mode used when the ug interface is not required for the second development of UG. Ug open only supports some APIs.

Internal Mode is called by the plug-in of UG.

Therefore, even the external mode cannot run without ug.

Previously, when C/C ++ was used for development, internal's program was DLL, while external's program was exe.

Using the. NET language, internal can also be written as exe.

Internal uses the entry functions specified by UG, such as main and starup.

External only has one entry function main.

Although both development modes of UG use the same set of APIS, whether or not they are supported depends on the description.

For example

Uf_part_open (View Source)

Defined in: uf_part.h

Overview

Retrieves an existing NX part or Solid Edge part into the session and
Makes it the work and display part. Solid Edge parts (. Par,. PSM,. pwd or. ASM
File Extension) are opened by extracting the parasolids data from the solid
Edge part and then importing this data into a new NX part
With a. PRT extension. The file name of the new NX part has the solid
Edge part name and a ". PRT" file extension. If there is an existing NX
Part with the same name as the Solid Edge part, then this function
Returns an error.
The NX part file that you create by opening a Solid Edge part
File contains one or more unparameterized solid bodies.
Other files can be opened with this call. The following
Extensions are valid-. UDF,. BKM,. xpk and. JT. Foreign files with
Following extensions can also be opened with uf_part_open-. Ig,. STP,
. DXF,. DWG and. model.
If a part is a read-only part, and the part retrieval modifies the part,
You will receive the error code uf_part_err_read_only_modified, for that
Part when you call uf_part_open. In this case uf_part_open will not
Return a zero status.

Environment

Internal and external

======================================

Uf_disp_create_image (View Source)

Defined in: uf_disp_ugopenint.h

Overview

Export a PNG/JPEG/tiff/GIF/xwd/BMP full window area image
Creates an image file with the file type you specify using the image
Currently displayed in the graphics window.

Return

Return code:
= 0 no error
= Not 0 error code, including:
Uf_disp_err_failed_to_create_image_file
Standard UF error codes

Environment

Internal
Uf_disp_create_image (View Source)

Defined in: uf_disp_ugopenint.h

Overview

Export a PNG/JPEG/tiff/GIF/xwd/BMP full window area image
Creates an image file with the file type you specify using the image
Currently displayed in the graphics window.

Return

Return code:
= 0 no error
= Not 0 error code, including:
Uf_disp_err_failed_to_create_image_file
Standard UF error codes

Environment

Internal

In addition, if you want to run the external mode, you need to add the UGII directory to the path of the Windows path. Otherwise, the DLL cannot be found during running.

This is an example of the external program using. net.

View plaincopy to clipboardprint?

  1. Try
  2. {
  3. Session thesession = session. getsession ();
  4. Console. writeline ("OK ");
  5. Part thepart = thesession. parts. newdisplay (@ "E: \ ugnx6 \ test. PRT", part. Units. millimeters );
  6. Partsavestatus PS = thepart. Save (nxopen. basepart. savecomponents. True, nxopen. basepart. closeaftersave. True );
  7. Console. writeline (PS. tostring ());
  8. }
  9. Catch (NXOpen. NXException ex)
  10. {
  11. Console. WriteLine (ex. ToString ());
  12. }

Try {session thesession = session. getsession (); console. writeline ("OK"); Part thepart = thesession. parts. newdisplay (@ "E: \ ugnx6 \ test. PRT ", part. units. millimeters); partsavestatus PS = thepart. save (nxopen. basepart. savecomponents. true, nxopen. basepart. closeaftersave. true); console. writeline (PS. tostring ();} catch (nxopen. nxexception ex) {console. writeline (ex. tostring ());}

Original: http://blog.csdn.net/begtostudy/archive/2009/01/25/3852773.aspx

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.