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?
- 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 ());
- }
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