• NX二次开发-NXOPEN C#UF创建链表theUfSession.Modl.CreateList


    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日

  • 相关阅读:
    2017.3.22上午
    2017.3.21下午
    2017.3.21上午
    git上传到阿里云code
    spring+ibatis整合
    Aop资料整理
    java加密算法之AES小记
    单例的八种写法:推荐静态内部类和枚举
    dubbo入门示例
    自定义注解判空简单示例
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/13199842.html
Copyright © 2020-2023  润新知