青华模具培训学校

 找回密码
 注册

QQ登录

只需一步,快速开始

青华模具培训学院
查看: 1109|回复: 0

[分享] 通过PK内核函数获取面的面积

[复制链接]
发表于 2023-10-20 16:34 | 显示全部楼层 |阅读模式
double AskFaceAreasByPK(tag_t face_tag, double tol)
) Z" V2 m6 u$ |; W{# s/ k9 e% {) l  @
        tag_t       ps_tag = NULL_TAG;- Y! L4 x2 l$ B4 z0 Q
        double     amount[3] = { 0.0, 0.0, 0.0 };* J% A) m, @7 s
        double     mass[3] = { 0.0, 0.0, 0.0 };
% S4 q/ R  E- O, z& E2 {        double     c_of_g[3] = { 0.0, 0.0, 0.0 };
, i% N$ F! ?  y        double     m_of_i[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
; J/ l/ A3 d2 Q* L# l- r; X        double     periphery[3] = { 0.0, 0.0, 0.0 };
) W; ?+ r: U) R  V0 |) P9 N- c        double     areas = 0.0;$ J& \. J( S4 p  o: y1 V$ H; m
        PK_FACE_t  pkFace = 0;
+ s7 V- }4 q6 @/ c# _& |        PK_TOPOL_eval_mass_props_o_t props_o_t;       
+ a4 M& y5 e9 @. m& A        if (NULL_TAG == face_tag || UF_PS_ask_ps_tag_of_object(face_tag, &ps_tag))
6 u, d' K0 B, K  \2 O" P0 R                return 0;
  M9 [3 G8 m/ F1 c5 U0 I# l8 T/ O        pkFace = ps_tag;
% g) v5 w4 |3 `) L5 [7 ]        if (tol < 0.99)+ L2 D* h2 e8 X& t; ?& m; L
                tol = 0.99;
# g4 Q& R9 h% A0 M; l# n        if (tol > 1.0)
) i4 g: x/ r" E1 J                tol = 1.0;. P5 h+ B$ r% {6 |6 J
        PK_TOPOL_eval_mass_props_o_m(props_o_t);
1 P  A) r  h' M7 w" v2 _        props_o_t.mass = PK_mass_c_of_g_c;
- _# i% {0 r; F7 W' w, W* j        PK_TOPOL_eval_mass_props(1, &pkFace, tol, &props_o_t, amount, mass, c_of_g, m_of_i, periphery);
7 R8 b8 k" m! z7 g" \! q. ^        areas = amount[0] * 1000.0 * 1000.0;( k7 R3 B$ T7 w$ ^3 T% ]
        return areas;& x( E0 H* Z/ Z+ N  [  ^, ?& A- _
}/ m" T" H- m! V. Q! p" [# r
: u' D: M3 X+ U* W4 n, _
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|关于我们|sitemap|小黑屋|Archiver|手机版|UG网-UG技术论坛-青华数控模具培训学校 ( 粤ICP备15108561号 )

GMT+8, 2025-10-11 03:00 , Processed in 0.045934 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表