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日

  • 相关阅读:
    POJ 1466 Girls and Boys 黑白染色 + 二分匹配 (最大独立集) 好题
    POJ2226 Muddy Fields 二分匹配 最小顶点覆盖 好题
    POJ 2195 Going Home 最小费用流 裸题
    POJ 3368 Frequent values RMQ 训练指南 好题
    POJ 3187 杨辉三角+枚举排列 好题
    POJ 2393 贪心 简单题
    系统监控
    系统的初始化和服务
    vi与vim
    正文处理命令及tar命令
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/13199847.html
Copyright © 2011-2022 走看看