|
想通过模具向导的坯料尺寸取得层中所有实体最大外形。的方法。以下代码无法取得,有那位大师知道指教一二。。谢谢
5 j0 l- D: Q+ s; a3 _ NXOpen.Tooling.StockSizeBuilder stockSizeBuilder1;
6 g; d- u, u" h stockSizeBuilder1 = thePart.ToolingManager.StockSizes.CreateStocksizeBuilder();
! I* G+ J" s1 R4 f4 O stockSizeBuilder1.StringStock = "0";
* F' n5 l2 m7 Y) Z4 _, E0 q4 b stockSizeBuilder1.SizePrecision = 3;//返回或设置的尺寸精度; w: V6 V6 ?8 j
stockSizeBuilder1.StockType = NXOpen.Tooling.StockSizeBuilder.Shape.Block;; y1 x) Q) w/ z0 V1 D- V( s
int i = 0;
& E) d4 s0 h2 W( O# C' k6 w( [ int k = 0;) T+ i$ g" o: @) g5 U' [+ m
foreach (var item in thePart.Layers.GetAllObjectsOnLayer(int.Parse(tbx_layer.Text)))
% M: Y3 M+ Q( h* V; Y {
- t. `6 d- c1 ^6 E) g- m if (item is NXOpen.Body)# W& q) o+ B" P" O! N8 b: S
{- V7 R2 x1 ]0 C. E
if (item.Name != null) x4 @6 J8 o, F( W
{
* }3 Z3 I/ l& F7 M+ _" h bool test = stockSizeBuilder1.SelectBody.Add((Body)item);7 F- D$ y) X; w
listBox1.Items.Add(item.Name + " " + stockSizeBuilder1.StringStock);
5 R G3 ]" [& k3 \( d% i i++;
2 r& s1 i) N2 b, O ` }
/ J; r% U4 s' D% I1 b; D else; I' ]; O' d, S. u+ x7 k4 G+ P
{* t. |; C; W! g% U; v
k++;
$ e6 L U7 }5 h3 H4 Y. N; j }
4 m! s9 ^$ E/ C+ I }
2 _7 E, Z8 S+ O- z* g. i) v- q} |
|