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 4630 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
/ I$ ^9 a+ i" B7 ]% Q: |' l# Y. T
4 o, l+ ?4 ~4 u3 J/ B# C' x2 L(see PDF in the ZIP file for a pictorial description)
0 h8 y! w: z9 S. O4 D9 H% M2 L( g8 S, L  a7 W9 q( ?' W' v/ t8 U
Installation of Java and Eclipse' p  b! D! Z- p$ R
, U7 v7 s2 ~2 [3 l2 E
1)
5 E1 D( n2 C8 V7 E! f' YDownload and install the Java Standard Edition Developer Kit Java SE 6 (1.6.0_14 or higher) from
2 q1 f8 w, K6 H# Uhttp://www.oracle.com/technetwor ... ownloads/index.html
! n+ T  @8 m5 x" [
9 t, u8 m% R! V3 B4 U  V. @6 X2)( m% S8 f7 x; i7 I3 s* f, y
Download the Eclipse IDE for Java Developers from http://www.eclipse.org/downloads 4 v% @. [$ \1 B* n9 w. g" P
and extract the ZIP and its ‘eclipse’ directory content to your preferred path, for example “d:\eclipse”
1 C1 j% k& G; [! d7 b
+ g6 H7 M3 v* C! |, c" G9 a! h% Y1 o& P+ I
Create a project with Eclipse   6 t4 g) r* h8 }) w' _  w$ ?
7 f& g, s* d" c3 ^1 r
3)
. Y& d. n& P( ]3 |2 |Start the Eclipse IDE, for example “d:\eclipse\eclipse.exe”
' t' @9 r, D* |9 ~* [0 g$ R% H) H* w
! p/ Y8 [/ `0 m$ j6 B4 _! m4)/ K& E/ g7 I) c
You will be asked for the location of your Workspace folder which is comparable to the MyProjects folder in Microsoft Visual Studio
" Z3 n- S. w' V! k- ?
- \2 v7 C- R$ _0 a  A0 K5)" ^2 r: R2 K8 x' N! i4 H
Create a new Java Project by File -> New -> Java Project
2 d& o5 S7 Y7 L+ ~$ z  m( ?( H6 F' I5 ~/ D
6)+ ^/ Q8 F' R7 w/ b* j: }% z0 F
Enter a project name and continue with Next
9 Z- \& e: b+ B$ H* W& M0 E
" c: o2 C3 S) H0 F5 u; i. ]; Z3 Z7)
7 g9 ^6 R- o* z7 AOn the Libraries Tab add the external NXOpen Jar packages and Finish
  j8 D. C% v- y6 p5 K, ?, Z) b! A, c+ [. |
8)6 y. a( \; N; Y( P9 b
In the Package Explorer window make a right click on the project name and create a new Package (Namespace)  , d3 n; S5 \) Y3 w5 E6 z1 @1 h

  a5 T5 `" x1 W! ?! a- I  o# O) Q( O9) # L( _! `7 g; ?: ?5 B; S( N
Enter a package name and Finish
+ W. d  z' f4 y7 K
, s+ K6 v  |, F: a- ^2 i) r& Q10)+ P. g3 \* v1 l! }! D" K* C" H
In the Package Explorer window make a right click on the Package name and create a new Class   
% `2 v" E$ ^0 H4 c! h' I
# h6 b) B- d5 W* `: \' k11)
( z6 [% U5 J2 V, F+ s$ V+ A, NEnter a Class name and uncheck all method stubs options; \5 O* ^+ u3 K. ^' ]: ~8 V5 f

7 u4 o$ R4 H) m7 r& w  f! M% [12)1 e( {0 I0 u/ R" U$ u
Now 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.
, @( j5 `0 Z1 {& b* eFirst we set the NX journal language to Java by Preferences -> User Interface -> Journal -> Journal Language -> Java/ C; S1 E  P. g6 O, B" G
' I! W! ~+ W! y0 @; x+ l
13)/ J. j  J8 y' O2 D8 ]
Start Recording by Tools -> Journal -> Record
) y1 Q" h% S9 u5 j( j
/ x  b. H% Z9 C4 I2 S! |, P, y14) $ P6 }- f7 I- t) C. z0 l
Create a Block and finish the journal by Tools -> Journal -> Stop Recording
: ^& h: p, M) G; l! [# v- J% \) E9 r- k! k& N6 M
15)5 P6 J* A. `( N1 C3 ]$ ~- T
Open the Journal Editor by Tools -> Journal -> Edit and copy/paste the Imports and Methods to your project source file
  I: y9 l  J; f1 N5 t9 F; n! ~6 h( u
# W2 G# b8 ]# z; X16), [9 V& E7 P, }- r
Make a right click in your source window and select Source -> Format to reformat the source contents with “Eclipse rules”. s* t0 z- [5 \6 Y8 Q
# a( I5 y  [9 I
17)
: m7 g7 C; D% x( j: J  L- MFinally we create the Jar file which is mandatory in case our package contains more than one class.; s. E, r/ k3 l8 d; c% s  O+ n, g
In the Package Explorer right click on the project name and select Export -> JAR file -> Next
8 ?9 U) d( I; w. M! I* ^
( W" [9 `. _5 ^/ w18)
- T5 }, Z7 W3 D5 }+ KSelect the correct project, turn on Export generated class files and resources and enter the destination file name of the JAR executable.
/ e2 A. b0 r) }) S: D' x& u* U# f; K) {7 _
19)9 \1 Q) [4 D9 y
Then proceed with Next twice, turn on Generate the manifest file, enter the Main Class and Finish7 ]( G; K3 c8 B/ g

. c2 a- Q( I; _' {& `* U2 M9 W5 H4 v6 B$ ]
Debug the JAR or CLASS file with NX and Eclipse
* ], x9 y8 h" p/ B& d# M9 c, g7 ~; Y
20)( \/ O$ y7 N* i* T, c. }- a
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 .6 I; j/ g8 W* U5 A; J
Due 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.
$ T( w1 y4 M- N( P- v/ VIn 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.- `3 Q, i1 e2 K; c6 d* X: E! h
From a NX8 command prompt, we enter the following commands:! U0 W' p. P& z  q; B) g

5 M6 D" {* h& ]) V1 Z: v>set UGII_JVM_OPTIONS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
$ `/ @/ Z1 A4 F7 v# @& `0 F>ugraf.exe9 L3 p7 F4 N0 \

' K  Q8 \9 f( f0 \  L) H) f* WThen we start the JVM once by File -> Execute -> NXOpen and selecting any *.class or *.jar file.
, J% W3 u/ M$ G6 |Any simple class will do the job, for example a famous HelloWorld class.
" q2 b* C; J* C+ G0 p
- |" }# s5 ~& M+ \/ f/ L" `21)" g. C- d4 O8 {. b) N
Create the external access to the JVM session in Eclipse by Run -> Debug Configuration.
6 W$ A* V8 J* g% I9 HOn the Remote Java Application node make a right click and select New
" X( _# D6 R( S( \, }% e0 c0 v, X8 T5 ?/ Q/ T+ z* d
22). }' ?! W9 d6 o* [+ t: \2 v
Enter the Project you want to debug and make sure that the Port maTChes the address from UGII_JVM_OPTIONS) }1 J+ p& Q. P8 f1 s4 B( [( @3 f

8 r9 Z/ Y  v0 M7 N  l5 m, t. s; i23)
0 J5 H, m# l" m, \/ QDon’t forget to set one or more breakpoints in your code where you want to interrupt execution, i& z* V$ p+ O8 V
' s4 d& Q8 l3 ~; [% |, E
24)0 c  h; v+ Q- h  c' b; a% j
Finally execute the JAR file or CLASS file in NX that you want to debug.
4 ^2 H! P) D# k! o9 a' ~/ lOnce the breakpoint is hit, switch to the Eclipse application, confirm to change to the Debug Perspective View and Step through your code as desired.
+ C0 W- r. J' D
4 v* {( `$ k$ Y. E, uThat's it.  \9 Q. W4 N# c2 s: B& A
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了