• NX二次开发-NXOPEN C#UF将矩阵绕任意轴旋转theUfSession.Trns.CreateRotationMatrix


    https://www.cnblogs.com/nxopen2018/p/13173905.html 这个UF例子的C#写法

    using System;
    using NXOpen;
    using NXOpen.UF;
    using NXOpenUI;
    using NXOpen.Utilities;
    
    
    //初始化3*3矩阵
    double[] x_vec = { 1, 0, 0 };
    double[] y_vec = { 0, 1, 0 };
    double[] mtx = new Double[9];
    theUfSession.Mtx3.Initialize(x_vec, y_vec, mtx);
    
    //创建矩阵
    Tag MatrixTag = Tag.Null;
    theUfSession.Csys.CreateMatrix(mtx,out MatrixTag);
    
    //创建坐标系
    double[] csys_origin = {10,10,10};
    Tag CsysTag = Tag.Null;
    theUfSession.Csys.CreateCsys(csys_origin, MatrixTag, out CsysTag);
    
    for (int i = 0; i < 36; i++ )
    {
        //将矩阵绕任意轴旋转
        double[] origin = { 10, 10, 10 };
        double[] direction = { 0, 0, 1 };
        double degrees_rotation = i;
        double[] matrix = new Double[12];
        int status = 0;
        theUfSession.Trns.CreateRotationMatrix(origin, direction,ref degrees_rotation, matrix, out status);
    
        //变换矩阵
        Tag[] objects = {CsysTag};
        int n_objects = 1;
        int move_or_copy = 1;
        int dest_layer = 0;
        int trace_curves = 2;
        Tag[] copies = new Tag[1];
        Tag trace_curve_group = Tag.Null;
        int status1 = 0;
        theUfSession.Trns.TransformObjects(matrix, objects, ref n_objects, ref move_or_copy, ref dest_layer, ref trace_curves,copies, out trace_curve_group, out status1);
    }
    
    Caesar卢尚宇
    2020年7月2日
  • 相关阅读:
    17种高效选聘方法
    三招让你从求职者中脱颖而出(转)
    仓山有感
    同事就是同事,职场没有兄弟姐妹
    enable worker process
    央企
    关于IIS
    td
    About Application Pool
    iis 7 application pool
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/13226117.html
Copyright © 2020-2023  润新知