制作cass高程點塊定義——cad c#二次開發——待調試

 public class Demo{[CommandMethod("xx")]public void Demo1(){using var tr1 = new DBTrans();var doc = Application.DocumentManager.MdiActiveDocument; var db = doc.Database;var ed = doc.Editor;var 圓心 = new Point3d(0, 0, 0); var 半徑 = 10.0;using (var tr = db.TransactionManager.StartTransaction()){var bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;var ms = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;var btr = new BlockTableRecord();btr.Name = "MyBlock";if (bt.Has("MyBlock")) {var bid = bt["MyBlock"];bid.EraseBlock();}var bkid = bt.Add(btr); tr.AddNewlyCreatedDBObject(btr, true);Circle cir = new Circle(Point3d.Origin, Vector3d.ZAxis, 1);cir.ColorIndex = 1;var id = btr.AppendEntity(cir); tr.AddNewlyCreatedDBObject(cir, true);Hatch hat = new Hatch();hat.ColorIndex = 1;hat.SetHatchPattern(HatchPatternType.CustomDefined, "SOLID");hat.AppendLoop(HatchLoopTypes.Default, [id]);hat.EvaluateHatch(true); btr.AppendEntity(hat);tr.AddNewlyCreatedDBObject(hat, true);var br = new BlockReference(圓心,bkid);br.ScaleFactors = new Scale3d(半徑);ms.AppendEntity(br);tr.AddNewlyCreatedDBObject(br, true);tr.Commit();}}public Polyline 多段線圓(Point3d pt ,double 半徑, int colorindex){Polyline pl = new Polyline();var p1 = new Point2d(pt.X - 半徑, pt.Y);var p2 = new Point2d(pt.X + 半徑, pt.Y);pl.AddVertexAt(0, p1, Math.Tan(Math.PI/4), 0, 0);pl.AddVertexAt(1, p2, Math.Tan(Math.PI / 4), 0, 0);pl.Closed = true;pl.ColorIndex = colorindex;return pl;}}
 public static bool EraseBlock(this ObjectId objId){Database db = HostApplicationServices.WorkingDatabase;bool isErase = false;try{using (Transaction trans = db.TransactionManager.StartTransaction()){BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);if (bt.Has(objId)){BlockTableRecord bEra = (BlockTableRecord)objId.GetObject(OpenMode.ForWrite);bEra.Erase();}trans.Commit();isErase = true;}return isErase;}catch (Exception){return isErase;throw;}}

網上

public class Demo
{
? ? [CommandMethod("xx")]
? ? public void Demo1()
? ? {
? ? ? ? var doc = Application.DocumentManager.MdiActiveDocument;
? ? ? ? var db = doc.Database;
? ? ? ? var ed = doc.Editor;

? ? ? ? // 獲取用戶輸入
? ? ? ? var insertPointResult = ed.GetPoint("\n請指定插入點: ");
? ? ? ? if (insertPointResult.Status != PromptStatus.OK) return;
? ? ? ? Point3d 插入點 = insertPointResult.Value;

? ? ? ? var elevationResult = ed.GetDouble("\n請輸入高程值: ");
? ? ? ? if (elevationResult.Status != PromptStatus.OK) return;
? ? ? ? double 高程值 = elevationResult.Value;

? ? ? ? double 半徑 = 10.0; // 可改為用戶輸入

? ? ? ? using (var tr = db.TransactionManager.StartTransaction()) // 使用單一事務
? ? ? ? {
? ? ? ? ? ? var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite);
? ? ? ? ? ? var ms = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);

? ? ? ? ? ? // 塊定義處理
? ? ? ? ? ? string 塊名 = "ElevationBlock";
? ? ? ? ? ? if (bt.Has(塊名))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? // 徹底清除舊塊定義及其參照
? ? ? ? ? ? ? ? var oldBtr = (BlockTableRecord)tr.GetObject(bt[塊名], OpenMode.ForWrite);
? ? ? ? ? ? ? ? oldBtr.PurgeAll(); // 清除所有關聯實體
? ? ? ? ? ? ? ? oldBtr.Erase(true);
? ? ? ? ? ? }

? ? ? ? ? ? var btr = new BlockTableRecord { Name = 塊名 };
? ? ? ? ? ? bt.Add(btr);
? ? ? ? ? ? tr.AddNewlyCreatedDBObject(btr, true);

? ? ? ? ? ? // 創建圖形
? ? ? ? ? ? Circle cir = new Circle(Point3d.Origin, Vector3d.ZAxis, 1);
? ? ? ? ? ? cir.ColorIndex = 1;
? ? ? ? ? ? btr.AppendEntity(cir);
? ? ? ? ? ? tr.AddNewlyCreatedDBObject(cir, true);

? ? ? ? ? ? // 創建屬性定義(動態計算位置)
? ? ? ? ? ? AttributeDefinition attDef = new AttributeDefinition
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Position = new Point3d(1.5 * 半徑, 0, 0), // 根據半徑調整初始位置
? ? ? ? ? ? ? ? Prompt = "高程值",
? ? ? ? ? ? ? ? Tag = "ELEVATION",
? ? ? ? ? ? ? ? TextString = 高程值.ToString("0.00"),
? ? ? ? ? ? ? ? Height = 0.2 * 半徑, // 文字高度與半徑關聯
? ? ? ? ? ? ? ? WidthFactor = 0.8,
? ? ? ? ? ? ? ? Justify = AttachmentPoint.MiddleLeft,
? ? ? ? ? ? ? ? ColorIndex = 1
? ? ? ? ? ? };
? ? ? ? ? ? btr.AppendEntity(attDef);
? ? ? ? ? ? tr.AddNewlyCreatedDBObject(attDef, true);

? ? ? ? ? ? // 創建塊參照
? ? ? ? ? ? BlockReference br = new BlockReference(插入點, btr.ObjectId);
? ? ? ? ? ? br.ScaleFactors = new Scale3d(半徑); // 縮放因子控制整體尺寸

? ? ? ? ? ? // 添加屬性引用
? ? ? ? ? ? br.AttributeCollection.AppendAttribute(
? ? ? ? ? ? ? ? new AttributeReference {
? ? ? ? ? ? ? ? ? ? TextString = 高程值.ToString("0.00"),
? ? ? ? ? ? ? ? ? ? Position = attDef.Position.TransformBy(br.BlockTransform) // 應用變換
? ? ? ? ? ? ? ? });

? ? ? ? ? ? ms.AppendEntity(br);
? ? ? ? ? ? tr.AddNewlyCreatedDBObject(br, true);

? ? ? ? ? ? tr.Commit();
? ? ? ? }
? ? }

? ? // 移除未使用的多段線方法(根據需求決定是否保留)
}

加入jig功能

public class Demo
{
? ? [CommandMethod("xx")]
? ? public void Demo1()
? ? {
? ? ? ? var doc = Application.DocumentManager.MdiActiveDocument;
? ? ? ? var db = doc.Database;
? ? ? ? var ed = doc.Editor;

? ? ? ? // 第一步:獲取高程值
? ? ? ? var elevationResult = ed.GetDouble("\n請輸入高程值: ");
? ? ? ? if (elevationResult.Status != PromptStatus.OK) return;
? ? ? ? double 高程值 = elevationResult.Value;

? ? ? ? // 第二步:創建塊定義
? ? ? ? string 塊名 = "ElevationBlock";
? ? ? ? ObjectId blockId;
? ? ? ? using (var tr = db.TransactionManager.StartTransaction())
? ? ? ? {
? ? ? ? ? ? var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
? ? ? ? ? ??
? ? ? ? ? ? // 如果塊不存在則創建
? ? ? ? ? ? if (!bt.Has(塊名))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? bt.UpgradeOpen();
? ? ? ? ? ? ? ? var btr = new BlockTableRecord { Name = 塊名 };

? ? ? ? ? ? ? ? // 創建圓形(基準尺寸為1單位)
? ? ? ? ? ? ? ? var cir = new Circle(Point3d.Origin, Vector3d.ZAxis, 1);
? ? ? ? ? ? ? ? cir.ColorIndex = 1;
? ? ? ? ? ? ? ? btr.AppendEntity(cir);
? ? ? ? ? ? ? ? tr.AddNewlyCreatedDBObject(cir, true);

? ? ? ? ? ? ? ? // 創建屬性定義
? ? ? ? ? ? ? ? var attDef = new AttributeDefinition
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Position = new Point3d(1.5, 0, 0), ?// 相對位置
? ? ? ? ? ? ? ? ? ? Tag = "ELEV",
? ? ? ? ? ? ? ? ? ? Prompt = "高程值",
? ? ? ? ? ? ? ? ? ? TextString = "0.00",
? ? ? ? ? ? ? ? ? ? Height = 0.2, ?// 基準文字高度
? ? ? ? ? ? ? ? ? ? ColorIndex = 1,
? ? ? ? ? ? ? ? ? ? Justify = AttachmentPoint.MiddleLeft
? ? ? ? ? ? ? ? };
? ? ? ? ? ? ? ? btr.AppendEntity(attDef);
? ? ? ? ? ? ? ? tr.AddNewlyCreatedDBObject(attDef, true);

? ? ? ? ? ? ? ? blockId = bt.Add(btr);
? ? ? ? ? ? ? ? tr.AddNewlyCreatedDBObject(btr, true);
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? blockId = bt[塊名];
? ? ? ? ? ? }
? ? ? ? ? ? tr.Commit();
? ? ? ? }

? ? ? ? // 第三步:使用Jig交互式插入
? ? ? ? using (var tr = db.TransactionManager.StartTransaction())
? ? ? ? {
? ? ? ? ? ? var ms = (BlockTableRecord)tr.GetObject(
? ? ? ? ? ? ? ? SymbolUtilityServices.GetBlockModelSpaceId(db),?
? ? ? ? ? ? ? ? OpenMode.ForWrite);

? ? ? ? ? ? // 創建臨時塊參照
? ? ? ? ? ? var br = new BlockReference(Point3d.Origin, blockId)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? ScaleFactors = new Scale3d(10) // 默認縮放因子
? ? ? ? ? ? };

? ? ? ? ? ? // 設置屬性值
? ? ? ? ? ? var attCol = br.AttributeCollection;
? ? ? ? ? ? foreach (ObjectId attDefId in br.BlockTableRecord.GetObject<BlockTableRecord>())
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (attDefId.ObjectClass.DxfName == "ATTDEF")
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? var attDef = tr.GetObject(attDefId, OpenMode.ForRead) as AttributeDefinition;
? ? ? ? ? ? ? ? ? ? var attRef = new AttributeReference();
? ? ? ? ? ? ? ? ? ? attRef.SetAttributeFromBlock(attDef, br.BlockTransform);
? ? ? ? ? ? ? ? ? ? attRef.TextString = 高程值.ToString("0.00");
? ? ? ? ? ? ? ? ? ? attCol.AppendAttribute(attRef);
? ? ? ? ? ? ? ? ? ? tr.AddNewlyCreatedDBObject(attRef, true);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }

? ? ? ? ? ? // 啟動拖動Jig
? ? ? ? ? ? var jig = new BlockJig(br, 高程值);
? ? ? ? ? ? var result = ed.Drag(jig);

? ? ? ? ? ? if (result.Status == PromptStatus.OK)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? ms.AppendEntity(br);
? ? ? ? ? ? ? ? tr.AddNewlyCreatedDBObject(br, true);
? ? ? ? ? ? ? ? tr.Commit();
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? tr.Abort();
? ? ? ? ? ? }
? ? ? ? }
? ? }

? ? // Jig實現類
? ? public class BlockJig : EntityJig
? ? {
? ? ? ? private double _elevation;
? ? ? ? private Point3d _insertPoint;

? ? ? ? public BlockJig(BlockReference br, double elevation) : base(br)
? ? ? ? {
? ? ? ? ? ? _elevation = elevation;
? ? ? ? ? ? _insertPoint = br.Position;
? ? ? ? }

? ? ? ? protected override SamplerStatus Sampler(JigPrompts prompts)
? ? ? ? {
? ? ? ? ? ? var opts = new JigPromptPointOptions("\n指定插入點: ");
? ? ? ? ? ? opts.UserInputControls = UserInputControls.NullResponseAccepted;
? ? ? ? ? ? var res = prompts.AcquirePoint(opts);

? ? ? ? ? ? if (res.Status == PromptStatus.OK)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (_insertPoint.DistanceTo(res.Value) < Tolerance.Global.EqualPoint)
? ? ? ? ? ? ? ? ? ? return SamplerStatus.NoChange;
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? _insertPoint = res.Value;
? ? ? ? ? ? ? ? return SamplerStatus.OK;
? ? ? ? ? ? }
? ? ? ? ? ? return SamplerStatus.Cancel;
? ? ? ? }

? ? ? ? protected override bool Update()
? ? ? ? {
? ? ? ? ? ? ((BlockReference)Entity).Position = _insertPoint;
? ? ? ? ? ??
? ? ? ? ? ? // 更新屬性位置
? ? ? ? ? ? var tr = Entity.Database.TransactionManager.TopTransaction;
? ? ? ? ? ? foreach (ObjectId attId in ((BlockReference)Entity).AttributeCollection)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? var attRef = tr.GetObject(attId, OpenMode.ForWrite) as AttributeReference;
? ? ? ? ? ? ? ? attRef.Position = attRef.Position.TransformBy(
? ? ? ? ? ? ? ? ? ? Matrix3d.Displacement(_insertPoint - Point3d.Origin));
? ? ? ? ? ? }
? ? ? ? ? ? return true;
? ? ? ? }
? ? }
}

封裝jig

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.GraphicsInterface;
using System.Collections.Generic;

public static class EntityJigger
{
? ? /// <summary>
? ? /// 交互式拖動插入多個實體
? ? /// </summary>
? ? /// <param name="entities">要插入的實體列表(建議使用未添加到數據庫的副本)</param>
? ? /// <param name="basePoint">實體組合的基準點</param>
? ? /// <returns>最終的插入點(如果取消返回null)</returns>
? ? public static Point3d? DragEntities(List<Entity> entities, Point3d basePoint)
? ? {
? ? ? ? var doc = Application.DocumentManager.MdiActiveDocument;
? ? ? ? var db = doc.Database;
? ? ? ? var ed = doc.Editor;

? ? ? ? using (var tr = db.TransactionManager.StartTransaction())
? ? ? ? {
? ? ? ? ? ? try
? ? ? ? ? ? {
? ? ? ? ? ? ? ? // 創建臨時實體副本
? ? ? ? ? ? ? ? var tempEntities = new List<Entity>();
? ? ? ? ? ? ? ? foreach (var ent in entities)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? var clone = ent.Clone() as Entity;
? ? ? ? ? ? ? ? ? ? clone.TransformBy(Matrix3d.Displacement(basePoint.GetVectorTo(Point3d.Origin)));
? ? ? ? ? ? ? ? ? ? tempEntities.Add(clone);
? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? // 創建Jig實例
? ? ? ? ? ? ? ? var jig = new MultiEntityJig(tempEntities, basePoint);
? ? ? ? ? ? ? ? var result = ed.Drag(jig);

? ? ? ? ? ? ? ? if (result.Status == PromptStatus.OK)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? // 正式添加實體到模型空間
? ? ? ? ? ? ? ? ? ? var ms = (BlockTableRecord)tr.GetObject(
? ? ? ? ? ? ? ? ? ? ? ? SymbolUtilityServices.GetBlockModelSpaceId(db),
? ? ? ? ? ? ? ? ? ? ? ? OpenMode.ForWrite);

? ? ? ? ? ? ? ? ? ? foreach (var ent in tempEntities)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? ms.AppendEntity(ent);
? ? ? ? ? ? ? ? ? ? ? ? tr.AddNewlyCreatedDBObject(ent, true);
? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? tr.Commit();
? ? ? ? ? ? ? ? ? ? return jig.InsertPoint;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? tr.Abort();
? ? ? ? ? ? ? ? return null;
? ? ? ? ? ? }
? ? ? ? ? ? catch
? ? ? ? ? ? {
? ? ? ? ? ? ? ? tr.Abort();
? ? ? ? ? ? ? ? throw;
? ? ? ? ? ? }
? ? ? ? }
? ? }

? ? /// <summary>
? ? /// 多實體拖動Jig實現
? ? /// </summary>
? ? private class MultiEntityJig : DrawJig
? ? {
? ? ? ? private readonly List<Entity> _entities;
? ? ? ? private Point3d _basePoint;
? ? ? ? private Point3d _insertPoint;

? ? ? ? public Point3d InsertPoint => _insertPoint;

? ? ? ? public MultiEntityJig(List<Entity> entities, Point3d basePoint)
? ? ? ? {
? ? ? ? ? ? _entities = entities;
? ? ? ? ? ? _basePoint = basePoint;
? ? ? ? ? ? _insertPoint = basePoint;
? ? ? ? }

? ? ? ? protected override SamplerStatus Sampler(JigPrompts prompts)
? ? ? ? {
? ? ? ? ? ? var opts = new JigPromptPointOptions("\n指定插入點: ")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? UserInputControls = UserInputControls.Accept3dCoordinates |
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? UserInputControls.NoZeroResponse |
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? UserInputControls.NoNegativeResponse
? ? ? ? ? ? };

? ? ? ? ? ? var result = prompts.AcquirePoint(opts);
? ? ? ? ? ? if (result.Value.DistanceTo(_insertPoint) < Tolerance.Global.EqualPoint)
? ? ? ? ? ? ? ? return SamplerStatus.NoChange;

? ? ? ? ? ? _insertPoint = result.Value;
? ? ? ? ? ? return SamplerStatus.OK;
? ? ? ? }

? ? ? ? protected override bool WorldDraw(WorldDraw draw)
? ? ? ? {
? ? ? ? ? ? // 計算位移矩陣
? ? ? ? ? ? var vector = _basePoint.GetVectorTo(_insertPoint);
? ? ? ? ? ? var matrix = Matrix3d.Displacement(vector);

? ? ? ? ? ? // 繪制所有臨時實體
? ? ? ? ? ? foreach (var ent in _entities)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? draw.Geometry.Draw(ent);
? ? ? ? ? ? ? ? ent.TransformBy(matrix);
? ? ? ? ? ? }
? ? ? ? ? ? return true;
? ? ? ? }
? ? }
}

?

[CommandMethod("testJig")]

public void TestJigCommand()

{

? ? var doc = Application.DocumentManager.MdiActiveDocument;

? ? var db = doc.Database;

? ? var ed = doc.Editor;

?

? ? // 創建要插入的實體集合

? ? var entities = new List<Entity>();

? ??

? ? // 創建圓形(基準位置在原點)

? ? var circle = new Circle(Point3d.Origin, Vector3d.ZAxis, 5);

? ? circle.ColorIndex = 1;

? ? entities.Add(circle);

?

? ? // 創建單行文字

? ? var text = new DBText

? ? {

? ? ? ? Position = new Point3d(8, 0, 0),

? ? ? ? TextString = "高程值",

? ? ? ? Height = 2,

? ? ? ? ColorIndex = 2,

? ? ? ? Justify = AttachmentPoint.MiddleLeft

? ? };

? ? entities.Add(text);

?

? ? // 設置基準點(通常取組合的中心點)

? ? var basePoint = new Point3d(0, 0, 0);

?

? ? // 調用Jig進行拖動插入

? ? var resultPoint = EntityJigger.DragEntities(entities, basePoint);

?

? ? if (resultPoint.HasValue)

? ? {

? ? ? ? ed.WriteMessage($"\n插入點坐標:{resultPoint.Value}");

? ? }

}

?

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/76129.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/76129.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/76129.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

pod幾種常用狀態

在 Kubernetes 中&#xff0c;Pod 是最小的可部署單元&#xff0c;Pod 的狀態反映了其當前的運行狀況。以下是幾種常見的 Pod 狀態&#xff1a; 1. Pending 描述: Pod 已被 Kubernetes API Server 接收并創建&#xff0c;但還沒有開始運行在任何節點上。原因: Pod 資源不足&a…

04 單目標定實戰示例

看文本文,您將獲得以下技能: 1:使用opencv進行相機單目標定實戰 2:標定結果參數含義和數值分析 3:Python繪制各標定板姿態,查看圖像采集多樣性 4:如果相機畫幅旋轉90,標定輸入參數該如何設置? 5:圖像尺寸縮放,標定結果輸出有何影響? 6:單目標定結果應用類別…

DevEco Studio編輯器的使用-代碼code Linter檢查

Code Linter代碼檢查 Code Linter針對ArkTS/TS代碼進行最佳實踐/編程規范方面的檢查。檢查規則支持配置&#xff0c;配置方式請參考配置代碼檢查規則。 開發者可根據掃描結果中告警提示手工修復代碼缺陷&#xff0c;或者執行一鍵式自動修復&#xff0c;在代碼開發階段&#x…

wokwi arduino mega 2560 - 模數與數模轉換AD和DA

截圖&#xff1a; 20.53 黃燈滅 不報警 205.77 黃燈亮 報警 鏈接&#xff1a; https://wokwi.com/projects/415345595312267265 代碼&#xff1a; 詳細注釋版&#xff1a;AD和I2C仿真實驗案例程序 cpp #include <LiquidCrystal_I2C.h>// 定義I2C地址和LCD的行列數 #de…

如何使不同的窗體控件,適應不同分辨率的屏幕?

問題 當屏幕分辨率提高或降低時&#xff0c;原分辨率顯示正常的控件&#xff0c;將變得很小或很大&#xff0c;字體也變得太大或太小。 解決辦法 當分辨率變化時&#xff0c;采用遞歸的方法&#xff0c;對所有的控件放大或縮小。 public static void MainForm_Load(object s…

虛擬機(一):Java 篇

虛擬機&#xff08;一&#xff09;&#xff1a;Java 篇 虛擬機&#xff08;二&#xff09;&#xff1a;Android 篇 架構 運行時數據區&#xff1a; 棧&#xff1a; 堆&#xff1a; 堆&#xff1a;通過new創建的對象都在堆中分配。OutOfMemoryError TLAB(Thread Local All…

硬件基礎--14_電功率

電功率 電功率:指電流在單位時間內做的功(表示用電器消耗電能快慢的一個物理量)。 單位:瓦特(W)&#xff0c;簡稱瓦。 公式:PUI(U為電壓&#xff0c;單位為V&#xff0c;i為電流&#xff0c;單位為A&#xff0c;P為電功率&#xff0c;單位為W)。 單位換算:進位為1000&#xff…

更高的效率——MyBatis-plus

一、什么是MyBatis-plus&#xff1f; MyBatis-plus是MyBatis的增強工具&#xff0c;在MyBatis基礎上只做增強不做改變&#xff0c;可以簡化基礎的CRUD操作&#xff08;通過繼承 BaseMapper 接口可直接使用預定義的增刪改查方法&#xff09; 二、MyBatis-plus快速入門 2.1 準備…

【算法基礎】遞歸與遞推

目錄 遞歸實現指數型枚舉 題目 算法解析 遞歸實現排列型枚舉 題目 算法解析 費解的開關 題目 算法解析 遞歸實現組合型枚舉 題目 算法解析 帶分數 題目 算法解析 飛行員兄弟 題目 算法解析 翻硬幣 題目 算法解析 遞歸實現指數型枚舉 題目 算法…

Java 大視界 -- Java 大數據在智慧礦山設備故障預測與預防性維護中的技術實現(163)

&#x1f496;親愛的朋友們&#xff0c;熱烈歡迎來到 青云交的博客&#xff01;能與諸位在此相逢&#xff0c;我倍感榮幸。在這飛速更迭的時代&#xff0c;我們都渴望一方心靈凈土&#xff0c;而 我的博客 正是這樣溫暖的所在。這里為你呈上趣味與實用兼具的知識&#xff0c;也…

綜合實驗一

實驗拓撲圖&#xff1a; 實驗要求&#xff1a; 1,內網IP地址使用172.16.0.0/16分配 2,SW1和SW2之間互為備份 3,VRRP/STP/VLAN/Eth-trunk均使用 4,所有PC均通過DHCP獲取IP地址 5,ISP只能配置IP地址 6,所有電腦可以正常訪問ISP路由器環回 實驗步驟&#xff1a; 步驟1&…

snort檢測端口掃描工具

前面兩篇文章介紹了snort3相關知識和Ubuntu上的安裝配置Ubuntu22.04上Snort3的安裝與基本配置 -CSDN博客 和Snort規則定義并進行的簡單的測試Snort規則定義與測試 -CSDN博客&#xff0c;接下來我將介紹如何編寫一個簡單的檢測端口掃描的規則進行檢測 一、實驗環境 攻擊機&…

【行測】資料分析

> 作者&#xff1a;?舊言~ > 座右銘&#xff1a;讀不在三更五鼓&#xff0c;功只怕一曝十寒。 > 目標&#xff1a;掌握 資料分析 基本題型&#xff0c;并能運用到例題中。 > 毒雞湯&#xff1a;有些事情&#xff0c;總是不明白&#xff0c;所以我不會堅持。早安! …

工地揚塵監測儀:守護藍天白云的重要工具

在城市化進程加速推進的背景下&#xff0c;建筑工地數量呈現持續增長態勢&#xff0c;揚塵污染問題亦愈發顯著。揚塵不僅對空氣質量造成負面影響&#xff0c;更對周邊居民的健康狀況及生活質量構成威脅。在此情形下&#xff0c;工地揚塵監測儀作為建筑工地環境管理中不可或缺的…

Windows10 下QT社區版的安裝記錄

0. 介紹 踩了一些坑&#xff0c;記錄一下&#xff0c;主要是鏡像源的問題。 1. 安裝 首先你先要在qt官網上有一個自己的賬號。 然后點右上角的下載 打開后&#xff0c;我們需要選擇社區版本&#xff1b;如果選擇直接下載的話&#xff0c;出來的就是商業版本。 點開后&…

自定義一個C語言字符串取整函數

一、字符串取整的主要思路 1、遍歷每個字符&#xff1b; 2、獲得0到9的字符對應的整數值&#xff1b; 3、把對應位置的十進制權重相乘&#xff1b; 4、把所有的相乘結果相加&#xff1b; 5、返回相加結果&#xff1b; 二、主要代碼 // 主要是把十進制的整數字符轉成十進制變量值…

VS Code C/C++項目設置launch.json中的environment參數解決支持庫路徑問題

問題描述 Windows 11 VS Code C/C 開發環境搭建分別寫了c和cpp兩個示例代碼&#xff0c;在運行過程中c代碼沒有發現問題&#xff08;可能簡單&#xff0c;沒有用到太多支持&#xff09;&#xff0c;但使用了stl的cpp代碼并沒有運行出來&#xff0c;如下圖&#xff1a; 出問題…

C語言pthread庫的互斥鎖使用案例

一、函數約定 1、初始化鎖 int pthread_mutex_init(pthread_mutex_t* m, const pthread_mutexattr_t* attr) 2、加鎖 int pthread_mutex_lock(pthread_mutex_t* m); 3、解鎖 int pthread_mutex_unlock(pthread_mutex_t* m); 4、銷毀 int pthread_mutex_de…

隨機2級域名引導頁HTML源碼

源碼介紹 隨機2級域名引導頁HTML源碼,每次點進去都隨機一個域名前綴。 修改跳轉域名在 350 行代碼&#xff0c;源碼由HTMLCSSJS組成&#xff0c;記事本打開源碼文件可以進行內容文字之類的修改&#xff0c;雙擊html文件可以本地運行 效果預覽 源碼免費獲取 隨機2級域名引導頁…

NQA 網絡質量分析協議

協議信息 網絡質量分析協議&#xff0c;支持 icmp 等協議測試 配置實現 華為 創建 ICMP 測試實例 NQA 與靜態路由聯動 ?ip route-static 10.1.1.0 24 10.1.2.1 track nqa admin test1??