UG NX二次开发拉伸草图源码分享
void sketchTest::extrude(Sketch *sketch)
{
Features::Feature *null_feature(NULL);
Features::ExtrudeBuilder *extrudeBuilder = workPart->Features()->CreateExtrudeBuilder(null_feature);
NXOpen::Section *section = workPart->Sections()->CreateSection();
extrudeBuilder->SetSection(section);
vector<Features::Feature * > featureRule(1);
featureRule= sketch->Feature();
CurveFeatureRule *curveFeatureRule = workPart->ScRuleFactory()->CreateRuleCurveFeature(featureRule);
std::vector <SelectionIntentRule *> rule(1);
rule = curveFeatureRule;
NXOpen::NXObject *nullObject(NULL);
section->AddToSection(rule,nullObject,nullObject,nullObject,Point3d(0,0,0),Section::ModeCreate,false);
extrudeBuilder->Limits()->StartExtend()->SetValue("0");
extrudeBuilder->Limits()->EndExtend()->SetValue("100");
Direction *direction = workPart->Directions()->CreateDirection(sketch,SenseForward,SmartObject::UpdateOptionWithinModeling);
extrudeBuilder->SetDirection(direction);
extrudeBuilder->CommitFeature();
extrudeBuilder->Destroy();
}
这是一个拉伸草图特征的二次开发源码,仅供参考
页:
[1]