zoukankan      html  css  js  c++  java
  • NX二次开发-NXOPEN C#UF插入对象到链表theUfSession.Modl.PutListItem

    NX9+VS2012
    
    using System;
    using NXOpen;
    using NXOpen.UF;
    using NXOpenUI;
    using NXOpen.Utilities;
    
    
    //获取WCS
    Tag WcsId = Tag.Null;
    theUfSession.Csys.AskWcs(out WcsId);
    
    //获取WCS的矩阵和原点
    Tag MatrixId = Tag.Null;
    double[] CsysOrigin = new Double[3];
    theUfSession.Csys.AskCsysInfo(WcsId, out MatrixId, CsysOrigin);
    
    //画两个整圆
    UFCurve.Arc HoleArcCoords1 = new UFCurve.Arc();
    HoleArcCoords1.matrix_tag = MatrixId;
    HoleArcCoords1.start_angle = 0 * UFConstants.DEGRA;
    HoleArcCoords1.end_angle = 360 * UFConstants.DEGRA;
    HoleArcCoords1.arc_center = new Double[3];
    HoleArcCoords1.arc_center[0] = 0.0;
    HoleArcCoords1.arc_center[1] = 0.0;
    HoleArcCoords1.arc_center[2] = 0.0;
    HoleArcCoords1.radius = 100;
    Tag HoleArcTag1 = Tag.Null;
    theUfSession.Curve.CreateArc(ref HoleArcCoords1, out HoleArcTag1);
    
    UFCurve.Arc HoleArcCoords2 = new UFCurve.Arc();
    HoleArcCoords2.matrix_tag = MatrixId;
    HoleArcCoords2.start_angle = 0 * UFConstants.DEGRA;
    HoleArcCoords2.end_angle = 360 * UFConstants.DEGRA;
    HoleArcCoords2.arc_center = new Double[3];
    HoleArcCoords2.arc_center[0] = 0.0;
    HoleArcCoords2.arc_center[1] = 0.0;
    HoleArcCoords2.arc_center[2] = 0.0;
    HoleArcCoords2.radius = 120;
    Tag HoleArcTag2 = Tag.Null;
    theUfSession.Curve.CreateArc(ref HoleArcCoords2, out HoleArcTag2);
    
    //创建链表
    Tag[] ArcList = new Tag[2];
    theUfSession.Modl.CreateList(out ArcList);
    
    //插入对象到链表
    theUfSession.Modl.PutListItem(ref ArcList, HoleArcTag1);
    theUfSession.Modl.PutListItem(ref ArcList, HoleArcTag2);
    
    //创建拉伸
    string[] HoleLimit = { "0.0", "50.0" };
    double[] HolePoint = { 0.0, 0.0, 0.0 };
    double[] HoleDirection = { 0.0, 0.0, 1.0 };
    Tag[] HoleExtrudedTag = new Tag[1];
    theUfSession.Modl.CreateExtruded(ArcList, "0", HoleLimit, HolePoint, HoleDirection, FeatureSigns.Nullsign, out HoleExtrudedTag);
    
    //特征找体
    Tag HoleBodyTag = Tag.Null;
    theUfSession.Modl.AskFeatBody(HoleExtrudedTag[0], out HoleBodyTag);
    
    //创建颜色
    theUfSession.Obj.SetColor(HoleBodyTag, 186);
    
    //设置透明度
    theUfSession.Obj.SetTranslucency(HoleBodyTag, 60);
    
    Caesar卢尚宇
    2020年6月27日

  • 相关阅读:
    第十二周进度表
    第一个冲刺周期-第十天
    第一个冲刺周期-第九天
    团队作业—第二阶段06
    团队作业—第二阶段05
    团队作业—第二阶段04
    团队作业—第二阶段03
    团队作业—第二阶段02
    团队作业—第二阶段01
    对于风行小组第一阶段冲刺成果的概括
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/13199847.html
Copyright © 2011-2022 走看看