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-国产软件践行者

[资料] UG NX 二次开发 调试 debug的使用步骤

[复制链接]

2014-5-9 16:14:24 4013 0

admin 发表于 2014-5-9 16:14:24 |阅读模式

admin 楼主

2014-5-9 16:14:24

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

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

x

' O$ `. Z$ B$ S: D9 U
8 g, @5 ^$ @- D' i/ u) _/ v
" \" j/ u" s2 i# s/ E7 s) I
DebUGging and Running - u& ^2 g$ `+ b, j+ K( a( G
  
0 n- l: [5 R" z' P$ D If the project is an internal Open C application (DLL), the following steps must be performed to associate the NX executable with the project. If these steps are not performed, the application cannot be executed or debugged from the Visual C++ environment. These steps do not apply to external Open C applications (EXEs).
5 g; r! m% C& O5 s& x# G; o4 U! \2 z  + Z% |: R8 L4 ~
Step 1 Determine the location of the NX executable ugraf.exe. # \  l% r6 a( _  x
  " R9 {5 s4 I+ X# t8 v
Go to the Windows "Start" menu and select "Settings->Control Panel". Double-click the "System" icon. Click the "Environment" tab on the resulting "System Properties" dialog. In the "System Variables" list scroll down until you find a variable named "UGII_ROOT_DIR". The value associated with this variable is the directory path to the "ugraf.exe" executable. Select the "UGII_ROOT_DIR" variable. Highlight the complete path in the "Value" field at the bottom of the dialog and copy it to the clipboard.
& \; S6 [$ o% a' v' l, K4 H  
6 a( x0 Q) Y+ v4 | Step 2 Associate the NX executable with your project.
/ K8 j! }; I, P: z/ G' x- w, Z& D  
! X# ]' A/ D2 ]2 u- f. f From within Visual C++, select the "Project->Settings" menu item and select the "Debug" tab on the resulting "Project Settings" dialog. Notice that the "Executable for debug session:" field is empty. Place the cursor in this field and then type or paste the path determined in the first step, followed by "\ugraf.exe". For example, if the value of "UGII_ROOT_DIR" were "C:\ugnx50\ugii" then you would enter: C:\ugnx50\ugii\ugraf.exe. You may also browse for the executable file by clicking the arrow button to the right of the "Executable for debug session:" field.
( _. l2 d# H3 E* O) w  
" |4 |. k4 a. S0 U Step 3 Set the working directory.
) C6 S6 {! W8 b  I! U" {  ( _1 ~. [8 c0 I) N* B8 }
The "Working directory:" field on the "Project Settings" dialog specifies the directory from which Visual C++ runs NX. A common convention is to use "C:\TEMP" for the working directory. / p% @+ _$ k( f% T6 c4 ]
  
6 {$ i- Z8 _" M1 k$ A Step 4 Set the NX program arguments (optional)
" T; j% o) t9 @; ?" z# a4 p& j  : w, `- R! I- U
You may set any NX program arguments you require by entering them in the "Program arguments:" field on the "Project Settings" dialog. The syntax is exactly the same as the command-line syntax for starting NX. 7 P! K3 S; N# p0 p! u2 b1 t
  
. L5 S5 R1 C+ q4 Z/ Y( W) r Step 6 Run the Application
+ K" P# A$ r0 w9 A8 v  / _. J4 v" z4 j7 }0 S+ T
Click "OK" in the "Project Settings" dialog and then run or debug the application as you would normally from Visual C++. NX is started each time the project is executed. You are free to place breakpoints in your Open C application just as you would in any other application. It may take a few moments for NX to appear because Visual C++ is searching for debug symbols in the NX DLLs, so be patient. ' w+ D' a2 R( s& j2 @. w# b: M
  
Print statements
Since NX is a native Windows application, there is no console started up automatically. Therefore using a printf to print to stdout will not work. If you want to use printf statements to debug your internal Open C application, you must add the following code to your internal Open C API function:
! B1 m% V* x; u, X  6 p! U' Q0 Q2 w; U3 `; B4 z( X0 N
#include <windows.h>
1 e. w$ d( W7 S2 A! \8 x #include <fstream.h>8 o( [1 _* o3 U/ o! P
#include <stdio.h>
4 n8 B4 X% q* [1 o- B ...
: K3 N- b* K) Y1 V% Z2 p% d FILE *fp;8 u5 J$ r9 A) H! a- u" {1 A- T
...5 ]9 J" x5 H, z6 q- h: ?

2 ?$ R$ S  b. t /* allocate console window conout$ */
$ J5 ~+ r6 K& l% h! m) L+ j8 T2 Z. V# @AllocConsole();
3 {  P; q5 {' h5 |* j: D5 q& v /* reopen stdout on conout$ for fprintf and printf */9 {  i2 ?0 t3 m8 f2 D
fp = freopen("conout$", "w", stdout);
& ]2 q# Z8 o9 M- U4 O2 m# Q  
* a' z2 `+ e( z2 J# z4 C5 p This will create a console window and attach it to stdout so that printf and fprintf will work. : z/ Q/ F' L7 y
  

$ U* U) ?* c6 G* K+ P. ^7 |& ?9 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二次开发专题模块培训报名开始啦

    我知道了