|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 u5 y0 Z1 W) ]+ J# j x1 L
NX二次开发源码分享: Ufun设置工作部件重量
/ U) g2 {2 u1 ^; z+ Z9 c+ J6 _0 _& Z8 G
! K1 b* N7 ]- k8 V4 j8 m' |
[mw_shl_code=c,true]void do_it()1 H0 S: M# E: [. `) r
{# [- q% }9 O0 G, G$ d+ p
tag_t workPart = UF_ASSEM_ask_work_part();" s; B* ^1 G1 x, z* ^0 s+ w7 Y
8 x3 s2 E4 N7 E7 n if (workPart != NULL_TAG)
) v- S. E& _* G3 Y1 V {
: K, b4 n8 A( Y3 u7 a) c/ a UF_WEIGHT_properties_t propsOld, propsNew;' k- {0 q. d w" _
! n8 J3 g/ d) h
UF_CALL(UF_WEIGHT_ask_props(workPart, UF_WEIGHT_units_km, &propsOld));2 D, ^9 d; U9 y: }- e
ECHO("Old Weight: %f\n", propsOld.mass);9 q9 s" G: t+ w. g/ `
ECHO("Accuracy: %.2f\n", propsOld.accuracy);
4 ~. M9 g* X& h6 m4 ^2 }2 `7 j2 a- F. d( z
propsNew.cache_state = propsNew.mass_state = UF_WEIGHT_asserted;" g9 {9 ~1 [+ O
propsNew.area_state = propsNew.cofm_state = propsNew.mofi_state = propsNew.density_state = propsNew.volume_state = UF_WEIGHT_unknown;: X! Q0 H [( L8 Z4 S
propsNew.accuracy = 1.0;3 T: p `/ E( \; a
propsNew.units = UF_WEIGHT_units_gm;
! P) Z, C& b0 I propsNew.mass = 1234.56;0 s7 g+ }; A3 Z" ]- X2 F/ l% h
UF_CALL(UF_WEIGHT_assert_part_props(workPart, &propsNew));/ v$ [* A* h8 j$ w
' M! H& O2 d* W3 { UF_CALL(UF_WEIGHT_ask_props(workPart, UF_WEIGHT_units_km, &propsOld));8 R1 f3 c3 q) {# _( ?# P0 B X
ECHO("New Weight: %f\n", propsOld.mass);7 i' x' R% J: W+ F
}% M- Z/ d; f9 T( O; w3 |9 A5 e
. ~3 O* [/ k- i: y/ x}[/mw_shl_code]3 S; w4 n. o" x7 k6 ]) z) k4 U( `$ R' w
|
|