• 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日

  • 相关阅读:
    [武汉集训] Cliquers
    [NOI2017] 泳池
    [NOWCODER7] 小睿睿的方案
    动态dp初探
    [WC2008] 游览计划
    插头dp初探
    最小斯坦纳树初探
    2020ccpc总结
    Finding Palindromes
    最长非严格上升子序列的思考 && CF 1437E Make It Increasing
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/13199847.html
Copyright © 2020-2023  润新知