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

工具类: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));
}

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

✨✨使用jq+layui-tab+echarts+swiper实现选项卡轮播联动图表展示功能✨✨

使用jqlayui-tabechartsswiper实现选项卡轮播联动图表展示功能 ✨一、实现功能 &#x1f31f;技术框架 使用layui-tab实现tabs切换使用swiper.js实现轮播效果使用echarts.js实现图表展示 &#x1f31f;功能详情 布局为上中下&#xff1a;tab选项上&#xff0c;内容区为中&…

大作业爬取手机数据,实现手机推荐系统以及朋友圈手机论坛

1、功能简介 &#xff08;1&#xff09;用户注册与用户登录 &#xff08;2&#xff09;手机搜索、手机比拼、手机个性化推荐 &#xff08;3&#xff09;点击搜索的手机图片会就用户行为&#xff0c;轮播展示用户行为&#xff0c;推荐点击次数靠前的手机 &#xff08;4&#xf…

网络域名是什么意思

网络域名&#xff0c;顾名思义&#xff0c;就是网络上的名字&#xff0c;类似于现实中的地址或姓名一样&#xff0c;用来标识网络上的一个或一组计算机或服务器的位置&#xff0c;以及它们的相应服务资源。网络域名是互联网上最基础的基础设施之一&#xff0c;是网络通信的“标…

有一个3x4的矩阵,要求用函数编写程序求出其中值最大的那个元素,以及其所在的行号和列号

常量和变量可以用作函数实参&#xff0c;同样数组元素也可以作函数实参&#xff0c;其用法与变量相同。数组名也可以作实参和形参&#xff0c;传递的是数组的起始地址。 用数组元素作函数实参&#xff1a; 由于实参可以是表达式&#xff0c;而数组元素可以是表达式的组…

技术面试,项目实战,求职利器

之前找工作一直想找一个能真正系统性学开发的地方&#xff0c;之前毕业找工作的时候无意间碰到下面这个网站&#xff0c;感觉还挺不错的&#xff0c;用上面的技术实战内容应对技术面试&#xff0c;也算是求职利器了。有需要的可以自取&#xff1a; https://how2j.cn?p156336 实…

【运维】Linux 端口管理实用指南,扫描端口占用

在 Linux 系统中&#xff0c;你可以使用以下几种方法来查看当前被占用的端口&#xff0c;并检查 7860 到 7870 之间的端口&#xff1a; 推荐命令&#xff1a; sudo lsof -i :7860-7870方法一&#xff1a;使用 netstat 命令 sudo netstat -tuln | grep :78[6-7][0-9]这个命令…

从0开始学统计-卡方检验

1.什么是卡方检验&#xff1f; 卡方检验是一种用于检验观察频数与期望频数之间差异的统计方法。它通常用于分析分类变量之间的关联性或独立性。在卡方检验中&#xff0c;我们将观察到的频数与期望频数进行比较&#xff0c;从而确定它们之间的差异是否显著。 卡方检验的基本思…

深入理解与防御跨站脚本攻击(XSS):从搭建实验环境到实战演练的全面教程

跨站脚本攻击&#xff08;XSS&#xff09;是一种常见的网络攻击手段&#xff0c;它允许攻击者在受害者的浏览器中执行恶意脚本。以下是一个XSS攻击的实操教程&#xff0c;包括搭建实验环境、编写测试程序代码、挖掘和攻击XSS漏洞的步骤。 搭建实验环境 1. 安装DVWA&#xff…

手机相册的照片彻底删除了怎么恢复?删除照片恢复的5种方法

在数字化时代&#xff0c;手机相册里装满了我们的生活点滴和珍贵回忆。然而&#xff0c;一不小心就可能误删那些意义非凡的照片。别担心&#xff0c;今天小编就给大家介绍5种恢复误删照片的方法&#xff0c;让你的回忆不再丢失&#xff01; 方法一&#xff1a;相册App的“最近删…

连公司WiFi后,无法访问外网,怎么回事,如何解决?

文章目录 封面问题描述问题探究什么是DNS&#xff1f;分布式&#xff0c;层次数据库如何理解分布式&#xff1f;如何理解层次&#xff1f; 本地DNS服务器迭代查询&#xff0c;递归查询DNS缓存参考资料 封面 问题描述 从甲方项目组返回公司后&#xff0c;我习惯性连上公司WiFi&…

eletron入门教程 -- 快速写一个electron demo程序

1、前言 由于工作需要&#xff0c;前段时间基于electron框架开发了一个桌面应用程序。由于我之前主要是做c后端开发&#xff0c;所以没有任何electron基础&#xff0c;也没有任何前端开发基础&#xff0c;但是没有办法&#xff0c;老板需要&#xff0c;那就得会&#xff0c;不会…

上位机开发--PyQt创建窗口

知不足而奋进 望远山而前行 目录 知不足而奋进 望远山而前行​ 文章目录 前言 1. 第一个PyQt窗口 2. PyQt模块简介 3. 窗口标题和图标 总结 前言 在PyQt的世界中&#xff0c;创建第一个窗口是踏入GUI开发的第一步。本文将引导您逐步学习如何使用PyQt创建简单的窗口&#xff0c…

基于开源二兄弟MediaPipe+Rerun实现人体姿势跟踪可视化

概述 本文中&#xff0c;我们将探索一个利用开源框架MediaPipe的功能以二维和三维方式跟踪人体姿势的使用情形。使这一探索更有趣味的是由开源可视化工具Rerun提供的可视化展示&#xff0c;该工具能够提供人类动作姿势的整体视图。 您将一步步跟随作者使用MediaPipe在2D和3D环…

上位机图像处理和嵌入式模块部署(f103 mcu定时器配置)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 在mcu开发过程当中&#xff0c;有一种开发模式用的比较多&#xff0c;那就是中断while&#xff08;1&#xff09;。这里面的中断&#xff0c;又是以…

电机控制系列模块解析(22)—— 零矢量刹车

一、零矢量刹车 基本概念 逆变器通常采用三相桥式结构&#xff0c;包含六个功率开关元件&#xff08;如IGBT或MOSFET&#xff09;&#xff0c;分为上桥臂和下桥臂。每个桥臂由两个反并联的开关元件组成&#xff0c;上桥臂和下桥臂对应于电机三相绕组的正负端。正常工作时&…

利用EAS自动生成数据模型和sql脚本

EAS适用于敏捷开发中小系统,这节主要讲解EAS对应的模型和数据库脚本输出应用。 在这个应用程序中,用户可自定义实体模型和枚举模型,只要选择相应的实体或者枚举进行右击添加即可。 解决方案参数设定,在解决方案的设定中可设置项目名称、通用语言,命名空间和输出位置。 连…

Ollama| 搭建本地大模型,最简单的方法!效果直逼GPT

很多人想在本地电脑上搭建一个大模型聊天机器人。总是觉得离自己有点远&#xff0c;尤其是对ai没有了解的童鞋。那么今天我要和你推荐ollama&#xff0c;无论你是否懂开发&#xff0c;哪怕是零基础&#xff0c;只需十分钟&#xff0c;Ollama工具就可以帮助我们在本地电脑上搭建…

智能合作:多AI协同助力传统工作流

背景介绍 红杉资本2024 AI AGENT大会上吴恩达再次介绍了AI四大设计模式即&#xff1a; 反思&#xff08;Reflection)&#xff1b;工具使用&#xff08;Tool use&#xff09;&#xff1b;规划&#xff08;Planning)&#xff1b;多智能体协作(Multi-agent collaboration)&#…

centos下安装kibana7.12.1版本并进行相关配置

1、下载与es版本对应的安装包 wget https://artifacts.elastic.co/downloads/kibana/kibana-7.12.1-linux-x86_64.tar.gz 2、解压压缩包 tar -zxvf kibana-7.12.1-linux-x86_64.tar.gz 3、进入到config目录下修改kibana.yml cd /home/soft/kibana-7.12.1-linux-x86_64/config v…

Excel查找匹配函数(VLOOKUP):功能与应用解析

文章目录 概述VLOOKUP函数语法查询并返回单列结果查找并返回多列结果MATCH函数VLOOKUPMATCH 从右向左逆向查找&#xff1a;INDEX函数INDEXMATCH 函数匹配方式查找匹配注意事项函数名称错误: #NAME?值错误&#xff1a;#VALUE!引用错误&#xff1a;#REF!找不到数据&#xff1a;#…