PLM之家精品课程培训

PLM之家精品课程培训

联系电话:18301858168   |   QQ咨询:939801026
NX二次开发培训

NX二次开发培训

UFUN/NXOpen C++和实战案例

适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术。
公众号二维码

关注公众号

点击扫描二维码免费在线高清教程

课程详情
Catia二次开发培训

Catia二次开发培训

市场需求大,掌握核心技术前景广阔

Catia二次开发的市场需求大,人才稀缺。掌握开发技能潜力巨大,随着经验积累将在汽车、航空等领域有所作为。
B站二维码

在线原创B站视频

点击关注工业软件传道士主页

课程详情
Teamcenter培训

Teamcenter培训

全方位培训,从基础应用到高级开发全覆盖

涵盖用户应用基础培训、管理员基础培训、管理员高级培训及二次开发培训等全方位内容,由多年经验讲师打造。
QQ群二维码

加入同行交流

点击扫描二维码加入QQ群

课程详情
×

PLM之家plmhome公众号

课程涵盖: PLM之家所有原创视频

×

关注B站视频

所有高清视频一览无余,全部在线播放学习

×

加入PLM之家QQ群

同行交流,疑问解答,更多互助

PLM之家PLMHome-国产软件践行者

[原创] 使用eclipse进行NX二次开发的设置步骤

[复制链接]

2015-2-25 13:02:01 4646 0

admin 发表于 2015-2-25 13:02:01 |阅读模式

admin 楼主

2015-2-25 13:02:01

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
DebUGging NXOpen Java with NX8 and Eclipse IDE * D: u1 X$ S' q1 F# I3 O  \
; e7 J6 [4 ]9 {3 x: ^
(see PDF in the ZIP file for a pictorial description)$ ~2 ?) K  ~- e

- q+ ^# A; E+ Q8 ^Installation of Java and Eclipse
: r$ a7 ~5 s: D' K" [
/ q& g9 l1 d9 O0 {  B  C& u1). t/ T3 v; i8 E
Download and install the Java Standard Edition Developer Kit Java SE 6 (1.6.0_14 or higher) from
$ A( i% b. P& x& L, Uhttp://www.oracle.com/technetwor ... ownloads/index.html 1 \% d6 Z5 }2 J6 c* z

0 F+ G7 F+ M& ?; o7 @# D2)
7 c7 M; X- X& h" G( pDownload the Eclipse IDE for Java Developers from http://www.eclipse.org/downloads 3 @! Z+ f4 h# r3 V- `$ ?
and extract the ZIP and its ‘eclipse’ directory content to your preferred path, for example “d:\eclipse”
# w2 L, p- q+ C, Z4 b+ m: Z2 c' j

+ a2 S+ l) v- Z6 a- J3 |Create a project with Eclipse   
( y9 r) e$ Q" l! ?# w9 ]# b- i8 f/ y1 l" v9 {, k
3)3 o8 `; G0 ^8 Z! t  }/ P6 k7 E
Start the Eclipse IDE, for example “d:\eclipse\eclipse.exe”! y1 y9 d* ?/ w. v- U: `

. Z* G' E9 `' o7 w4)& l% C% U3 d) ]4 ^
You will be asked for the location of your Workspace folder which is comparable to the MyProjects folder in Microsoft Visual Studio
5 G" g0 K$ j& k+ K! Z8 b6 ~! q5 @
5)& R9 y: g6 H* H! T- C5 x* T% E% I
Create a new Java Project by File -> New -> Java Project
2 _" J7 L. L; v( R0 a; C, k7 y9 u) M2 H/ T! b! w
6)
1 e( u4 |/ }2 G& p8 E4 z1 {, iEnter a project name and continue with Next1 x8 |* z* r) R- s0 f: p% f
) G" H9 l: y$ ?8 t- d
7)
: U7 K. I& h# ~On the Libraries Tab add the external NXOpen Jar packages and Finish
5 O8 s$ I2 h6 T1 L$ P. m* K  d, g7 l; ]4 A" Z7 U6 F/ l
8)
! j9 _  j! \5 t9 X8 G& s9 d- CIn the Package Explorer window make a right click on the project name and create a new Package (Namespace)  
0 r0 o) v& H& u# V; b& M& G$ R% `8 W# E0 N4 C$ Q" @
9) # v- {( o: g. X; f4 N& Y1 C
Enter a package name and Finish
+ g( S7 \0 R7 r# {6 K9 Z- b( ~2 G  M3 V( a1 z" H; P9 V; R& s
10)3 e9 j7 ^1 |3 g( D
In the Package Explorer window make a right click on the Package name and create a new Class    6 O) P5 A9 y4 I

  L* Y' o/ w# i" ?' Z( ?11)' i) L+ ?* q& f, C9 x, I
Enter a Class name and uncheck all method stubs options
+ }1 j0 ]1 L* H! j) U7 R" ~0 d8 g8 @4 f4 a: N$ ~
12)
7 g8 y$ H- d6 KNow you have a project created with an empty class so it’s time to complete the source code and we use the NX Journal Recording.$ _1 I' M. ?2 X
First we set the NX journal language to Java by Preferences -> User Interface -> Journal -> Journal Language -> Java
. d& M' P0 ^  |: z
) m1 P4 I( r6 w) C- l: A# i13)( l( w# Y! V9 v; j  G( ]  Z# I
Start Recording by Tools -> Journal -> Record. Y! y# u( q) f* z7 w! n
1 t5 [. k8 n4 Y" D( C3 b  p. o+ L
14)
  I  E5 u$ Y3 Z& a: ACreate a Block and finish the journal by Tools -> Journal -> Stop Recording
$ W; t% r. I2 l/ m* _8 v, H( ]/ d5 I
15)
3 ?& B4 O2 e+ u9 ~8 kOpen the Journal Editor by Tools -> Journal -> Edit and copy/paste the Imports and Methods to your project source file
8 G% M+ @+ q7 n/ K9 Z7 I1 ]/ _4 X7 ^& c4 L+ ]6 V% ]' H
16)& {, G3 u/ c  T+ |, }" s
Make a right click in your source window and select Source -> Format to reformat the source contents with “Eclipse rules”
+ Z; L* c! t# \4 X& ?, M5 v5 R* X+ ~# o5 C! }3 `/ d0 D4 g
17)
) r/ n+ L8 P$ w- D; F, EFinally we create the Jar file which is mandatory in case our package contains more than one class.* U5 X9 Q. x( Q. h/ W
In the Package Explorer right click on the project name and select Export -> JAR file -> Next
3 j3 Y- w% t( V. A; N4 @
% G; _1 G) J4 _" U18)% T9 Z# C( ?) {2 \: l' d7 o' `
Select the correct project, turn on Export generated class files and resources and enter the destination file name of the JAR executable.
+ _, O. z0 E) \+ F5 C
. a1 Y) m& b2 r" J  R19)
8 G) S/ ~1 O" d# u+ ~% G0 _* H2 Y3 fThen proceed with Next twice, turn on Generate the manifest file, enter the Main Class and Finish+ Z0 ~5 W6 ~1 d7 K* Z

* y% a, {% M+ c" I; k( l8 L" o* U$ ]3 `, k
Debug the JAR or CLASS file with NX and Eclipse
& N7 ]. m; ?9 ]% y
8 B4 ~! q; L9 ~+ W( \: x' F( D20)1 K. Y8 L+ R0 P6 s/ U  P4 f
If we want to debug a single class only, we could use the compiled Java class file which can be found automatically after saving the Java source file in workspace\projectname\bin\packagename\class .
( B% i  B2 g! G7 _( n  ?( A" pDue to Java naming convention and limitations we don’t want to have multiple classes in one file so in that case we would use the final JAR archive file.) i# U4 J4 J. w0 `8 G7 ~
In order to connect to the NX session, NX needs to start the JVM (Java Virtual Machine) along with some debug settings, for example the communication port between NX and Eclipse.
0 f; w; u0 v- v6 jFrom a NX8 command prompt, we enter the following commands:' \( Y' d" J2 n- H$ X) i
3 _- `. ]$ _" x3 q' n& Z
>set UGII_JVM_OPTIONS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
, k& c$ i% L  |* l* S/ j2 N>ugraf.exe
8 [5 o) w+ J0 |9 H
3 [( Z+ m/ @5 VThen we start the JVM once by File -> Execute -> NXOpen and selecting any *.class or *.jar file.: o( H" L; g' @, l) h! O
Any simple class will do the job, for example a famous HelloWorld class.# i; N# e7 o2 o0 C5 Z& n2 ~/ P

- ]9 d4 E, g8 h) G! u0 f; D/ @3 |. S21)* g# ?- a% U5 n! U/ L* C! `
Create the external access to the JVM session in Eclipse by Run -> Debug Configuration.- x+ z: q; Q7 ~/ E
On the Remote Java Application node make a right click and select New
* M0 f6 R0 I- v0 g' y/ B1 G
9 i  V; h; B* I22)5 z3 I+ M& g- F% N( R
Enter the Project you want to debug and make sure that the Port maTChes the address from UGII_JVM_OPTIONS
% S. Y4 I  W- U- ]
6 [; k& G/ {& |- S23)4 ~. g1 S7 O  ]! @( b8 T; Z
Don’t forget to set one or more breakpoints in your code where you want to interrupt execution
/ a% i1 i7 T- X3 V/ h6 S/ R& q7 I/ e2 r
24)3 M, M! A) M! i
Finally execute the JAR file or CLASS file in NX that you want to debug.1 X; V5 q7 c, |" [4 Z
Once the breakpoint is hit, switch to the Eclipse application, confirm to change to the Debug Perspective View and Step through your code as desired.7 e& `" C* d6 H8 x

6 @, }: e. m6 M- T: t0 ~, d; R9 SThat's it.. R$ b8 S1 \; n1 M& X: F/ Y
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了