Use. NET (C # or vb.net) to develop NX external programs

Source: Internet
Author: User

1. How do I not copy the EXE program to the UGII directory?

A: Before calling the NX Open command function, move the current directory to the NX installation directory \UGII\,NX the installation directory must match the value of the environment variable Ugii_base_dir, otherwise error. You can use the following code:

Dim  as String = environment.getenvironmentvariable ("ugii_base_dir") System.IO.Directory.SetCurrentDirectory (Instaldir)

2. My external program is very small, do not want to package NX's. NET library files to publish together, but use the user's library files, how to do?

A: The first step, display all the project files, expand the Application.myapp file, then open the Application.Designer.vb file, add the Startup event callback function for MyApplication, add the following code in it:

 dim  ufdir as  string  = environment.getenvironmentvariable ( "  ugii_base_dir   " ) Reflection.Assembly.LoadFrom (IO. Path.Combine (Ufdir,   " \ugii\managed\ NXOpen.dll   " )) Reflection.Assembly.LoadFrom (IO. Path.Combine (Ufdir,   " \ugii\managed\ NXOpen.UF.dll   " )) Reflection.Assembly.LoadFrom (IO. Path.Combine (Ufdir,   " \ugii\managed\ NXOpen.Utilities.dll   )) 

The second step, modify the program run configuration file: Your exe program file name. config

<?XML version= "1.0" encoding= "Utf-8"?><Configuration>    <Runtime>        <assemblybindingxmlns= "Urn:schemas-microsoft-com:asm.v1">            <dependentassembly>                <assemblyidentityname= "Nxopen"Culture= "neutral"PublicKeyToken= "NULL"/>                <CodeBaseversion= "8.0.2.2"href= "File://d:\program files\siemens\nx 8.0\ugii\managed\nxopen.dll"/>            </dependentassembly>            <dependentassembly>                <assemblyidentityname= "Nxopen.uf"Culture= "neutral"PublicKeyToken= "NULL"/>                <CodeBaseversion= "8.0.2.2"href= "File://d:\program files\siemens\nx 8.0\ugii\managed\nxopen.uf.dll"/>            </dependentassembly>            <dependentassembly>                <assemblyidentityname= "Nxopen.utilities"Culture= "neutral"PublicKeyToken= "NULL"/>                <CodeBaseversion= "4.0.0.0"href= "File://d:\program files\siemens\nx 8.0\ugii\managed\nxopen.utilities.dll"/>            </dependentassembly>        </assemblybinding>    </Runtime></Configuration>

Use. NET (C # or vb.net) to develop NX external programs

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.