[转]推荐net开发cad入门阅读代码片段

2024-06-10 11:32

本文主要是介绍[转]推荐net开发cad入门阅读代码片段,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

原文:http://www.cnblogs.com/cadlife/articles/2668158.html

using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.EditorInput ;
using Autodesk.AutoCAD.Runtime ;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices ;
namespace CH02
{public class Class1{//--------------------------------------------------------------// 功能:获取用户输入// 作者: // 日期:2007-7-20// 说明://   //----------------------------------------------------------------[CommandMethod("GetData")]public void GetData(){//获取Editor对象Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;//获取整型数据PromptIntegerOptions intOp = new PromptIntegerOptions("请输入多边形的边数:");PromptIntegerResult intRes;intRes = ed.GetInteger(intOp);//判断用户输入if (intRes.Status == PromptStatus.OK){int nSides = intRes.Value;ed.WriteMessage("多边形的边数为:" + nSides);} if (intRes.Status == PromptStatus.Cancel){ed.WriteMessage("用户按了取消ESC键/n" );}}//--------------------------------------------------------------// 功能:要求用户输入点// 作者: // 日期:2007-7-20// 说明://   //----------------------------------------------------------------[CommandMethod("PickPoint")]static public void PickPoint() {//获取Editor对象Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;PromptPointOptions promptPtOp = new PromptPointOptions("选择一个点:");//指定的基点,如果指定了该点,则在选择的时候绘制一条橡皮线。promptPtOp.BasePoint = new Autodesk.AutoCAD.Geometry.Point3d(0, 0, 0);PromptPointResult resPt; resPt = ed.GetPoint(promptPtOp); if (resPt.Status == PromptStatus.OK) {ed.WriteMessage("选择的点为:" + resPt.Value.ToString());} }//--------------------------------------------------------------// 功能:获取选择集// 作者: // 日期:2007-7-20// 说明://   //----------------------------------------------------------------[CommandMethod("SelectEnt")]static public void SelectEnt() {//获取Editor对象Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;PromptSelectionOptions selectionOp = new PromptSelectionOptions();PromptSelectionResult ssRes = ed.GetSelection(selectionOp);if (ssRes.Status == PromptStatus.OK){SelectionSet SS = ssRes.Value;int nCount = SS.Count;ed.WriteMessage("选择了{0}个实体"  , nCount);}      }//--------------------------------------------------------------// 功能:获取选择集(带过滤)// 作者: // 日期:2007-7-20// 说明://   //----------------------------------------------------------------[CommandMethod("SelectEnt2")]static public void SelectEnt2() {//获取Editor对象Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;// 定义选择集选项PromptSelectionOptions selectionOp = new PromptSelectionOptions();//创建选择集过滤器,只选择块对象TypedValue[] filList = new TypedValue[1];filList[0] = new TypedValue((int)DxfCode.Start, "INSERT");SelectionFilter filter = new SelectionFilter(filList);PromptSelectionResult ssRes = ed.GetSelection(selectionOp, filter);if (ssRes.Status == PromptStatus.OK){SelectionSet SS = ssRes.Value;int nCount = SS.Count;ed.WriteMessage("选择了{0}个块"  , nCount);}     }}}


using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
namespace CH03
{public class Class1{//--------------------------------------------------------------// 功能:创建一个新层// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("CreateLayer")]public void CreateLayer(){ObjectId layerId;Database db = HostApplicationServices.WorkingDatabase;//开始一个事务Transaction trans = db.TransactionManager.StartTransaction();try{//首先取得层表LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite);//检查MyLayer层是否存在if (lt.Has("MyLayer")){layerId = lt["MyLayer"];}else{//如果MyLayer层不存在,就创建它LayerTableRecord ltr = new LayerTableRecord();ltr.Name = "MyLayer"; //设置层的名字layerId = lt.Add(ltr);trans.AddNewlyCreatedDBObject(ltr, true);}//提交事务trans.Commit();}catch (Autodesk.AutoCAD.Runtime.Exception e){//放弃事务trans.Abort();}finally{// 显式地释放trans.Dispose();}}//--------------------------------------------------------------// 功能:创建一个圆// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("CreateCircle")]public void  CreateCircle(){Database db = HostApplicationServices.WorkingDatabase;// 使用 "using" ,结束是自动调用事务的 "Dispose" 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);//创建一个圆并添加到块表记录(模型空间)Point3d center = new Point3d(10, 10, 0);Circle circle = new Circle(center, Vector3d.ZAxis, 10.0);circle.ColorIndex = 1;btr.AppendEntity(circle);trans.AddNewlyCreatedDBObject(circle, true);trans.Commit();}}//--------------------------------------------------------------// 功能:创建一个块定义(块表记录)// 作者: // 日期:2007-7-20// 说明://   //----------------------------------------------------------------public ObjectId CreateBlkDef(){//定义函数的返回值ObjectIdObjectId blkObjId = new ObjectId(); Database db = HostApplicationServices.WorkingDatabase;// 使用 "using"关键字指定事务的边界using (Transaction trans = db.TransactionManager.StartTransaction()){//获取块表BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForWrite);//通过块名myBlkName判断块表中是否包含块表记录if ((bt.Has("myBlkName"))){blkObjId = bt["myBlkName"];//如果已经存在,通过块名获取块对应的ObjectId}else{//创建一个圆Point3d center = new Point3d(10, 10, 0); Circle circle = new Circle(center, Vector3d.ZAxis, 2);circle.ColorIndex = 1;      //创建文本Text:MText text = new MText();text.Contents = " ";text.Location = center;text.ColorIndex = 2;//创建新的块表记录 myBlkNameBlockTableRecord newBtr = new BlockTableRecord();newBtr.Name = "myBlkName";newBtr.Origin = center;//保存块表记录到块表blkObjId = bt.Add(newBtr); // 返回块对应的ObjectIdtrans.AddNewlyCreatedDBObject(newBtr, true); //Let the transaction know about any object/entity you add to the database!//保存新创建的实体到块表记录newBtr.AppendEntity(circle); newBtr.AppendEntity(text);// 通知事务新创建了对象trans.AddNewlyCreatedDBObject(circle, true);trans.AddNewlyCreatedDBObject(text, true);}trans.Commit(); //提交事务}return blkObjId;}//--------------------------------------------------------------// 功能:创建一个块引用// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("CreateBlk")]public void CreateBlkRef(){//获取块的插入点Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;PromptPointOptions ptOps = new PromptPointOptions("选择块的插入点");PromptPointResult ptRes;ptRes = ed.GetPoint(ptOps);Point3d ptInsert;if (ptRes.Status == PromptStatus.OK){ptInsert = ptRes.Value ;}else{ptInsert = new Point3d(0, 0, 0);}Database db = HostApplicationServices.WorkingDatabase;// 使用 "using"关键字指定事务的边界using (Transaction trans = db.TransactionManager.StartTransaction()){//获取块表和模型空间BlockTable bt = (BlockTable)(trans.GetObject(db.BlockTableId, OpenMode.ForWrite));BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);//创建块引用BlockReference blkRef = new BlockReference(ptInsert,CreateBlkDef());// 指定插入点和所引用的块表记录blkRef.Rotation = 1.57;//指定旋转角,按弧度//保存新创建的块引用到模型空间    btr.AppendEntity(blkRef); trans.AddNewlyCreatedDBObject(blkRef, true);    // 通知事务新创建了对象trans.Commit(); //提交事务}}//--------------------------------------------------------------// 功能:读取对象的属性// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("OpenEnt")]public void OpenEnt(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;PromptEntityOptions entOps = new PromptEntityOptions("选择要打开的对象");PromptEntityResult entRes;entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}ObjectId objId = entRes.ObjectId;Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){Entity ent = (Entity)trans.GetObject(objId, OpenMode.ForWrite);ent.ColorIndex = 1;trans.Commit();}}}
}

using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
namespace CH04
{public class Class1{//--------------------------------------------------------------// 功能:通过ObjectId打开对象// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("OpenEnt")]public void OpenEnt(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("通过ObjectId打开对象\n");PromptEntityOptions entOps = new PromptEntityOptions("选择要打开的对象\n");PromptEntityResult entRes;entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}ObjectId objId = entRes.ObjectId;Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){Entity ent = trans.GetObject(objId, OpenMode.ForWrite) as Entity ;ent.ColorIndex = 1;trans.Commit();}}//--------------------------------------------------------------// 功能:类型识别和转换// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("GetType")]public void GetType(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("数据库对象的类型识别和转换\n");PromptEntityOptions entOps = new PromptEntityOptions("选择要打开的对象");PromptEntityResult entRes;entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}ObjectId objId = entRes.ObjectId;Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){Entity ent = trans.GetObject(objId, OpenMode.ForWrite) as Entity;ed.WriteMessage("ent.GetRXClass().Name :" + ent.GetRXClass().Name + "\n");if (ent is Line){Line aLine = ent as Line;aLine.ColorIndex = 1;}else if (ent.GetType() == typeof(Circle)){Circle cir = (Circle)ent;cir.ColorIndex = 2;}trans.Commit();}}//--------------------------------------------------------------// 功能:实体对象的属性// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("EntPro")]public void EntPro(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("实体对象的属性\n");PromptEntityOptions entOps = new PromptEntityOptions("选择要打开的对象\n");PromptEntityResult entRes;entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出\n");return;}ObjectId objId = entRes.ObjectId;Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){Entity ent = trans.GetObject(objId, OpenMode.ForWrite) as Entity;ed.WriteMessage("获取或设置实体的线型\n");ed.WriteMessage("实体的原先的线型为 :" + ent.Linetype + "\n");// 获取线型表记录LinetypeTable lineTypeTbl = trans.GetObject(db.LinetypeTableId, OpenMode.ForRead) as LinetypeTable;// 确保DOT线型名已经加载到当前数据库LinetypeTableRecord lineTypeTblRec = trans.GetObject(lineTypeTbl["DOT"], OpenMode.ForRead) as LinetypeTableRecord;// 设置实体的线型ent.LinetypeId = lineTypeTblRec.ObjectId;// 设置实体的线型比例ed.WriteMessage("设置实体的线型比例为2.0\n");ent.LinetypeScale = 2.0;//设置实体的可见性ent.Visible = true;//设置实体所在的层ed.WriteMessage("实体的原先所在的层为 :" + ent.Layer + "\n");ent.Layer = "layer0";trans.Commit();}}}
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
namespace CH05
{public class Class1{//--------------------------------------------------------------// 功能:添加扩展数据XDATA// 作者: // 日期:2007-7-20// 说明:////----------------------------------------------------------------[CommandMethod("AddXData")]public void AddXData(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("添加扩充数据XDATA\n");PromptEntityOptions entOps = new PromptEntityOptions("选择要打开的对象\n");PromptEntityResult entRes;entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}ObjectId objId = entRes.ObjectId;Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){Entity ent = trans.GetObject(objId, OpenMode.ForWrite) as Entity ;ent.ColorIndex = 1;RegAppTable appTbl = trans.GetObject(db.RegAppTableId, OpenMode.ForWrite) as RegAppTable ;if (!appTbl.Has("MyAppName")){RegAppTableRecord appTblRcd = new RegAppTableRecord();appTblRcd.Name = "MyAppName";appTbl.Add(appTblRcd);trans.AddNewlyCreatedDBObject(appTblRcd, true);}ResultBuffer resBuf = new ResultBuffer();//new TypedValue(1001, "MyAppName"), new TypedValue(1000, "开发部门"));resBuf.Add(new TypedValue(1001, "MyAppName"));//注册程序名称resBuf.Add(new TypedValue(1000 , " 张三"));//姓名resBuf.Add(new TypedValue(1000 , " 工程部"));//部门resBuf.Add(new TypedValue(1040, 2000.0));//薪水ent.XData =  resBuf;trans.Commit();}}//--------------------------------------------------------------// 功能:获取扩展数据XDATA// 作者: // 日期:2007-7-20// 说明:////------------------------------------------------------------[CommandMethod("GETXDATA")]public void GETXDATA(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("获取扩充数据XDATA\n");PromptEntityOptions entOps = new PromptEntityOptions("选择带扩展数据的对象");PromptEntityResult entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;using (Transaction trans = db.TransactionManager.StartTransaction()){Entity ent = (Entity)trans.GetObject(entRes.ObjectId, OpenMode.ForRead);ResultBuffer resBuf = ent.XData;if (resBuf != null){//IEnumerator iter = resBuf.GetEnumerator();while (iter.MoveNext()){TypedValue tmpVal = (TypedValue)iter.Current;ed.WriteMessage(tmpVal.TypeCode.ToString() + ":");ed.WriteMessage(tmpVal.Value.ToString() + "\n");}}}}//--------------------------------------------------------------// 功能:在命名对象词典中添加数据// 作者: // 日期:2007-7-20// 说明:////------------------------------------------------------------[CommandMethod("AddInNOD")]public void AddInNOD(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("在命名对象词典中添加数据\n");Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){//获取命名对象词典(NOD)DBDictionary NOD =trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite) as DBDictionary ;// 声明一个新的词典DBDictionary copyrightDict;// 判断是否存在COPYRIGHT词典,没有则创建try{// 获取COPYRIGHT词典copyrightDict = (DBDictionary)trans.GetObject(NOD.GetAt("COPYRIGHT"), OpenMode.ForRead);}catch{//在NOD下创建COPYRIGHT词典copyrightDict = new DBDictionary();NOD.SetAt("COPYRIGHT", copyrightDict);trans.AddNewlyCreatedDBObject(copyrightDict, true);}// 在copyrightDict中,获取或创建 "author" 词典DBDictionary authorDict;try{authorDict = (DBDictionary)trans.GetObject(copyrightDict.GetAt("Author"), OpenMode.ForWrite);}catch{authorDict = new DBDictionary();//"author" doesn't exist, create onecopyrightDict.UpgradeOpen();copyrightDict.SetAt("Author", authorDict);trans.AddNewlyCreatedDBObject(authorDict, true);}// 通过Xrecord和ResultBuffer添加扩展数据Xrecord authorRec;try{authorRec = (Xrecord)trans.GetObject(authorDict.GetAt("AuthorInfo"), OpenMode.ForWrite);}catch{authorRec = new Xrecord();authorRec.Data = new ResultBuffer(new TypedValue((int)DxfCode.Text, "张三"));authorDict.SetAt("AuthorInfo", authorRec);trans.AddNewlyCreatedDBObject(authorRec, true);}trans.Commit();}}//--------------------------------------------------------------// 功能:获取命名对象词典中的数据// 作者: // 日期:2007-7-20// 说明:////------------------------------------------------------------[CommandMethod("GetInNOD")]public void GetInNod(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("获取命名对象词典中数据\n");Database db = HostApplicationServices.WorkingDatabase;using (Transaction trans = db.TransactionManager.StartTransaction()){// 获取NOD DBDictionary NOD = (DBDictionary)trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead, false);// 获取COPYRIGHT词典DBDictionary copyrightDict = (DBDictionary)trans.GetObject(NOD.GetAt("COPYRIGHT"), OpenMode.ForRead);// 获取Author词典DBDictionary AuthorDict = (DBDictionary)trans.GetObject(copyrightDict.GetAt("Author"), OpenMode.ForRead);// 获取AuthorInfo扩展记录XrecordXrecord authorXRec = (Xrecord)trans.GetObject(AuthorDict.GetAt("AuthorInfo"), OpenMode.ForRead);ResultBuffer resBuf = authorXRec.Data;TypedValue val = resBuf.AsArray()[0];ed.WriteMessage("该图纸由{0}设计\n", val.Value);}}//--------------------------------------------------------------// 功能:添加数据到数据库对象的扩展词典中// 作者: // 日期:2007-7-20// 说明:////------------------------------------------------------------[CommandMethod("AddExtDict")]public void AddExtDict(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("创建对象扩展词典\n");PromptEntityOptions entOps = new PromptEntityOptions("选择要添加扩展数据的块\n");PromptEntityResult entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;using (Transaction trans = db.TransactionManager.StartTransaction()){DBObject obj = trans.GetObject(entRes.ObjectId, OpenMode.ForWrite) as DBObject;BlockReference blkRef;if (obj is BlockReference){blkRef = obj as BlockReference;}else{return;}// 创建对象的扩展词典blkRef.CreateExtensionDictionary();DBDictionary extensionDict = (DBDictionary)trans.GetObject(blkRef.ExtensionDictionary, OpenMode.ForWrite, false);// 通过Xrecord准备附加属性数据Xrecord xRec = new Xrecord();xRec.Data = new ResultBuffer(new TypedValue((int)DxfCode.Text, "张三"),// 姓名new TypedValue((int)DxfCode.Real, 1200.0),//薪水new TypedValue((int)DxfCode.Text, "技术部"));// 部门         // 在扩展词典中添加扩展记录extensionDict.SetAt("EmployeeInfomation", xRec); trans.AddNewlyCreatedDBObject(xRec, true);trans.Commit();}}//--------------------------------------------------------------// 功能:获取数据库对象的扩展词典中的数据// 作者: // 日期:2007-7-20// 说明:////------------------------------------------------------------[CommandMethod("GetExtDict")]public void GetExtDict(){Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;ed.WriteMessage("获取对象扩展词典信息\n");PromptEntityOptions entOps = new PromptEntityOptions("选择添加了扩展数据的块\n");PromptEntityResult entRes = ed.GetEntity(entOps);if (entRes.Status != PromptStatus.OK){ed.WriteMessage("选择对象失败,退出");return;}Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;using (Transaction trans = db.TransactionManager.StartTransaction()){DBObject obj = trans.GetObject(entRes.ObjectId, OpenMode.ForWrite) as DBObject;BlockReference blkRef;if (obj is BlockReference){blkRef = obj as BlockReference;}else{ed.WriteMessage("选择对象不是块,退出\n");return;}// 创建对象的扩展词典DBDictionary extensionDict = (DBDictionary)trans.GetObject(blkRef.ExtensionDictionary, OpenMode.ForWrite, false);// 获取AuthorInfo扩展记录XrecordXrecord EmpXRec = (Xrecord)trans.GetObject(extensionDict.GetAt("EmployeeInfomation"), OpenMode.ForRead);ResultBuffer resBuf = EmpXRec.Data;TypedValue val = resBuf.AsArray()[0];ed.WriteMessage("是员工姓名:{0}\n", val.Value);val = resBuf.AsArray()[1];ed.WriteMessage("该员工的薪水:{0}\n", val.Value);val = resBuf.AsArray()[2];ed.WriteMessage("该员工属于:{0}\n", val.Value);trans.Commit();}}}
}


这篇关于[转]推荐net开发cad入门阅读代码片段的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


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

相关文章

Spring Boot 与微服务入门实战详细总结

《SpringBoot与微服务入门实战详细总结》本文讲解SpringBoot框架的核心特性如快速构建、自动配置、零XML与微服务架构的定义、演进及优缺点,涵盖开发环境准备和HelloWorld实战... 目录一、Spring Boot 核心概述二、微服务架构详解1. 微服务的定义与演进2. 微服务的优缺点三

从入门到精通详解LangChain加载HTML内容的全攻略

《从入门到精通详解LangChain加载HTML内容的全攻略》这篇文章主要为大家详细介绍了如何用LangChain优雅地处理HTML内容,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录引言:当大语言模型遇见html一、HTML加载器为什么需要专门的HTML加载器核心加载器对比表二

Python实现MQTT通信的示例代码

《Python实现MQTT通信的示例代码》本文主要介绍了Python实现MQTT通信的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 目录1. 安装paho-mqtt库‌2. 搭建MQTT代理服务器(Broker)‌‌3. pytho

基于Python开发一个图像水印批量添加工具

《基于Python开发一个图像水印批量添加工具》在当今数字化内容爆炸式增长的时代,图像版权保护已成为创作者和企业的核心需求,本方案将详细介绍一个基于PythonPIL库的工业级图像水印解决方案,有需要... 目录一、系统架构设计1.1 整体处理流程1.2 类结构设计(扩展版本)二、核心算法深入解析2.1 自

从入门到进阶讲解Python自动化Playwright实战指南

《从入门到进阶讲解Python自动化Playwright实战指南》Playwright是针对Python语言的纯自动化工具,它可以通过单个API自动执行Chromium,Firefox和WebKit... 目录Playwright 简介核心优势安装步骤观点与案例结合Playwright 核心功能从零开始学习

MySQL进行数据库审计的详细步骤和示例代码

《MySQL进行数据库审计的详细步骤和示例代码》数据库审计通过触发器、内置功能及第三方工具记录和监控数据库活动,确保安全、完整与合规,Java代码实现自动化日志记录,整合分析系统提升监控效率,本文给大... 目录一、数据库审计的基本概念二、使用触发器进行数据库审计1. 创建审计表2. 创建触发器三、Java

Spring Boot spring-boot-maven-plugin 参数配置详解(最新推荐)

《SpringBootspring-boot-maven-plugin参数配置详解(最新推荐)》文章介绍了SpringBootMaven插件的5个核心目标(repackage、run、start... 目录一 spring-boot-maven-plugin 插件的5个Goals二 应用场景1 重新打包应用

Knife4j+Axios+Redis前后端分离架构下的 API 管理与会话方案(最新推荐)

《Knife4j+Axios+Redis前后端分离架构下的API管理与会话方案(最新推荐)》本文主要介绍了Swagger与Knife4j的配置要点、前后端对接方法以及分布式Session实现原理,... 目录一、Swagger 与 Knife4j 的深度理解及配置要点Knife4j 配置关键要点1.Spri

从入门到精通MySQL联合查询

《从入门到精通MySQL联合查询》:本文主要介绍从入门到精通MySQL联合查询,本文通过实例代码给大家介绍的非常详细,需要的朋友可以参考下... 目录摘要1. 多表联合查询时mysql内部原理2. 内连接3. 外连接4. 自连接5. 子查询6. 合并查询7. 插入查询结果摘要前面我们学习了数据库设计时要满

Qt QCustomPlot库简介(最新推荐)

《QtQCustomPlot库简介(最新推荐)》QCustomPlot是一款基于Qt的高性能C++绘图库,专为二维数据可视化设计,它具有轻量级、实时处理百万级数据和多图层支持等特点,适用于科学计算、... 目录核心特性概览核心组件解析1.绘图核心 (QCustomPlot类)2.数据容器 (QCPDataC