在Visual Studio中创建包含窗体的AutoCAD C#项目

第一步:创建项目

1. 打开Visual Studio
2. 点击"新建项目"
3. 选择"类库(.NET Framework)" - 注意选择与你的AutoCAD版本兼容的.NET版本
4. 命名项目为`CircleGeneratorPlugin`
5. 点击"创建"
 

第二步:组织项目结构

CircleGeneratorPlugin/
├── Commands/
│   └── CircleCommands.cs
├── Forms/
│   ├── CircleInputForm.cs
│   └── CircleInputForm.Designer.cs
├── Properties/
│   └── Settings.settings
└── CircleGeneratorPlugin.csproj

1. 在解决方案资源管理器中右键项目 → 添加 → 新建文件夹

   - 创建`Commands`文件夹

   - 创建`Forms`文件夹

# 项目文件夹与命名空间的关系详解

在C#项目中,文件夹和命名空间的关系需要明确理解,它们既有关联又有区别。下面我会详细解释,并用你的AutoCAD插件项目作为例子说明。

## 核心结论

**文件夹结构不自动决定命名空间**,但Visual Studio默认会基于文件夹路径生成命名空间建议。

## 详细解释

### 1. 默认行为

当你在Visual Studio中:
1. 创建文件夹(如`Commands`和`Forms`)
2. 在这些文件夹中添加新类文件时

Visual Studio**默认**会:
- 使用"根命名空间.文件夹名"作为新类的命名空间
- 根命名空间就是你在项目属性中设置的"默认命名空间"(项目右键→属性→应用程序→默认命名空间)

### 2. 你的项目具体分析

以你的`CircleGeneratorPlugin`项目为例:

```
CircleGeneratorPlugin/ (默认命名空间: CircleGeneratorPlugin)
├── Commands/
│   └── CircleCommands.cs
├── Forms/
│   └── CircleInputForm.cs
```

- **CircleCommands.cs**的默认命名空间会是:`CircleGeneratorPlugin.Commands`
- **CircleInputForm.cs**的默认命名空间会是:`CircleGeneratorPlugin.Forms`

### 3. 关键注意事项

1. **命名空间可以手动修改**:
   - 即使文件在Commands文件夹中,你也可以手动将命名空间改为任何名称
   - 但保持文件夹和命名空间一致是良好的实践
 

 

## 第三步:添加窗体类

 

1. 右键`Forms`文件夹 → 添加 → 新建项

2. 选择"Windows 窗体" → 命名为`CircleInputForm.cs`

using System;

using System.Windows.Forms;

 

namespace CircleGeneratorPlugin.Forms

{

    public partial class CircleInputForm : Form

    {

        // 公开属性用于获取圆的数量

        public int CircleCount { get; private set; } = 1; // 默认1个圆

 

        public CircleInputForm()

        {

            InitializeComponent();

        }

 

        private void btnOK_Click(object sender, EventArgs e)

        {

            if (int.TryParse(txtCircleCount.Text, out int count) && count > 0)

            {

                CircleCount = count;

                this.DialogResult = DialogResult.OK;

                this.Close();

            }

            else

            {

                MessageBox.Show("请输入有效的正整数!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

        }

 

        private void btnCancel_Click(object sender, EventArgs e)

        {

            this.DialogResult = DialogResult.Cancel;

            this.Close();

        }

    }

}

 

 

4. 设计窗体界面:
   - 添加一个Label:"请输入要生成的圆的数量:"
   - 添加一个TextBox (命名为`txtCircleCount`)
   - 添加两个Button:"确定"(命名为`btnOK`)和"取消"(命名为`btnCancel`)

## 第四步:添加AutoCAD命令类

1. 右键`Commands`文件夹 → 添加 → 类
2. 命名为`CircleCommands.cs`
3. 修改代码:

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using CircleGeneratorPlugin.Forms;
using System;

namespace CircleGeneratorPlugin.Commands
{
    public class CircleCommands
    {
        [CommandMethod("GenerateCircles")]
        public void GenerateCircles()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            try
            {
                // 显示输入窗体
                using (CircleInputForm form = new CircleInputForm())
                {
                    if (Application.ShowModalDialog(form) != DialogResult.OK)
                    {
                        ed.WriteMessage("\n用户取消了操作");
                        return;
                    }

                    int circleCount = form.CircleCount;
                    ed.WriteMessage($"\n将生成 {circleCount} 个圆...");

                    // 开始事务处理
                    using (Transaction tr = db.TransactionManager.StartTransaction())
                    {
                        // 获取当前空间块表记录
                        BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                        BlockTableRecord btr = tr.GetObject(
                            bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

                        // 生成指定数量的圆
                        for (int i = 0; i < circleCount; i++)
                        {
                            // 创建圆 (位置按索引排列)
                            Circle circle = new Circle(
                                new Point3d(i * 10, 0, 0),  // X坐标间隔10个单位
                                Vector3d.ZAxis,             // 法向量(Z轴)
                                5);                        // 半径5个单位

                            // 添加到图形数据库
                            btr.AppendEntity(circle);
                            tr.AddNewlyCreatedDBObject(circle, true);
                        }

                        tr.Commit();
                        ed.WriteMessage($"\n成功生成 {circleCount} 个圆!");
                    }
                }
            }
            catch (Exception ex)
            {
                ed.WriteMessage($"\n错误: {ex.Message}");
            }
        }
    }
}

 

功能增强版

using System;
using System.Drawing;
using System.Windows.Forms;
using CircleGeneratorPlugin.Properties;

namespace CircleGeneratorPlugin.Forms
{
    public partial class CircleInputForm : Form
    {
        // 公开属性用于获取所有参数
        public int CircleCount { get; private set; }
        public double CircleRadius { get; private set; }
        public double CircleSpacing { get; private set; }
        public Color CircleColor { get; private set; }
        public bool ExportToTxt { get; private set; }
        public string ExportPath { get; private set; }

        public CircleInputForm()
        {
            InitializeComponent();
            LoadSettings();
        }

        private void LoadSettings()
        {
            // 加载上次的设置作为默认值
            numCircleCount.Value = Settings.Default.LastCircleCount;
            numRadius.Value = (decimal)Settings.Default.LastRadius;
            numSpacing.Value = (decimal)Settings.Default.LastSpacing;
            colorDialog.Color = Settings.Default.LastColor;
            btnColor.BackColor = colorDialog.Color;
            chkExport.Checked = Settings.Default.LastExportEnabled;
            txtExportPath.Text = Settings.Default.LastExportPath;
            radUniform.Checked = Settings.Default.LastDistributionType == 0;
            radRandom.Checked = Settings.Default.LastDistributionType == 1;
        }

        private void SaveSettings()
        {
            // 保存当前设置
            Settings.Default.LastCircleCount = (int)numCircleCount.Value;
            Settings.Default.LastRadius = (double)numRadius.Value;
            Settings.Default.LastSpacing = (double)numSpacing.Value;
            Settings.Default.LastColor = colorDialog.Color;
            Settings.Default.LastExportEnabled = chkExport.Checked;
            Settings.Default.LastExportPath = txtExportPath.Text;
            Settings.Default.LastDistributionType = radUniform.Checked ? 0 : 1;
            Settings.Default.Save();
        }

        private void btnColor_Click(object sender, EventArgs e)
        {
            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                btnColor.BackColor = colorDialog.Color;
            }
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.Filter = "文本文件|*.txt";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    txtExportPath.Text = sfd.FileName;
                }
            }
        }

        private void chkExport_CheckedChanged(object sender, EventArgs e)
        {
            txtExportPath.Enabled = btnBrowse.Enabled = chkExport.Checked;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!ValidateInput())
                return;

            // 保存用户输入的值
            CircleCount = (int)numCircleCount.Value;
            CircleRadius = (double)numRadius.Value;
            CircleSpacing = (double)numSpacing.Value;
            CircleColor = colorDialog.Color;
            ExportToTxt = chkExport.Checked;
            ExportPath = txtExportPath.Text;

            SaveSettings();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private bool ValidateInput()
        {
            if (numCircleCount.Value <= 0)
            {
                MessageBox.Show("圆的数量必须大于0!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            if (numRadius.Value <= 0)
            {
                MessageBox.Show("半径必须大于0!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            if (numSpacing.Value < 0)
            {
                MessageBox.Show("间距不能为负数!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            if (chkExport.Checked && string.IsNullOrWhiteSpace(txtExportPath.Text))
            {
                MessageBox.Show("请选择导出文件路径!", "输入错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            return true;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}

 

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using CircleGeneratorPlugin.Forms;
using System;
using System.IO;
using System.Windows.Forms;
using Color = Autodesk.AutoCAD.Colors.Color;

namespace CircleGeneratorPlugin.Commands
{
    public class CircleCommands
    {
        [CommandMethod("GENCIRCLES")]
        public void GenerateCircles()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            try
            {
                // 显示输入窗体
                using (CircleInputForm form = new CircleInputForm())
                {
                    if (Application.ShowModalDialog(form) != DialogResult.OK)
                    {
                        ed.WriteMessage("\n操作已取消");
                        return;
                    }

                    // 开始事务处理
                    using (Transaction tr = db.TransactionManager.StartTransaction())
                    {
                        // 获取当前空间块表记录
                        BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                        BlockTableRecord btr = tr.GetObject(
                            bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

                        // 准备导出数据
                        System.Text.StringBuilder exportData = null;
                        if (form.ExportToTxt)
                        {
                            exportData = new System.Text.StringBuilder();
                            exportData.AppendLine("Index,X,Y,Radius");
                        }

                        // 生成指定数量的圆
                        for (int i = 0; i < form.CircleCount; i++)
                        {
                            double xPos = i * form.CircleSpacing;
                            double radius = form.CircleRadius;
                            
                            // 创建圆
                            Circle circle = new Circle(
                                new Point3d(xPos, 0, 0),  // 位置
                                Vector3d.ZAxis,           // 法向量
                                radius);                  // 半径

                            // 设置颜色
                            circle.Color = Color.FromColor(form.CircleColor);

                            // 添加到图形数据库
                            btr.AppendEntity(circle);
                            tr.AddNewlyCreatedDBObject(circle, true);

                            // 记录导出数据
                            if (form.ExportToTxt)
                            {
                                exportData.AppendLine($"{i + 1},{xPos},0,{radius}");
                            }
                        }

                        // 导出到文件
                        if (form.ExportToTxt && exportData != null)
                        {
                            try
                            {
                                File.WriteAllText(form.ExportPath, exportData.ToString());
                                ed.WriteMessage($"\n圆数据已导出到: {form.ExportPath}");
                            }
                            catch (Exception ex)
                            {
                                ed.WriteMessage($"\n导出失败: {ex.Message}");
                            }
                        }

                        tr.Commit();
                        ed.WriteMessage($"\n成功生成 {form.CircleCount} 个圆!");
                    }
                }
            }
            catch (Exception ex)
            {
                ed.WriteMessage($"\n错误: {ex.Message}\n{ex.StackTrace}");
                try
                {
                    // 尝试记录错误到文件
                    string errorLogPath = Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                        "CircleGenerator_ErrorLog.txt");
                    File.AppendAllText(errorLogPath, $"{DateTime.Now}: {ex}\n\n");
                }
                catch { }
            }
        }
    }
}

5. 设置文件 (Settings.settings)

 

在设置设计器中添加以下设置项:

- LastCircleCount (int, 默认1)

- LastRadius (double, 默认5.0)

- LastSpacing (double, 默认10.0)

- LastColor (System.Drawing.Color, 默认Red)

- LastExportEnabled (bool, 默认false)

- LastExportPath (string, 默认空)

- LastDistributionType (int, 默认0)

 

 

增强:

using System;

using System.Drawing;

using System.Windows.Forms;

 

namespace EnhancedCirclePlugin

{

    public partial class InputForm : Form

    {

        public int CircleCount { get; private set; } = 5;

        public double Radius { get; private set; } = 10.0;

        public double Spacing { get; private set; } = 30.0;

        public int ArrangementMode { get; private set; } = 0; // 0=直线, 1=矩形, 2=圆形

        public string LayerName { get; private set; } = "0";

        public Color CircleColor { get; private set; } = Color.Black;

 

        public InputForm()

        {

            InitializeComponent();

        }

 

        private void btnOK_Click(object sender, EventArgs e)

        {

            if (!ValidateInputs()) return;

            

            DialogResult = DialogResult.OK;

            Close();

        }

 

        private bool ValidateInputs()

        {

            // 验证圆数量

            if (!int.TryParse(txtCount.Text, out int count) || count < 1)

            {

                MessageBox.Show("请输入有效的正整数", "圆数量错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return false;

            }

            CircleCount = count;

 

            // 验证半径

            if (!double.TryParse(txtRadius.Text, out double radius) || radius <= 0)

            {

                MessageBox.Show("请输入有效的正数", "半径错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return false;

            }

            Radius = radius;

 

            // 验证间距

            if (!double.TryParse(txtSpacing.Text, out double spacing) || spacing <= 0)

            {

                MessageBox.Show("请输入有效的正数", "间距错误", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return false;

            }

            Spacing = spacing;

 

            // 获取排列模式

            ArrangementMode = cmbArrangement.SelectedIndex;

 

            // 获取图层名称

            LayerName = txtLayer.Text.Trim();

 

            return true;

        }

 

        private void btnColor_Click(object sender, EventArgs e)

        {

            ColorDialog colorDialog = new ColorDialog();

            if (colorDialog.ShowDialog() == DialogResult.OK)

            {

                CircleColor = colorDialog.Color;

           

    btnColor.BackColor = CircleColor;

            }

        }

    }

}

 

using Autodesk.AutoCAD.ApplicationServices;

using Autodesk.AutoCAD.Colors;

using Autodesk.AutoCAD.DatabaseServices;

using Autodesk.AutoCAD.EditorInput;

using Autodesk.AutoCAD.Geometry;

using Autodesk.AutoCAD.Runtime;

using System;

 

namespace EnhancedCirclePlugin

{

    public class CircleCommands

    {

        [CommandMethod("ENHANCEDCIRCLES")]

        public void EnhancedCirclesCommand()

        {

            Document doc = Application.DocumentManager.MdiActiveDocument;

            Database db = doc.Database;

            Editor ed = doc.Editor;

 

            try

            {

                // 显示配置对话框

                using (InputForm form = new InputForm())

                {

                    if (Application.ShowModalDialog(form) != DialogResult.OK)

                    {

                        ed.WriteMessage("\n操作已取消");

                        return;

                    }

 

                    // 获取基点

                    PromptPointResult basePointResult = ed.GetPoint("\n指定基点: ");

                    if (basePointResult.Status != PromptStatus.OK) return;

 

                    Point3d basePoint = basePointResult.Value;

 

                    // 开始事务处理

                    using (Transaction tr = db.TransactionManager.StartTransaction())

                    {

                        // 确保图层存在

                        LayerTable lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);

                        if (!lt.Has(form.LayerName))

                        {

                            LayerTableRecord ltr = new LayerTableRecord

                            {

                                Name = form.LayerName,

                                Color = Color.FromColor(form.CircleColor)

                            };

                            lt.UpgradeOpen();

                            lt.Add(ltr);

                            tr.AddNewlyCreatedDBObject(ltr, true);

                        }

 

                        // 获取模型空间

                        BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

                        BlockTableRecord btr = (BlockTableRecord)tr.GetObject(

                            bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);

 

                        // 根据排列模式创建圆

                        switch (form.ArrangementMode)

                        {

                            case 0: // 直线排列

                                CreateLinearArrangement(tr, btr, basePoint, form);

                                break;

                            case 1: // 矩形排列

                                CreateRectangularArrangement(tr, btr, basePoint, form);

                                break;

                            case 2: // 圆形排列

                                CreateCircularArrangement(tr, btr, basePoint, form);

                                break;

                        }

 

                        tr.Commit();

                        ed.WriteMessage($"\n成功创建 {form.CircleCount} 个圆");

                    }

                }

            }

            catch (Exception ex)

            {

                ed.WriteMessage($"\n错误: {ex.Message}");

            }

        }

 

        private void CreateLinearArrangement(Transaction tr, BlockTableRecord btr, Point3d basePoint, InputForm form)

        {

            for (int i = 0; i < form.CircleCount; i++)

            {

                Point3d center = new Point3d(

                    basePoint.X + i * form.Spacing,

                    basePoint.Y,

                    basePoint.Z);

 

                CreateCircle(btr, tr, center, form);

            }

        }

 

        private void CreateRectangularArrangement(Transaction tr, BlockTableRecord btr, Point3d basePoint, InputForm form)

        {

            int cols = (int)Math.Ceiling(Math.Sqrt(form.CircleCount));

            int rows = (int)Math.Ceiling((double)form.CircleCount / cols);

 

            for (int i = 0; i < rows; i++)

            {

                for (int j = 0; j < cols && (i * cols + j) < form.CircleCount; j++)

                {

                    Point3d center = new Point3d(

                        basePoint.X + j * form.Spacing,

                        basePoint.Y - i * form.Spacing,

                        basePoint.Z);

 

                    CreateCircle(btr, tr, center, form);

                }

            }

        }

 

        private void CreateCircularArrangement(Transaction tr, BlockTableRecord btr, Point3d basePoint, InputForm form)

        {

            double angleIncrement = 2 * Math.PI / form.CircleCount;

            for (int i = 0; i < form.CircleCount; i++)

            {

                double angle = i * angleIncrement;

                Point3d center = new Point3d(

                    basePoint.X + form.Spacing * Math.Cos(angle),

                    basePoint.Y + form.Spacing * Math.Sin(angle),

                    basePoint.Z);

 

                CreateCircle(btr, tr, center, form);

            }

        }

 

        


        private void CreateCircle(BlockTableRecord btr, Transaction tr, Point3d center, InputForm form)
        {
            Circle circle = new Circle(center, Vector3d.ZAxis, form.Radius);
            circle.Layer = form.LayerName;
            circle.Color = Color.FromColor(form.CircleColor);

            btr.AppendEntity(circle);
            tr.AddNewlyCreatedDBObject(circle, true);
        }
    }
}
```

partial class InputForm

{

    private System.ComponentModel.IContainer components = null;

 

    protected override void Dispose(bool disposing)

    {

        if (disposing && (components != null))

        {

            components.Dispose();

        }

        base.Dispose(disposing);

    }

 

    private void InitializeComponent()

    {

        this.label1 = new Label();

        this.txtCount = new TextBox();

        this.label2 = new Label();

        this.txtRadius = new TextBox();

        this.label3 = new Label();

        this.txtSpacing = new TextBox();

        this.label4 = new Label();

        this.cmbArrangement = new ComboBox();

        this.label5 = new Label();

        this.txtLayer = new TextBox();

        this.label6 = new Label();

        this.btnColor = new Button();

        this.btnOK = new Button();

        this.btnCancel = new Button();

        this.SuspendLayout();

        

        // label1

        this.label1.AutoSize = true;

        this.label1.Location = new Point(12, 15);

        this.label1.Name = "label1";

        this.label1.Size = new Size(65, 12);

        this.label1.TabIndex = 0;

        this.label1.Text = "圆的数量:";

        

        // txtCount

        this.txtCount.Location = new Point(100, 12);

        this.txtCount.Text = "5";

        this.txtCount.Size = new Size(100, 21);

        

        // label2

        this.label2.AutoSize = true;

        this.label2.Location = new Point(12, 45);

        this.label2.Text = "半径:";

        

        // txtRadius

        this.txtRadius.Location = new Point(100, 42);

        this.txtRadius.Text = "10.0";

        

        // label3

        this.label3.AutoSize = true;

        this.label3.Location = new Point(12, 75);

        this.label3.Text = "间距:";

        

        // txtSpacing

        this.txtSpacing.Location = new Point(100, 72);

        this.txtSpacing.Text = "30.0";

        

        // label4

        this.label4.AutoSize = true;

        this.label4.Location = new Point(12, 105);

        this.label4.Text = "排列方式:";

        

        // cmbArrangement

        this.cmbArrangement.Items.AddRange(new object[] { "直线排列", "矩形排列", "圆形排列" });

        this.cmbArrangement.SelectedIndex = 0;

        this.cmbArrangement.Location = new Point(100, 102);

        

        // label5

        this.label5.AutoSize = true;

        this.label5.Location = new Point(12, 135);

        this.label5.Text = "图层:";

        

        // txtLayer

        this.txtLayer.Location = new Point(100, 132);

        this.txtLayer.Text = "0";

        

        // label6

        this.label6.AutoSize = true;

        this.label6.Location = new Point(12, 165);

        this.label6.Text = "颜色:";

        

        // btnColor

        this.btnColor.BackColor = Color.Black;

        this.btnColor.Location = new Point(100, 162);

        this.btnColor.Size = new Size(75, 23);

        this.btnColor.Click += new EventHandler(this.btnColor_Click);

        

        // btnOK

        this.btnOK.Location = new Point(40, 200);

        this.btnOK.Text = "确定";

        this.btnOK.Click += new EventHandler(this.btnOK_Click);

        

        // btnCancel

        this.btnCancel.Location = new Point(125, 200);

        this.btnCancel.Text = "取消";

        this.btnCancel.Click += new EventHandler(this.btnCancel_Click);

        

        // Form设置

        this.ClientSize = new Size(220, 240);

        this.Controls.AddRange(new Control[] {

            this.label1, this.txtCount,

            this.label2, this.txtRadius,

            this.label3, this.txtSpacing,

            this.label4, this.cmbArrangement,

            this.label5, this.txtLayer,

            this.label6, this.btnColor,

            this.btnOK, this.btnCancel

        });

        this.FormBorderStyle = FormBorderStyle.FixedDialog;

        this.MaximizeBox = false;

        this.Text = "圆绘制设置";

    }

 

    private Label label1, label2, label3, label4, label5, label6;

    private TextBox txtCount, txtRadius, txtSpacing, txtLayer;

    private ComboBox cmbArrangement;

    private Button btnColor, btnOK, btnCancel;

}

 

 

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Ragflow】6. Ragflow-plus重磅更新:增加用户后台管理系统

概述 Ragflow本身并不包含用户管理的功能&#xff0c;我在系列前文中&#xff0c;写过一个脚本&#xff0c;用来批量插入用户&#xff0c;并自动加入团队&#xff0c;配置默认模型设置。然而&#xff0c;此方式需要用户安装对应环境&#xff0c;对普通用户并不友好。 因此我开…

什么是贴源库

贴源库的定义与核心概念 贴源库&#xff08;Operational Data Store, ODS&#xff09;是数据架构中的基础层&#xff0c;通常作为数据仓库或数据中台的第一层&#xff0c;负责从业务系统直接抽取、存储原始数据&#xff0c;并保持与源系统的高度一致性。其核心在于“贴近源头”…

MSTP+VRRP三层架构综合实验

一、实验目的 掌握VLAN、VRRP、STP和Eth-Trunk的基本配置方法。 实现内网与外网的通信&#xff0c;并确保网络的高可用性和冗余性。 理解DHCP、OSPF和NAT在网络中的应用。 二、实验环境 网络拓扑&#xff1a;如图所示&#xff0c;包含两台三层交换机&#xff08;SW1、SW2&a…

未来村庄智慧灯杆:点亮乡村智慧生活​

在乡村振兴与数字乡村建设的时代进程中&#xff0c;未来村庄智慧灯杆凭借其多功能集成与智能化特性&#xff0c;已成为乡村基础设施建设领域的崭新焦点&#xff0c;为乡村生活带来了前所未有的便利&#xff0c;推动着乡村生活模式的深刻变革。​ 多功能集成&#xff1a;一杆多能…

RedHatLinux(2025.3.22)

1、创建/www目录&#xff0c;在/www目录下新建name和https目录&#xff0c;在name和https目录下分别创建一个index.htm1文件&#xff0c;name下面的index.html 文件中包含当前主机的主机名&#xff0c;https目录下的index.htm1文件中包含当前主机的ip地址。 &#xff08;1&…

第十五章:Python的Pandas库详解及常见用法

在数据分析领域&#xff0c;Python的Pandas库是一个不可或缺的工具。它提供了高效的数据结构和数据分析工具&#xff0c;使得数据处理变得简单而直观。本文将详细介绍Pandas库的基本功能、常见用法&#xff0c;并通过示例代码演示如何使用Pandas进行数据处理。最后&#xff0c;…

算法为舟 思想为楫:AI时代,创作何为?

在科技浪潮汹涌澎湃的当下,AI技术以前所未有的态势席卷各个领域,创作领域亦未能幸免。当生成式AI展现出在剧本撰写、诗歌创作、图像设计等方面的惊人能力时,人类创作者仿佛置身于文明演化的十字路口,迷茫与困惑交织,兴奋与担忧并存。在AI时代,创作究竟该何去何从?这不仅…

[Raspberry Pi]如何將看門狗(WatchDog)服務建置在樹莓派的Ubuntu作業系統中?

看門狗(WatchDog)服務常應用於連網的嵌入式邊緣設備等IOT裝置和實體伺服器&#xff0c;主要是若這些連網裝置分散在各個應用環境中執行對應任務&#xff0c;例如感測物理數據&#xff0c;監控影像數據或執行各式Docker服務&#xff0c;當連網裝置因故異常&#xff0c;同時又處於…

Linux进程状态补充(10)

文章目录 前言一、阻塞二、挂起三、运行R四、休眠D五、四个重要概念总结 前言 上篇内容大家看的云里雾里&#xff0c;这实在是正常不过&#xff0c;因为例如 写实拷贝 等一些概念的深层原理我还没有讲解&#xff0c;大家不用紧张&#xff0c;我们继续往下学习就行&#xff01;&…

RPCGC阅读

24年的MM 创新 现有点云压缩工作主要集中在保真度优化上。 而在实际应用中&#xff0c;压缩的目的是促进机器分析。例如&#xff0c;在自动驾驶中&#xff0c;有损压缩会显着丢失户外场景的详细信息。在三维重建中&#xff0c;压缩过程也会导致场景数据中语义信息(Contour)的…

keil中文注释出现乱码怎么解决

keil中文注释出现乱码怎么解决 在keil–edit–configuration中encoding改为chinese-GB2312

Linux的进程优先级调度学习笔记

Linux的进程优先级数值范围 范围 -20 到 19&#xff0c;数值越大优先级越低 示例代码 下面是一个简单的 C 语言示例&#xff0c;它演示了如何在 Linux 下修改进程的优先级并观察调度影响。 #include <stdio.h> #include <stdlib.h> #include <unistd.h> …

YOLOv8+ Deepsort+Pyqt5车速检测系统

该系统通过YOLOv8进行高效的目标检测与分割&#xff0c;结合DeepSORT算法完成目标的实时跟踪&#xff0c;并利用GPU加速技术提升处理速度。系统支持模块化设计&#xff0c;可导入其他权重文件以适应不同场景需求&#xff0c;同时提供自定义配置选项&#xff0c;如显示标签和保存…

权限提升—Windows权限提升进程注入令牌窃取服务启动

前言 依旧是提权的内容啦&#xff0c;上次讲的是利用漏洞来进行提权&#xff0c;今天我们主要讲的是利用Windows中的服务、进程等东西进行权限提升。 服务启动 首先要知道一点&#xff0c;就是windows中服务是以system权限运行的&#xff0c;假如我们创建一个运行后门的服务…

数据结构与算法——顺序表之手撕OJ题

文章目录 一、前言二、拿捏OJ题2.1移除元素2.2删除有序数组中的重复项2.3合并两个有序数组 三、总结 一、前言 Do you study today?up在上一次已经讲解完毕了有关顺序表的所有知识&#xff0c;不知道大家是否已经沉淀完毕了呢&#xff1f;有一句老话说得好啊——光看不练假把…

如何在 AI 搜索引擎(GEO)霸屏曝光,快速提升知名度?

虽然大多数人仍然使用 Google 来寻找答案&#xff0c;但正在发生快速转变。ChatGPT、Copilot、Perplexity 和 DeepSeek 等 LLM 已成为主流。这主要是因为每个都有自己的免费和公共版本&#xff0c;并且总是有重大的质量改进。 许多人每天都使用这些工具来提问和搜索互联网&…

4.训练篇2-毕设篇

resnet # 1. 从 torchvision 中加载预训练的 ResNet18 模型 # pretrainedTrue 表示使用在 ImageNet 上预训练过的参数&#xff0c;学习效果更好 base_model_resnet18 models.resnet18(pretrainedTrue)# 2. 获取 ResNet18 模型中全连接层&#xff08;fc&#xff09;的输入特征…

电磁兼容EMC概述

最近重新学了下电磁兼容&#xff0c;对这个东西更清晰了一些&#xff0c;就重新写了一篇&#xff0c;有不足的地方欢迎的大家在评论区里和我交流。 电磁兼容 电磁兼容指的是什么呢&#xff1f;指的是设备在其电磁环境中性能不受降级地正常运行并不对其他设备造成无法承受的电…

坚持“大客户战略”,昂瑞微深耕全球射频市场

北京昂瑞微电子技术股份有限公司&#xff08;简称“昂瑞微”&#xff09;是一家聚焦射频与模拟芯片设计的高新技术企业。随着5G时代的全面到来&#xff0c;智能手机、智能汽车等终端设备对射频前端器件在通信频率、多频段支持、信道带宽及载波聚合等方面提出了更高需求&#xf…

AI赋能职教革新:生成式人工智能(GAI)认证重构技能人才培养新范式

在数字化浪潮的推动下&#xff0c;职业教育正经历着前所未有的变革。面对快速变化的市场需求和技术发展&#xff0c;如何培养具备高技能、高素质的人才成为了职业教育的重要课题。而在这个过程中&#xff0c;人工智能&#xff08;AI&#xff09;技术的融入&#xff0c;无疑为职…