|
这是录的日志里草图偏置曲线里的
NXObject nXObject2;
nXObject2 = sketchOffsetBuilder1.Commit();
NXObject[] objects1;
objects1 = sketchOffsetBuilder1.GetCommittedObjects();
我返回了nXObject2;
并录制了一个草图拉伸的日志 里面这么写的
NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature[1];
NXOpen.Features.SketchFeature sketchFeature1 = (NXOpen.Features.SketchFeature)workPart.Features.FindObject("SKETCH(16)");
features1[0] = sketchFeature1;
Sketch sketch1 =(Sketch)workPart.Sketches.FindObject("SKETCH_00SKETCH_000");
Line line1 = (Line)sketch1.FindObject("Curve Line4");
Curve nullCurve = null;
CurveFeatureChainRule curveFeatureChainRule1;
curveFeatureChainRule1 = workPart.ScRuleFactory.CreateRuleCurveFeatureChain(features1, line1, nullCurve, false, 0.00095);
section1.AllowSelfIntersection(true);
SelectionIntentRule[] rules1 = new SelectionIntentRule[1];
rules1[0] = curveFeatureChainRule1;
NXObject nullNXObject = null;
Point3d helpPoint1 = new Point3d(-18.8530653857088, 21.736029640554, 0.0);
section1.AddToSection(rules1, line1, nullNXObject, nullNXObject, helpPoint1, NXOpen.Section.Mode.Create, false);
我把NXOpen.Features.SketchFeature sketchFeature1 = (NXOpen.Features.SketchFeature)workPart.Features.FindObject("SKETCH(16)");
改成了NXOpen.Features.SketchFeature sketchFeature1 = (NXOpen.Features.SketchFeature)nXObject2;
它报错说无法将 NXOpen.sketchoffset强制转换成NXOpen.features.sketchfeature;
再录一段没有草图的拉伸
NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature[1];
NXOpen.Features.OffsetCurve offsetCurve1 = (NXOpen.Features.OffsetCurve)nXObject2;//在这写了nXObject2
features1[0] = offsetCurve1;
workPart.Features.SuppressFeatures(features1);
它报错说无法将 NXOpen.sketchoffset强制转换成NXOpen.Features.OffsetCurve;
求高手告诉我下怎么转换
|
|