(Tekla Structures二次开发)在图纸中创建旋转的3D视图

在图纸中创建指定零件的3D视图

private static bool CreateRotatedView(Beam myBeam, Drawing currentDrawing)
        {
            DrawingHandler drawingHandler = new DrawingHandler();
            currentDrawing = drawingHandler.GetActiveDrawing();

            CoordinateSystem displayCoordinateSystem = new CoordinateSystem();
            CoordinateSystem myCoordinateSystem = myBeam.GetCoordinateSystem();
            ArrayList myParts = new ArrayList(); 

            myParts.Add(myBeam.Identifier);//*

            //角度由度数换算成弧度
            Matrix RotationAroundX = MatrixFactory.Rotate(20.0 * Math.PI * 2 / 360.0, myCoordinateSystem.AxisX);
            Matrix RotationAroundZ = MatrixFactory.Rotate(30.0 * Math.PI * 2 / 360.0, myCoordinateSystem.AxisY);

            Matrix Rotation = RotationAroundX * RotationAroundZ;

            displayCoordinateSystem.AxisX = new Vector(Rotation.Transform(new Point(myCoordinateSystem.AxisX)));
            displayCoordinateSystem.AxisY = new Vector(Rotation.Transform(new Point(myCoordinateSystem.AxisY)));

            TSD.View rotatedView = new TSD.View(currentDrawing.GetSheet(), myCoordinateSystem, displayCoordinateSystem, myParts);

            rotatedView.Name = "Example_View";
            return rotatedView.Insert();
        }

*这里是单个零件的id,也可以添加多个零件id。具体参见View构造函数说明。
视图名称“Example_View”可以在标签里面调出来。

你可能感兴趣的:(Tekla)