|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 x$ u( Y6 i- }8 {- void skeTChTest::extrude(Sketch *sketch)3 i7 A: }7 h: s, T' B
- {
9 i% Y* p1 Z& l% X, ~ - Features::Feature *null_feature(NULL);5 j- P5 v1 X# l0 @
- Features::ExtrudeBuilder *extrudeBuilder = workPart->Features()->CreateExtrudeBuilder(null_feature);
5 ]/ p2 o2 U9 P/ ~) O- F! b$ E - NXOpen::Section *section = workPart->Sections()->CreateSection();
" z% n8 C, K' C+ n/ _1 h Y0 U2 S( @. P - extrudeBuilder->SetSection(section);
% ^+ L+ m& T3 s - . m5 D6 U8 L# `6 S, A
- vector<Features::Feature * > featureRule(1);* g& L( M& q5 F
- featureRule[0] = sketch->Feature();4 \9 V; W! B7 p4 V# ]
- CurveFeatureRule *curveFeatureRule = workPart->ScRuleFactory()->CreateRuleCurveFeature(featureRule);
7 } [; a1 h! {3 r) J8 [" x! p - std::vector <SelectionIntentRule *> rule(1);
. d8 j, p6 ]) g/ F" V - rule[0] = curveFeatureRule;2 f. w1 ?, }3 N. v$ J
- NXOpen::NXObject *nullObject(NULL);' J- Z b# x: k$ Y3 I3 t) t
- section->AddToSection(rule,nullObject,nullObject,nullObject,Point3d(0,0,0),Section::ModeCreate,false);( k6 R/ i* b$ f" \- [2 `, e2 R
0 f* n, r8 {8 i8 w" B- extrudeBuilder->Limits()->StartExtend()->SetValue("0");
5 C6 A n. w# w% U$ I2 S% ~ \, m( b( Q - extrudeBuilder->Limits()->EndExtend()->SetValue("100");
2 V4 Y* c, n1 S2 n. Z - Direction *direction = workPart->Directions()->CreateDirection(sketch,SenseForward,SmartObject::UpdateOptionWithinModeling);+ w# D+ {- G1 X, d0 F ^$ Z7 t
- extrudeBuilder->SetDirection(direction);
. H+ g4 S( h0 m0 k7 r3 m* ~ - ( i0 ~# W4 @: l
- extrudeBuilder->CommitFeature();
) x/ e+ ~ e1 c - extrudeBuilder->Destroy();
- [! P" C: N* K) L6 k$ @7 X - 7 {5 G% l( u, V6 h1 l( r$ |7 B
- }
复制代码
( M+ z! i4 J! K; Y: |+ T7 G f7 N4 K% O
这是一个拉伸草图特征的二次开发源码,仅供参考
- N, `& z4 E& P) K* z5 M
& E( e+ B# O; u3 o0 Z* j
1 y x2 @1 g+ q& f
+ C; M$ {/ Q( E) r2 C1 L2 Q. ?0 k& N. y' b1 M* B- P/ Q
|
|