青华模具培训学校

 找回密码
 注册

QQ登录

只需一步,快速开始

青华模具培训学院
查看: 2927|回复: 0

[转载] Build a NX Open .NET application

[复制链接]
发表于 2009-6-30 19:11 | 显示全部楼层 |阅读模式
A basic setup to build a NX Open .NET application using Visual Studio (IDE)
/ J6 e7 v: o2 `9 ?Interactive Application: .NET authoring license is required; @% d0 O; v: n! r( n9 O) R1 K1 l; t
Start Visual Studio 2003 (7.1)
& p) m; t/ u9 e5 T: @6 v% xCreate class library project$ i: T; t& Z* b$ H$ Y& w  c- `. P
File -> New -> Project -> Visual C# Projects (project types) -> Class Library 7 G" W2 Y1 ?" ^! G4 g' p
Add references6 y) _; |; S1 a% Y/ {, W
Project -> Add Reference… 2 w% z4 N! B% J$ f) Y6 c
Browse to ugII_BASE_DIR\UGII\managed\
) ?& {# A: [& n# q9 j) _Add the following files/ S/ `0 S: \0 A! |9 e# W
NXOpen.dll
0 U: t4 N* [! S: mNXOpen.Utilities.dll
7 @( j; ]3 @- N" o4 O8 g  g  kNXOpen.UF.dll 1 S9 p2 a9 Y& T5 a- D: l4 t5 H
NXOpenUI.dll (only needed if you build an user interface for your application) 6 \5 m/ b, [: Q$ S, C. w
Add Main() function to the class7 u4 ?; S( l! f9 h
public static void Main()% K$ s  J' O) s& h. p
{
$ X& ~2 e+ I1 Q$ g7 C; Y}# [( f$ k' o* x# e+ d
Compile and build the application
- _( |# q- k. o5 z/ C. }Test Appilcation:) y, ^7 n3 z7 {; A* X
Launch NX7 z) p9 V  h  T3 l, X
Run your sample application, Q7 |0 ~5 b) @8 S( I* r
File -> Execute -> NX/Open… (browse to your sample application \bin\Debug\ location, select your application.dll) 6 l" v0 ?. {2 j( g4 }8 U4 V! w, l% j
Sign Application:
# g1 _9 A! g" \* a7 a4 m/ {In order to release an application and have non programers use this (someone without a .NET authoring license) you need to sign your application.
1 K3 k# ~+ a2 s, c5 n& ^4 c2 w/ N: JAdd resource file NXSigningResource.res to your Visual Studio project( e* M3 {1 O, H5 O8 ^" `3 M5 q! o1 R
File -> Add Existing Item -> browse to UGII_BASE_DIR\UGOPEN\NXSigningResource.res
+ V; ^2 {& Z' C8 BSet the NXSigningResource.res file Build Action to Embedded Resource
3 U* ~. R: Z5 c. j: o- l/ n3 RProperties on the NXSigningResource.res file that’s attached to your Visual Studio project
" Y) ]' l4 \+ K5 D; F6 Z- USign the application, at a command prompt:
: q# ~1 x; _( O  s- @8 n5 NUGII_BASE_DIR\UGII\SignLibrary.exe yourSampleApplicationLocation\sampleApplication.dll
( V% p+ g2 E+ s: f8 IIf you don’t sign your application when you release it to your end users, they will be required to have a “.NET authoring license”. This is very costly and unnecesary.
+ G9 F( Y9 m# H5 d5 NSet your Project Configuration Build to Release
/ Z4 i# ~( ]2 U! F. Y' yThis will change the build arguments and remove the unnecessary debug statements for the released application
4 c: b5 p3 D% s- D1 pBuild -> Configuration Manager 9 u) {$ ~% \3 n+ ~
Set “Active Solution Configuration” to Release
  ]) V$ _3 Q- e$ P  T7 D+ eCompile, Build, and test
9 n- G. k7 z0 l+ g4 }3 C" U$ W2 L, j. rSummary0 O8 l, P3 ]3 U! A. [% G
This application does not do anything but it does set up the foundation needed to get an application built using the Visual Studio IDE and have it signed for release.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|关于我们|sitemap|小黑屋|Archiver|手机版|UG网-UG技术论坛-青华数控模具培训学校 ( 粤ICP备15108561号 )

GMT+8, 2025-6-28 05:15 , Processed in 0.091958 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表