CAD二次开发(4)-编辑图形

news2024/11/13 18:04:52

工具类:EditEntityTool.cs

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AcDotNetTool;
namespace _03编辑图形
{
    public static  partial class EditEntityTool
    {
        /// <summary>
        /// 改变图形颜色
        /// </summary>
        /// <param name="c1Id">图形的ObjectId</param>
        /// <param name="colorIndex">颜色索引</param>
        public  static void ChangeEntityColor(this ObjectId c1Id, short colorIndex)
        {
            //图形数据库
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                //打开块表
                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                //打开块表记录
                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
                //获取图形对象
                Entity ent1 = (Entity)c1Id.GetObject(OpenMode.ForWrite);
                ent1.ColorIndex = colorIndex;
                trans.Commit();
            }
        }
        /// <summary>
        /// 改变图形颜色
        /// </summary>
        /// <param name="ent">图形对象</param>
        /// <param name="colorIndex">颜色索引</param>
        public static void ChangeEntityColor(this Entity ent, short colorIndex)
        {
            //判断图形的IsNewlyObject
            if (ent.IsNewObject)
            {
                ent.ColorIndex = colorIndex;
            }
            else
            {
                ent.ObjectId.ChangeEntityColor(colorIndex);
            }
        }
        /// <summary>
        /// 移动图形
        /// </summary>
        /// <param name="entId">图形对象的ObjectId</param>
        /// <param name="sorucePoint">参考原点</param>
        /// <param name="targetPoint">参考目标点</param>
        public static void MoveEntity(this ObjectId entId, Point3d sourcePoint, Point3d targetPoint)
        {
            //当前图形数据库
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                //打开块表
                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                //打开块表记录
                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
                //打开图形
                //Entity ent = (Entity)trans.GetObject(entId, OpenMode.ForWrite);
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);
                //计算变换矩阵
                Vector3d vector = sourcePoint.GetVectorTo(targetPoint);
                Matrix3d mt = Matrix3d.Displacement(vector);
                ent.TransformBy(mt);
                //提交事务处理
                trans.Commit();
            }
        }
        /// <summary>
        /// 移动图形
        /// </summary>
        /// <param name="entId">图形对象</param>
        /// <param name="sorucePoint">参考原点</param>
        /// <param name="targetPoint">参考目标点</param>
        public static void MoveEntity(this Entity ent, Point3d sourcePoint, Point3d targetPoint)
        {
            //判断图形对象的IsNewlyObejct属性
            if (ent.IsNewObject)
            {
                //计算变换矩阵
                Vector3d vector = sourcePoint.GetVectorTo(targetPoint);
                Matrix3d mt = Matrix3d.Displacement(vector);
                ent.TransformBy(mt);
            }
            else
            {
                ent.ObjectId.MoveEntity(sourcePoint, targetPoint);
            }
        }
        /// <summary>
        /// 复制图形
        /// </summary>
        /// <param name="entId">图形的半ObjectId</param>
        /// <param name="sourcePoint">参考起点</param>
        /// <param name="targetPoint">参考终点</param>
        /// <returns>图形对象,没有加入图形数据库</returns>
        public static Entity CopyEntity(this ObjectId entId, Point3d sourcePoint, Point3d targetPoint)
        {
            //声明一个图形对象
            Entity entR;
            //当前图形数据库
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                //打开块表
                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                //打开块表记录
                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
                //打开图形
                //Entity ent = (Entity)trans.GetObject(entId, OpenMode.ForWrite);
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);
                
                //计算变换矩阵
                Vector3d vector = sourcePoint.GetVectorTo(targetPoint);
                Matrix3d mt = Matrix3d.Displacement(vector);
                entR =  ent.GetTransformedCopy(mt);
                //提交事务处理
                trans.Commit();
            }

            return entR;
        }
        /// <summary>
        /// 复制图形
        /// </summary>
        /// <param name="entId">图形对象ram>
        /// <param name="sourcePoint">参考起点</param>
        /// <param name="targetPoint">参考终点</param>
        /// <returns>图形对象,没有加入图形数据库</returns>
        public static Entity CopyEntity(this Entity ent, Point3d sourcePoint, Point3d targetPoint)
        {
            //声明一个图形对象
            Entity entR;
            //判断图形对象的IsNewlyObejct属性
            if (ent.IsNewObject)
            {
                //计算变换矩阵
                Vector3d vector = sourcePoint.GetVectorTo(targetPoint);
                Matrix3d mt = Matrix3d.Displacement(vector);
                entR =  ent.GetTransformedCopy(mt);
            }
            else
            {
                entR =  ent.ObjectId.CopyEntity(sourcePoint, targetPoint);
            }
            return entR;
        }
        /// <summary>
        /// 旋转图形
        /// </summary>
        /// <param name="ent">图形对象的ObjectId</param>
        /// <param name="center">旋转中点</param>
        /// <param name="degree">旋转的角度</param>
        public static void  RotateEntity(this ObjectId entId, Point3d center,double degree)
        {
            
            //当前图形数据库
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                //打开块表
                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                //打开块表记录
                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
                //打开图形
                //Entity ent = (Entity)trans.GetObject(entId, OpenMode.ForWrite);
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);

                //计算变换矩阵
                Matrix3d mt = Matrix3d.Rotation(degree.DegreeToAngle(), Vector3d.ZAxis, center);
                ent.TransformBy(mt);
                //提交事务处理
                trans.Commit();
            }
        }
        /// <summary>
        /// 旋转图形
        /// </summary>
        /// <param name="ent">图形对象</param>
        /// <param name="center">旋转中点</param>
        /// <param name="degree">旋转的角度</param>
        public static void RotateEntity(this Entity ent, Point3d center, double degree)
        {
            //判断图形对象的IsNewlyObejct属性
            if (ent.IsNewObject)
            {
                //计算变换矩阵

                Matrix3d mt = Matrix3d.Rotation(degree.DegreeToAngle(), Vector3d.ZAxis, center);
                ent.TransformBy(mt);
            }
            else
            {
                ent.ObjectId.RotateEntity(center, degree);
            }
        }
        /// <summary>
        /// 镜像图形
        /// </summary>
        /// <param name="entId">图形对象的ObjectId</param>
        /// <param name="point1">第一个镜像点</param>
        /// <param name="point2">第二个镜像点</param>
        /// <param name="isEraseSoruce">是否删除原图</param>
        /// <returns>返回新的图形对象,没有加入图形数据库</returns>
        public static Entity MirrorEntity(this ObjectId entId, Point3d point1, Point3d point2, bool isEraseSoruce)
        {
            //声明一个图形对象,用于返回
            Entity entR;
            //计算镜像的变换矩阵
            Matrix3d mt = Matrix3d.Mirroring(new Line3d(point1, point2));
            //打开事务处理
            using (Transaction trans = entId.Database.TransactionManager.StartTransaction())
            {
                //打开原对象
                Entity ent = (Entity)trans.GetObject(entId, OpenMode.ForWrite);
                //这里得到的图形的IsNewlyObject = true
                entR = ent.GetTransformedCopy(mt);
                //判断是否删除对象
                if (isEraseSoruce)
                {
                    ent.Erase();
                }
                trans.Commit();
            }
            return entR;
        }
        /// <summary>
        /// 镜像图形
        /// </summary>
        /// <param name="entId">图形对象</param>
        /// <param name="point1">第一个镜像点</param>
        /// <param name="point2">第二个镜像点</param>
        /// <param name="isEraseSoruce">是否删除原图</param>
        /// <returns>返回新的图形对象,没有加入图形数据库</returns>
        public static Entity MirrorEntity(this Entity ent, Point3d point1, Point3d point2, bool isEraseSoruce)
        {
            //声明一个图形对象,用于返回
            Entity entR;
            if (ent.IsNewObject == true)
            {
                //计算镜像的变换矩阵
                Matrix3d mt = Matrix3d.Mirroring(new Line3d(point1, point2));
                entR = ent.GetTransformedCopy(mt);
            }
            else
            {
                
                entR  = ent.ObjectId.MirrorEntity(point1, point2, isEraseSoruce);
            }
            return entR;
        }
        /// <summary>
        /// 缩放图形
        /// </summary>
        /// <param name="entId">图形对象的ObjectId</param>
        /// <param name="basePoint">缩放的基点</param>
        /// <param name="facter">缩放比例</param>
        public static void ScaleEntity(this ObjectId entId, Point3d basePoint, double facter)
        {
            //计算缩放矩阵
            Matrix3d mt = Matrix3d.Scaling(facter, basePoint);
            //启动事务处理
            using (Transaction trans = entId.Database.TransactionManager.StartTransaction())
            {
                //打开要缩放的图形对象
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);
                ent.TransformBy(mt);
                trans.Commit();
            }
        }
        /// <summary>
        /// 缩放图形
        /// </summary>
        /// <param name="entId">图形对象的</param>
        /// <param name="basePoint">缩放的基点</param>
        /// <param name="facter">缩放比例</param>
        public static void ScaleEntity(this Entity ent, Point3d basePoint, double facter)
        {
            //判断图形对象的IsNewlyObject属性
            if (ent.IsNewObject == true)
            {
                //计算缩放矩阵
                Matrix3d mt = Matrix3d.Scaling(facter, basePoint);
                ent.TransformBy(mt);
            }
            else
            {
                ent.ObjectId.ScaleEntity(basePoint, facter);
            }
        }
        /// <summary>
        /// 删除图形对象
        /// </summary>
        /// <param name="entId">图形对象的ObjectId</param>
        public static void EraseEntity(this ObjectId entId)
        {
            //打开事务处理
            using (Transaction trans = entId.Database.TransactionManager.StartTransaction())
            {
                //打开要缩放的图形对象
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);
                ent.Erase();
                trans.Commit();
            }
        }
        /// <summary>
        /// 巨型阵列
        /// </summary>
        /// <param name="entId">图形对象的ObjectId</param>
        /// <param name="rowNum">行数</param>
        /// <param name="columnNum">列数</param>
        /// <param name="disRow">行距</param>
        /// <param name="disColumn">列距</param>
        /// <returns>List<Entity> 已加入图形数据库</returns>
        public static List<Entity> ArrayRectEntity(this ObjectId entId,int rowNum,int columnNum,double disRow,double disColumn)
        {
            //声明一个Enity类型的集合
            List<Entity> entList = new List<Entity>();
            //当前图形数据库
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                //打开块表
                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                //打开块表记录
                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                //打开图形
                //Entity ent = (Entity)trans.GetObject(entId, OpenMode.ForWrite);
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);
                //计算变换矩阵
                for (int i = 0; i < rowNum; i++)
                {
                    for (int j = 0; j < columnNum; j++)
                    {
                        Matrix3d mt = Matrix3d.Displacement(new Vector3d(j * disColumn, i * disRow, 0));
                        Entity entA = ent.GetTransformedCopy(mt);
                        btr.AppendEntity(entA);
                        trans.AddNewlyCreatedDBObject(entA,true);
                        entList.Add(entA);
                    }
                }
                ent.Erase();
                //提交事务处理
                trans.Commit();

            }
            return entList;
        }
        /// <summary>
        /// 巨型阵列
        /// </summary>
        /// <param name="entId">图形对象</param>
        /// <param name="rowNum">行数</param>
        /// <param name="columnNum">列数</param>
        /// <param name="disRow">行距</param>
        /// <param name="disColumn">列距</param>
        /// <returns>List<Entity> 已加入图形数据库</returns>
        public static List<Entity> ArrayRectEntity(this Entity entS, int rowNum, int columnNum, double disRow, double disColumn)
        {
            if (entS.IsNewObject == true)
            {
                //声明一个Enity类型的集合
                List<Entity> entList = new List<Entity>();
                Database db = HostApplicationServices.WorkingDatabase;
                using (Transaction trans = db.TransactionManager.StartTransaction())
                {
                    //打开块表
                    BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                    //打开块表记录
                    BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                    for (int i = 0; i < rowNum; i++)
                    {
                        for (int j = 0; j < columnNum; j++)
                        {
                            Matrix3d mt = Matrix3d.Displacement(new Vector3d(j * disColumn, i * disRow, 0));
                            Entity entA = entS.GetTransformedCopy(mt);
                            btr.AppendEntity(entA);
                            trans.AddNewlyCreatedDBObject(entA, true);
                            entList.Add(entA);
                        }
                    }
                    trans.Commit();
                }
                return entList; 
            }
            else
            {
               return entS.ArrayRectEntity(rowNum, columnNum, disRow, disColumn);
            }
        }

        public static List<Entity> ArrayPolarEntity(this ObjectId entId, int num, double degree,Point3d center)
        {
            //声明一个List集合,用于返回
            List<Entity> entList = new List<Entity>();
            //打开事务处理
            using (Transaction trans = entId.Database.TransactionManager.StartTransaction())
            {
                //打开块表
                BlockTable bt = (BlockTable)trans.GetObject(entId.Database.BlockTableId, OpenMode.ForRead);
                //打开块表记录
                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                Entity ent = (Entity)entId.GetObject(OpenMode.ForWrite);
                //限定阵列角度的大小
                degree = degree > 360 ? 360 : degree;
                degree = degree < -360 ? -360 : degree;
                int divAngNum = num-1;
                if (degree == 360 || degree == -360)
                {
                    divAngNum = num;
                }
                for (int i = 0; i < num; i++)
                {
                    Matrix3d mt = Matrix3d.Rotation((i * degree / divAngNum).DegreeToAngle(), Vector3d.ZAxis, center);
                    Entity entA = ent.GetTransformedCopy(mt);
                    btr.AppendEntity(entA);
                    trans.AddNewlyCreatedDBObject(entA, true);
                    entList.Add(entA);
                }
                ent.Erase();
                trans.Commit();
            }
            return entList;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="num"></param>
        /// <param name="degree"></param>
        /// <param name="center"></param>
        /// <returns></returns>
        public static List<Entity> ArrayPolarEntity(this Entity ent, int num, double degree, Point3d center)
        {
            if (ent.IsNewObject == true)
            {
                //声明一个List集合,用于返回
                List<Entity> entList = new List<Entity>();
                Database db = HostApplicationServices.WorkingDatabase;
                using (Transaction trans = db.TransactionManager.StartTransaction())
                {
                    //打开块表
                    BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
                    //打开块表记录
                    BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
                    degree = degree > 360 ? 360 : degree;
                    degree = degree < -360 ? -360 : degree;
                    int divAngNum = num - 1;
                    if (degree == 360 || degree == -360)
                    {
                        divAngNum = num;
                    }
                    for (int i = 0; i < num; i++)
                    {
                        Matrix3d mt = Matrix3d.Rotation((i * degree / divAngNum).DegreeToAngle(), Vector3d.ZAxis, center);
                        Entity entA = ent.GetTransformedCopy(mt);
                        btr.AppendEntity(entA);
                        trans.AddNewlyCreatedDBObject(entA, true);
                        entList.Add(entA);
                    }
                    trans.Commit();
                }
                return entList;
            }
            else
            {
               return ent.ObjectId.ArrayPolarEntity(num, degree, center);
            }
        }
    }
}

改变图形颜色

       [CommandMethod("EditDemo")]
       public void EditDemo()
       {
           Database db = HostApplicationServices.WorkingDatabase;
           //db.AddCircleModelSpace(new Point3d(100, 100, 0), 50);
           Circle c1 = new Circle(new Point3d(100, 100, 0), new Vector3d(0, 0, 1), 50);
           Circle c2 = new Circle(new Point3d(200, 100, 0), new Vector3d(0, 0, 1), 50);

           db.AddEntityToModelSpace(c1);

           c1.ChangeEntityColor(1);
           c2.ChangeEntityColor(6);

           db.AddEntityToModelSpace(c2);

       }

在这里插入图片描述

移动图形

 [CommandMethod("MoveDemo")]
 public void MoveDemo()
 {
     Database db = HostApplicationServices.WorkingDatabase;

     Circle c1 = new Circle(new Point3d(100, 100, 0), new Vector3d(0, 0, 1), 50);
     Circle c2 = new Circle(new Point3d(100, 100, 0), new Vector3d(0, 0, 1), 50);
     Circle c3 = new Circle(new Point3d(100, 100, 0), new Vector3d(0, 0, 1), 50);
     Point3d p1 = new Point3d(100, 100, 0);
     Point3d p2 = new Point3d(200, 300, 0);
     //c2.Center = new Point3d(c2.Center.X + p2.X - p1.X, c2.Center.Y + p2.Y - p1.Y, 0);
     //db.AddEnityToModelSpace(c1, c2);

     db.AddEnityToModelSpace(c1,c2);

     c2.MoveEntity(p1, p2);
     c3.MoveEntity(p2, p1);

     db.AddEnityToModelSpace(c3);
 }

## 复制图形

```csharp
//复制图形
[CommandMethod("CopyDemo")]
public void CopyDemo()
{
    Database db = HostApplicationServices.WorkingDatabase;

    Circle c1 = new Circle(new Point3d(100, 100, 0), Vector3d.ZAxis, 100);
    Circle c2 = (Circle)c1.CopyEntity(new Point3d(100, 100, 0), new Point3d(100, 200, 0));
    db.AddEnityToModelSpace(c1,c2);
    Circle c3 = (Circle)c1.CopyEntity(new Point3d(0, 0, 0), new Point3d(-100, 0, 0));
    db.AddEnityToModelSpace(c3);
}

旋转图形

//旋转图形
[CommandMethod("RotateDemo")]
public void RotateDemo()
{
    Database db = HostApplicationServices.WorkingDatabase;

    Line l1 = new Line(new Point3d(100, 100, 0), new Point3d(300, 100, 0));
    Line l2 = new Line(new Point3d(100, 100, 0), new Point3d(300, 100, 0));
    Line l3 = new Line(new Point3d(100, 100, 0), new Point3d(300, 100, 0));
    
    l1.RotateEntity(new Point3d(100, 100, 0), 30);
    db.AddEnityToModelSpace(l1,l2,l3);
    l2.RotateEntity(new Point3d(0, 0, 0), 60);

    l3.RotateEntity(new Point3d(200, 500, 0), 90);
}

镜像图形

[CommandMethod("MirrorDemo1")]
public void MirrorDemo1()
{
    Database db = HostApplicationServices.WorkingDatabase;
    Circle c1 = new Circle(new Point3d(100, 100, 0), Vector3d.ZAxis, 50);
    ObjectId cId =  db.AddEnityToModelSpace(c1);

    Entity Ent = cId.MirrorEntity(new Point3d(200, 100, 0), new Point3d(200, 300, 0), true);
    db.AddEnityToModelSpace(Ent);

    Circle c2 = new Circle(new Point3d(100, 200, 0), Vector3d.ZAxis, 50);
    Entity ent2 = c2.MirrorEntity(new Point3d(200, 100, 0), new Point3d(200, 300, 0), true);
    //Entity ent3 = c2.MirrorEntity(new Point3d(200, 100, 0), new Point3d(200, 300, 0), false);
    db.AddEnityToModelSpace(c2,ent2);
}

缩放图形

        [CommandMethod("ScaleDemo")]
        public void ScaleDemo()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Circle c1 = new Circle(new Point3d(100, 100, 0), Vector3d.ZAxis, 50);
            db.AddEnityToModelSpace(c1);
            Circle c2 = new Circle(new Point3d(200, 100, 0), Vector3d.ZAxis, 50);
            c2.ScaleEntity(new Point3d(200, 100, 0), 0.5);
            db.AddEnityToModelSpace(c2);
            Circle c3 = new Circle(new Point3d(300, 100, 0), Vector3d.ZAxis, 50);
            db.AddEnityToModelSpace(c3);
            c3.ScaleEntity(new Point3d(0, 0, 0), 2);
        }

删除图形对象

[CommandMethod("EraseDemo")]
public void EraseDemo()
{
    Database db = HostApplicationServices.WorkingDatabase;
    Circle c1 = new Circle(new Point3d(100, 100, 0), Vector3d.ZAxis, 50);
    Circle c2 = new Circle(new Point3d(200, 100, 0), Vector3d.ZAxis, 50);
    db.AddEnityToModelSpace(c1, c2);
    c2.ObjectId.EraseEntity();
}

矩形阵列图形

        [CommandMethod("ArrayRectDemo1")]
        public void ArrayRectDemo1()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            //ObjectId cirId = db.AddCircleModelSpace(new Point3d(100, 100, 0), 20);

            //cirId.ArrayRectEntity(5, 6, -50, -50);

            Circle c = new Circle(new Point3d(100, 100, 0), Vector3d.ZAxis, 10);

            c.ArrayRectEntity(5, 6, -50, 50);
        }

环形阵列图形

[CommandMethod("ArrayPolarDemo")]
public void ArrayPolarDemo()
{
    Database db = HostApplicationServices.WorkingDatabase;
    //ObjectId lineId = db.AddLineToModelSpace(new Point3d(100, 100, 0), new Point3d(120, 100, 0));
    //lineId.ArrayPolarEntity(6, 360, new Point3d(100, 200, 0));

    //ObjectId lineId2 = db.AddLineToModelSpace(new Point3d(500, 100, 0), new Point3d(520, 100, 0));
    //lineId2.ArrayPolarEntity(6, 350, new Point3d(500, 200, 0));

    //ObjectId lineId3 = db.AddLineToModelSpace(new Point3d(1000, 100, 0), new Point3d(1020, 100, 0));
    //lineId3.ArrayPolarEntity(6, -350, new Point3d(1000, 200, 0));
    Line l = new Line(new Point3d(100, 100, 0), new Point3d(120, 120, 0));
    l.ArrayPolarEntity(7, -270, new Point3d(110, 300, 0));
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1696681.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

等保2.0看这一篇就够了

一、等级保护介绍 1.1什么是等级保护 网络安全等级保护是指对国家重要信息、法人和其他组织及公民的专有信息以及信息和存储、传输、处理这些信息的信息系统分等级实行安全保护&#xff0c;对信息系统中使用的信息安全产品实行按等级管理&#xff0c;对信息系统中发生的信息安…

有人物联网4G模块【WH-LTE-7S1】超简单上云流程完整版~!(一)

目录 前言一、所需环境二、使用步骤1.官方资料包获取2.硬件连接3.云平台配置 四、结尾 前言 废话不多说直接上干货 一、所需环境 1、有人家的WH-LTE-7S1&#xff08;带配套底板&#xff09;。 2、串口工具&#xff08;TTL或USB485&#xff09;。二、使用步骤 1.官方资料包获…

颜色值进制转换

颜色值进制转换 专业的和非专业程序员在编程时都碰到过颜色值的表达式。特别是在编制网页和设计界面时&#xff0c;都要选择颜色。各语言的颜色值表达式就两种&#xff0c;十六进制的颜色值hex$和十进制的RGB格式。现成的调色板颜色表也是这两种格式。写代码时会遇到写颜色值码…

NVIDIA Jetson 上编译opencv 4.9.0

直接上命令 cmake .. \ -DCMAKE_C_COMPILER/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER/usr/bin/g-7 \ -DCMAKE_BUILD_TYPERelease \ -DCMAKE_INSTALL_PREFIX/usr/local \ -DOPENCV_ENABLE_NONFREE1 \ -DBUILD_opencv_python21 \ -DBUILD_opencv_python31 \ -DCUDA_TOOLKIT_ROOT_DIR…

使用Django框架搭建Web应用

文章目录 简介安装Django创建一个Django项目创建一个Django应用编写视图配置URL运行开发服务器总结与拓展数据库集成管理后台表单处理模板引擎安全性 简介 Django 是一款基于 Python 语言的开源 Web 应用框架&#xff0c;采用了 MVC&#xff08;模型-视图-控制器&#xff09;设…

运筹说 第115期 | 排队论经典例题讲解

通过前几期的学习&#xff0c;我们已经学会了排队论的基本概念、生灭过程和Poisson过程&#xff0c;等待制排队模型、混合制排队模型、其他排队模型以及排队系统优的定义与相关求解方法。在实际工作中&#xff0c;我们能发现排队论在经济管理中有着许多应用&#xff0c;本期小编…

神经网络的工程基础(一)——利用PyTorch实现梯度下降法

相关说明 这篇文章的大部分内容参考自我的新书《解构大语言模型&#xff1a;从线性回归到通用人工智能》&#xff0c;欢迎有兴趣的读者多多支持。 本文涉及到的代码链接如下&#xff1a;regression2chatgpt/ch06_optimizer/gradient_descent.ipynb 本文将讨论利用PyTorch实现…

高斯过程学习笔记

目录 基础知识 例子 推荐 A Visual Exploration of Gaussian Processes (distill.pub) AB - Introduction to Gaussian Processes - Part I (bridg.land) 基础知识 高斯过程回归&#xff08;Gaussian Process Regression&#xff09; - 知乎 (zhihu.com) 高斯过程&#x…

VS2022上通过C++绘图库ROOT库绘制一个3D曲面图

ROOT库提供了强大的交互式图形功能。通过使用ROOT库的TCanvas和TApplication类&#xff0c;可以创建一个交互式的图形窗口&#xff0c;可以对图形进行缩放、平移、旋转等操作&#xff0c;并且可以通过鼠标和键盘与图形进行交互&#xff0c;这点实在是太厉害了&#xff0c;也就是…

贪心算法4(c++)

过河的最短时间 题目描述 输入 在漆黑的夜里&#xff0c;N位旅行者来到了一座狭窄而且没有护栏的桥边。如果不借助手电筒的话&#xff0c;大家是无论如何也不敢过桥去的。不幸的是&#xff0c;N个人一共只带了一只手电筒&#xff0c;而桥窄得只够让两个人同时过&#xff0c;如果…

Java进阶学习笔记21——泛型概念、泛型类、泛型接口

泛型&#xff1a; 定义类、接口、方法的时候&#xff0c;同时声明了一个或者多个类型变量&#xff08;如: <E>&#xff09;,称之为泛型类、泛型接口、泛型方法&#xff0c;我们统称之为泛型。 说明这是一个泛型类。 如果不使用泛型&#xff0c;我们可以往ArrayList中传…

【多线程开发 2】从代码到实战TransmittableThreadLocal

【多线程开发 2】从代码到实战TransmittableThreadLocal 本文将从以下几个点讲解TransmittableThreadLocal(为了方便写以下简称ttl)&#xff1a; 前身 是什么&#xff1f; 可以用来做什么&#xff1f; 源码原理 实战 前身 ThreadLocal 要了解ttl就要先了解Java自带的类…

【C语言】指针作为参数(传值调用vs传址调用)

前言 在前面讲了那些指针相关的内容后&#xff0c;是时候探讨一下指针有什么作用了。 在C语言中&#xff0c;指针有多种各不相同的应用&#xff0c;在本篇文章中&#xff0c;我们探讨一下指针作为函数参数的作用&#xff08;对比传值与传址两种不同函数调用方式&#xff09;。…

解决git克隆项目出现fatal无法访问git clone https://github.com/lvgl/lvgl.git

Windows 11系统 报错 $ git clone https://github.com/lvgl/lvgl.git Cloning into lvgl... fatal: unable to access https://github.com/lvgl/lvgl.git/: Failed to connect to github.com port 443 after 21141 ms: Couldnt connect to server 解决方法 git运行这两段代码…

008-Linux后台进程管理(作业控制:、jobs、fg、bg、ctrl + z、nohup)

文章目录 前言 1、& 2、ctrl z 3、jobs 4、fg&#xff1a;将后台进程调到前台执行 5、bg&#xff1a;将一个暂停的后台进程变为执行 6、&和nohup 总结 前言 有时候我们需要将一个进程放到后台去运行&#xff0c;或者将后台程序切换回前台&#xff0c;这时候就…

LabVIEW如何实现多张图拼接

在LabVIEW中实现相机多次拍摄进行拼接的过程&#xff0c;可以分为以下几个步骤&#xff1a;设置相机参数、控制相机拍摄、图像处理与拼接、显示和保存结果。以下是一个详细的实现方案&#xff1a; 1. 设置相机参数 首先需要配置相机的参数&#xff0c;例如分辨率、曝光时间、…

如何用ai打一场酣畅淋漓的数学建模比赛? 给考研加加分!

文章目录 数学建模比赛1. 数学建模是什么&#xff1f;2. 数学建模分工合作2.1 第一&#xff1a;组队和分工合作2.2 第二&#xff1a;充分的准备2.3 第三&#xff1a;比赛中写论文过程 3. 数学建模基本过程4. 2023全年数学建模竞赛时间轴5. 数学建模-资料大全6. 数学建模实战 数…

精品PPT | MES设计与实践,业务+架构+实施(免费下载))

【1】关注本公众号&#xff0c;转发当前文章到微信朋友圈 【2】私信发送 MES设计与实践 【3】获取本方案PDF下载链接&#xff0c;直接下载即可。 如需下载本方案PPT/WORD原格式&#xff0c;请加入微信扫描以下方案驿站知识星球&#xff0c;获取上万份PPT/WORD解决方案&#x…

Ant Design pro 6.0.0 搭建使用以及相关配置

一、背景 在选择一款比较合适的中台的情况下&#xff0c;挑选了有arco design、ant design pro、soybean、vue-pure-admin等中台系统&#xff0c;经过筛选就选择了ant design pro。之前使用过arco design 搭建通过组件库拼装过后台管理界面&#xff0c;官方文档也比较全&#…

软件安全复习

文章目录 第一章 软件安全概述1.1 信息定义1.2 信息的属性1.3 信息安全1.4 软件安全1.5 软件安全威胁及其来源1.5.1 软件缺陷与漏洞1.5.1.1 软件缺陷1.5.1.2 漏洞1.5.1.3 软件漏洞1.5.1.4 软件缺陷和漏洞的威胁 1.5.2 恶意软件1.5.2.1 恶意软件的定义1.5.2.2 恶意软件的威胁 1.…