|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
$ g/ D7 m% L U$ D, y; W: N
NX二次开发源码分享: Ufun设置工作部件重量
( @ W/ A/ g2 z4 B* U* s2 A; Q) G
5 u ^! v$ R! x- }1 Y[mw_shl_code=c,true]void do_it()2 L, w% s# z0 W3 A* ]
{1 u H7 M7 b: p9 K* g& ?
tag_t workPart = UF_ASSEM_ask_work_part();
u" e6 n) Y8 N! b
6 Z( \0 k; G" u2 s& m" h if (workPart != NULL_TAG)
+ o) S+ `5 w4 M {
& @2 y# h+ j( G. U: V8 M UF_WEIGHT_properties_t propsOld, propsNew;
: H! W- g. j4 L9 O' x' i+ M: _, ]$ X# R
UF_CALL(UF_WEIGHT_ask_props(workPart, UF_WEIGHT_units_km, &propsOld));1 |/ g# h [, d9 `+ h
ECHO("Old Weight: %f\n", propsOld.mass);
# ]; \$ [5 o9 f/ F2 ?- d7 Z ECHO("Accuracy: %.2f\n", propsOld.accuracy);3 d7 e; Z- C/ R @
: }+ A8 g, G6 o3 |9 D- s' M% { propsNew.cache_state = propsNew.mass_state = UF_WEIGHT_asserted;; N4 Z0 E2 O% T7 X- }
propsNew.area_state = propsNew.cofm_state = propsNew.mofi_state = propsNew.density_state = propsNew.volume_state = UF_WEIGHT_unknown;
* Z5 E4 s; Y0 ]* [5 O4 t propsNew.accuracy = 1.0;
4 y4 Y4 A6 e* o A propsNew.units = UF_WEIGHT_units_gm;
7 c4 f' }0 G5 |2 Q. x8 z propsNew.mass = 1234.56;
/ P; _" O/ Y+ u. }/ H) U- ?" W; l UF_CALL(UF_WEIGHT_assert_part_props(workPart, &propsNew));' U b* W7 J1 y; _& d6 q3 K G4 e6 M
4 F! s, V% i3 i6 x
UF_CALL(UF_WEIGHT_ask_props(workPart, UF_WEIGHT_units_km, &propsOld));
S1 I- x5 m0 C+ _' J3 A ECHO("New Weight: %f\n", propsOld.mass);
; f8 n4 z+ g! p% }5 L; { }0 l* L! c" e1 {) g
- F0 Z" z& f d}[/mw_shl_code]
- _( ?$ Y( u' x& l& } |
|