smalflyy 发表于 2014-2-21 23:25:09

草图偏置曲线返回的OBJECT无法用日志拉升

这是录的日志里草图偏置曲线里的
NXObject nXObject2;
    nXObject2 = sketchOffsetBuilder1.Commit();
   
    NXObject[] objects1;
    objects1 = sketchOffsetBuilder1.GetCommittedObjects();
我返回了nXObject2;
并录制了一个草图拉伸的日志 里面这么写的
NXOpen.Features.Feature[] features1 = new NXOpen.Features.Feature;
    NXOpen.Features.SketchFeature sketchFeature1 = (NXOpen.Features.SketchFeature)workPart.Features.FindObject("SKETCH(16)");
    features1 = 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;
    rules1 = 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;
    NXOpen.Features.OffsetCurve offsetCurve1 = (NXOpen.Features.OffsetCurve)nXObject2;//在这写了nXObject2
    features1 = offsetCurve1;
    workPart.Features.SuppressFeatures(features1);
它报错说无法将 NXOpen.sketchoffset强制转换成NXOpen.Features.OffsetCurve;

求高手告诉我下怎么转换

ymng 发表于 2014-2-25 23:27:56

    刚学习二次开发,问下楼主,如何建立一个新的草图,并在草图中画直线或圆等,然后对草图进行拉伸或旋转等草图。
   现在学习只知道如何再建模环境下建立直线,不太明白在草图环境下一系列的操作如何进行,求指导!
页: [1]
查看完整版本: 草图偏置曲线返回的OBJECT无法用日志拉升