NX1855, NXOpen, VS2017
Hi, can someone let me know where to place the env variable for the *.dlx file to be found by NX upon execution of the DLL.
UGII_USER_DIR=C:\Users\CWilson\Desktop\block\block\bin\Debug (*in ugii_env_ug.dat)
UGII_USER_DIR=C:\Users\CWilson\Desktop\block\block\bin\Debug\startup (*in ugii_env_ug.dat)
UGII_USER_DIR=C:\Users\CWilson\Desktop\block\block\bin\Debug (*in custom_dirs.dat)
UGII_USER_DIR=C:\Users\CWilson\Desktop\block\block\bin\Debug\startup (*in custom_dirs.dat)
Windows 10 > Environment variables > System Variables
^^ None of the above worked and still couldn't find the *.dlx file
If however I declared the path in the code, everything works fine.
theSession = Session.GetSession(); theUI = UI.GetUI(); //theDlxFileName = "C:\\Users\\CWilson\\Desktop\\block\\block\\bin\\Debug\\BlocktestUI.dlx"; <=== works fine theDlxFileName = "BlocktestUI.dlx"; <=== does not work
theDialog = theUI.CreateDialog(theDlxFileName); theDialog.AddApplyHandler(new NXOpen.BlockStyler.BlockDialog.Apply(apply_cb)); theDialog.AddOkHandler(new NXOpen.BlockStyler.BlockDialog.Ok(ok_cb)); theDialog.AddUpdateHandler(new NXOpen.BlockStyler.BlockDialog.Update(update_cb)); theDialog.AddInitializeHandler(new NXOpen.BlockStyler.BlockDialog.Initialize(initialize_cb)); theDialog.AddDialogShownHandler(new NXOpen.BlockStyler.BlockDialog.DialogShown(dialogShown_cb));
Solved! Go to Solution.
Ignore, found the solution.
1) Create a custom folder for the plugin e.g. C:\Users\CWilson\Desktop\Custom
2) Add "application" e.g. C:\Users\CWilson\Desktop\Custom\application\
3) Add "startup" e.g. C:\Users\CWilson\Desktop\Custom\startup\
4) Save *.dlx into "application" folder
5) Save *.dll into "startup" folder
6) Add variable to custom plugin folder into ugii_env_ug.dat e.g. UGII_USER_DIR=C:\Users\CWilson\Desktop\Custom
and it works.
NX searches in the subdirectory named appliction for the dlx files.
Edit: to late
There is code available in this forum to embed the DLX file into the DLL, no more hassle ;-)
Search for Embedded_DLX to find it.
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0
Employees of the customers, together we are strong
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide
That would certainly work and make things easier to manage. I'll see if I can convert this idea into C# and make it work.
Appreciate the heads up. I knew you could ILmerge dlls into exe but didn't know you could embed xml into a dll. Interesting, thanks to JimB
Found a way to get DLX to load without having to code too much. Although embedding the dlx works fine, this one only requires +2 extra lines of code to make it work. No need to set ugii_env variables, just place your blockUI's DLX in the same folder where the DLL is residing and done. Hope this helps anyone.
+: using System.IO; +: public static string pathToDLX = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory)); \: theDlxFileName = pathToDLX + "\\BlocktestUI.dlx";