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 4638 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 5 o0 q: I' Y+ ]
4 C$ T0 A+ ]# ]9 |+ v) n3 e
(see PDF in the ZIP file for a pictorial description)% Y) p! n6 v  Y7 y+ v7 G

( v! C1 x- L4 q. U" fInstallation of Java and Eclipse
. |0 y( }) q4 ]# Y/ q9 |) }9 ~, u
/ Z, H/ U+ A' O; ~) [4 e/ p1)$ K: V# g$ a' p* `0 }' Q' m, s
Download and install the Java Standard Edition Developer Kit Java SE 6 (1.6.0_14 or higher) from
2 I' J/ t7 E8 C6 ^4 L0 I6 ~1 Vhttp://www.oracle.com/technetwor ... ownloads/index.html ; t$ M: L3 C: h' J$ P9 C

0 U8 n! k% T+ z- [! u2)
2 s( H' T! d1 G, H0 O$ xDownload the Eclipse IDE for Java Developers from http://www.eclipse.org/downloads 1 A. j$ P6 \- t% A  J7 U5 b
and extract the ZIP and its ‘eclipse’ directory content to your preferred path, for example “d:\eclipse”. k* D7 J$ o/ E, b1 X+ I/ T* ^
* p; |1 }) }7 G% K3 e' p- Z; v

* t1 |+ {  f: o. u7 Q2 jCreate a project with Eclipse   
$ Q. x% ^$ G7 K, B5 C9 D. I1 k* s9 L: b* \0 D1 _
3)
9 c$ F. _5 S" u0 M8 p& C8 KStart the Eclipse IDE, for example “d:\eclipse\eclipse.exe”
# X6 h0 V- ~6 g$ J% v' H+ n" O4 |. b* Y1 O
4); x" \& Y- Q( @9 m3 R$ I. Q# W
You will be asked for the location of your Workspace folder which is comparable to the MyProjects folder in Microsoft Visual Studio
  c5 U; p; O; o3 k1 f
' W( L6 c% |) a9 N8 L# c5)
% }7 O, q$ ^" j: F2 v# ~- c- Q+ g8 NCreate a new Java Project by File -> New -> Java Project
) Y" v- H) j3 c/ ]
& l$ F) S  q# U) D6)
! r8 f/ s+ h4 u" l$ ~Enter a project name and continue with Next
: Q* [2 E4 U* U3 H/ D, f* V, L5 ^! F; _+ d( e
7)
% `0 _2 F3 ^+ y9 J7 ?1 @/ jOn the Libraries Tab add the external NXOpen Jar packages and Finish
/ E0 j: J" v2 o% Z
" ]$ d0 M3 U* l$ R4 \9 k+ {8)9 q- s5 I( Z- u4 L$ N
In the Package Explorer window make a right click on the project name and create a new Package (Namespace)  
. n& j! z/ F8 F: m9 Q# ~& H
  U/ @/ A  u7 e2 ]9) , R3 \  D, u# Q+ h; w/ x3 Y
Enter a package name and Finish* p- W2 @5 |1 r$ |
4 ^2 d  w8 \! l' d: H
10)* T* Y$ d* l2 i  \) i( O. \
In the Package Explorer window make a right click on the Package name and create a new Class   
8 K: D6 Y3 w% m( q
( X) e# r7 m7 ]8 q11)
. W7 t, y3 T6 j( I  f3 n! Q0 ZEnter a Class name and uncheck all method stubs options/ F$ j0 p& N, E. {" L

  }. n8 Z& Y  G+ y; V9 i6 _12)( D* d1 P1 z6 @2 y- e
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.
) H0 N0 j/ l8 d2 EFirst we set the NX journal language to Java by Preferences -> User Interface -> Journal -> Journal Language -> Java3 ?. t9 O# |% ^8 g7 h

* }0 a" |0 z' z- u8 c. t$ [13)
. h- N, E$ r1 n2 K  \" r* ~Start Recording by Tools -> Journal -> Record
' r2 F$ V6 d# j, g2 R+ f4 _' I2 a, g# l" w" w
14)
6 m2 |1 c1 l  N5 W" `; V4 wCreate a Block and finish the journal by Tools -> Journal -> Stop Recording7 x( p* I- a- o- E; _' m
& ?( p# i% y9 h/ Y% H
15)) w- B' E( p( t% Q4 Z9 p
Open the Journal Editor by Tools -> Journal -> Edit and copy/paste the Imports and Methods to your project source file
6 K% z& T: v, l. o# b2 _. i* A% g7 ~9 e- _2 X6 |% s
16)
$ }) c2 M' F+ B: E  N: P! w" y  uMake a right click in your source window and select Source -> Format to reformat the source contents with “Eclipse rules”
8 z5 P, g% |- o/ o! l7 o0 K/ z$ |7 _
17)8 ]) O$ [" R0 W% S( s. p
Finally we create the Jar file which is mandatory in case our package contains more than one class.
0 c5 g& k6 N( C% u5 V" S* h7 yIn the Package Explorer right click on the project name and select Export -> JAR file -> Next
- _* Z1 M% X8 _( Y; Z3 [) y1 K' x( h9 X( T' W1 r. V
18)
1 a: l" U! U2 d5 |4 QSelect the correct project, turn on Export generated class files and resources and enter the destination file name of the JAR executable./ a) O( C7 ]0 e3 w' B

7 [* K& N( t+ U0 Z7 R9 A# x- H19)- @' s% j) I1 m) q& i& j9 e5 v
Then proceed with Next twice, turn on Generate the manifest file, enter the Main Class and Finish) R# s6 h1 g* w7 e7 H

5 r# D6 v/ n( Z: p$ F
6 \, z. |' f7 sDebug the JAR or CLASS file with NX and Eclipse
" u0 F9 R- E% p# k+ x3 t; h( Z6 Q0 C) j
20)# K" ~0 v# Y5 c
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 .+ f  C9 f# ^, s! ^* C) r$ [* b! d
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.' g9 ^, ]+ L# j: W0 {+ B4 Q2 a
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.
. P. s5 }% }% `1 @# U1 y, {From a NX8 command prompt, we enter the following commands:$ Z4 t9 Q% T* V

3 i/ j- W* T9 }>set UGII_JVM_OPTIONS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n7 Z/ }, z0 v8 ^2 C; E- h) B
>ugraf.exe2 \6 ?% C  p: t2 x5 R8 ?

( U) v$ \3 u8 r! YThen we start the JVM once by File -> Execute -> NXOpen and selecting any *.class or *.jar file.3 b6 w4 e/ B- a0 h6 A- t
Any simple class will do the job, for example a famous HelloWorld class.
, j/ x3 w* k- G. ?# B+ y3 m- f8 {3 r- M) q  R/ l
21)& d! Y/ e" `* Q- }4 @
Create the external access to the JVM session in Eclipse by Run -> Debug Configuration.8 q% O1 d2 L5 k3 G3 J% k
On the Remote Java Application node make a right click and select New 1 R- p5 B' c; d* [+ y) H2 R
, B$ ?) \" b6 B2 {9 O" d9 L
22)
1 C' a0 Z  V( MEnter the Project you want to debug and make sure that the Port maTChes the address from UGII_JVM_OPTIONS
- D) }. x1 [+ K
/ h4 x; O2 O: q; n4 T23)
" ]7 X" p6 V8 o$ g0 QDon’t forget to set one or more breakpoints in your code where you want to interrupt execution
$ E8 R/ h( J7 \; h3 a
+ j# G6 l5 U- I3 i: ?24)4 J/ a' \8 l3 o2 ?* g
Finally execute the JAR file or CLASS file in NX that you want to debug., N/ [. a8 n4 {& J4 Q, x2 X
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.
$ J! W' P5 [# @
1 \; Y/ e$ o; Y) P- rThat's it.' R+ r% _  \* ?0 }! o
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了