|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" ~7 Q( e- D. e J8 H! \- void skeTChTest::extrude(Sketch *sketch)
, z$ v; S0 Q( h - {
) e/ c+ r3 Z$ W7 p$ H9 N3 G$ M - Features::Feature *null_feature(NULL);
) i: {3 g, q- E9 ~7 a. E - Features::ExtrudeBuilder *extrudeBuilder = workPart->Features()->CreateExtrudeBuilder(null_feature);, B9 u9 l' P$ F7 U
- NXOpen::Section *section = workPart->Sections()->CreateSection();# h, w7 ?% J3 h- N% m6 s
- extrudeBuilder->SetSection(section);$ X4 k0 [! l4 ]: z! ]
- ) i, _" i" S; \) K# v+ [: r3 x
- vector<Features::Feature * > featureRule(1);
) [# ]4 b# L2 }& E; r - featureRule[0] = sketch->Feature();. k3 Z/ f& Z* `4 `8 ^! M! y
- CurveFeatureRule *curveFeatureRule = workPart->ScRuleFactory()->CreateRuleCurveFeature(featureRule);4 x" \# R4 j) C& D, B
- std::vector <SelectionIntentRule *> rule(1);- M m7 N( z6 k) {3 F- r/ @; d
- rule[0] = curveFeatureRule;9 ^2 }* S) ]0 |+ a5 r" Q
- NXOpen::NXObject *nullObject(NULL);5 Q4 e$ V: \1 _, R6 `, ?3 s: ]2 |# ?
- section->AddToSection(rule,nullObject,nullObject,nullObject,Point3d(0,0,0),Section::ModeCreate,false);" w: f( o7 U% e, w8 S/ I, ^
- . T9 p- a+ K$ y R8 X+ Q1 P
- extrudeBuilder->Limits()->StartExtend()->SetValue("0");: ?( t1 M9 v( x/ X1 a
- extrudeBuilder->Limits()->EndExtend()->SetValue("100");8 a' t1 p) m) Z* r
- Direction *direction = workPart->Directions()->CreateDirection(sketch,SenseForward,SmartObject::UpdateOptionWithinModeling);
. G/ N6 |. L* z1 y2 u8 Z% Q - extrudeBuilder->SetDirection(direction);3 P: l6 S G2 l& S
& l6 D/ I! m# d/ e- extrudeBuilder->CommitFeature();4 C, u1 A$ J r. P. Z- g
- extrudeBuilder->Destroy();
5 Z6 A! Y/ L% G- p' a! H. Y6 t
" s- O2 w- D, ^4 o' g. p& X- }
复制代码 6 d% f& |9 H5 H% z8 {9 |
0 k$ P! \( C. g% h
这是一个拉伸草图特征的二次开发源码,仅供参考/ ]! U7 N% Y5 b% l8 ~/ m( v9 [# S
+ M( p7 |3 F0 m1 Y: e/ c
7 ~: A. j! q1 ~* q. [4 R1 B: l9 G2 ~8 v
; u7 t# u- l7 Y' U
|
|