日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

autoCAD编辑图案填充

發布時間:2023/12/14 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 autoCAD编辑图案填充 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

用戶可以編輯圖案填充邊界和填充圖案。如果編輯關聯圖案填充的邊界,只要編輯的結果是有效的邊界,圖案就會被更新。即使關聯圖案填充位于已關閉的圖層上,仍將對其進行更新。用戶可以修改填充圖案或為現有的圖案填充選擇新的圖案,但是只能在創建圖案填充時設置關聯性。可以使用 Associative 特性查看 Hatch 對象是否具有關聯性。

必須使用 EvaluateHatch 方法重新計算圖案填充才能看到任何圖案填充的編輯效果。

編輯填充邊界

可以向圖案填充邊界附加、插入或移除環。關聯圖案填充隨其邊界的改變而更新,非關聯圖案填充則不會更新。

若要編輯圖案填充邊界,請使用下列方法之一:

  • AppendLoop
  • 將一個環追加到圖案填充。用戶使用 AppendLoop 方法的第一個參數和 HatchLoopTypes 枚舉常量定義所追加環的類型。
  • GetLoopAt
  • 獲得圖案填充指定索引處的環。
  • InsertLoopAt
  • 插入一個環到圖案直譯的指定索引處。
  • RemoveLoopAt
  • 從圖案填充指定索引處刪除一個環。

若要查詢填充邊界,請使用下列方法之一:

  • LoopTypeAt
  • 獲得圖案填充指定索引處的環的類型。
  • NumberOfLoops
  • 返回圖案填充的環的數量。

將內部環附加到圖案填充

本例創建一個關聯的圖案填充,然后創建一個圓并將該圓作為內部環附加到圖案填充。

Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry<CommandMethod("EditHatchAppendLoop")> _ Public Sub EditHatchAppendLoop()'' 獲得當前文檔和數據庫 Get the current document and databaseDim acDoc As Document = Application.DocumentManager.MdiActiveDocumentDim acCurDb As Database = acDoc.Database''啟動一個事務 Start a transactionUsing acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()'' 以只讀方式打開塊表 Open the Block table for readDim acBlkTbl As BlockTableacBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _OpenMode.ForRead)'' 以寫方式打開模型空間塊表記錄 Open the Block table record Model space for writeDim acBlkTblRec As BlockTableRecordacBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _OpenMode.ForWrite)''創建一個圓弧對象作為圖案填充的閉合邊界 Create an arc object for the closed boundary to hatchDim acArc As Arc = New Arc(New Point3d(5, 3, 0), 3, 0, 3.141592)acArc.SetDatabaseDefaults()acBlkTblRec.AppendEntity(acArc)acTrans.AddNewlyCreatedDBObject(acArc, True)''創建一個直線對象作為圖案填充的閉合邊界 Create an line object for the closed boundary to hatchDim acLine As Line = New Line(acArc.StartPoint, acArc.EndPoint)acLine.SetDatabaseDefaults()acBlkTblRec.AppendEntity(acLine)acTrans.AddNewlyCreatedDBObject(acLine, True)''添加圓弧和直線到一個對象編號集合中 Adds the arc and line to an object id collectionDim acObjIdColl As ObjectIdCollection = New ObjectIdCollection()acObjIdColl.Add(acArc.ObjectId)acObjIdColl.Add(acLine.ObjectId)'' 創建圖案填充對象并添加到塊表記錄中 Create the hatch object and append it to the block table recordDim acHatch As Hatch = New Hatch()acBlkTblRec.AppendEntity(acHatch)acTrans.AddNewlyCreatedDBObject(acHatch, True)'' 設置圖案填充對象的屬性 Set the properties of the hatch object'' 關聯性必須在 Hatch 對象追加到塊表記錄中后,AppendLoop 方法使用之前設置'' Associative must be set after the hatch object is appended to the '' block table record and before AppendLoopacHatch.SetDatabaseDefaults()acHatch.SetHatchPattern(HatchPatternType.PreDefined, "ANSI31")acHatch.Associative = TrueacHatch.AppendLoop(HatchLoopTypes.Outermost, acObjIdColl)'' 創建一個圓對象作為填充的內部邊界 Create a circle object for the inner boundary of the hatchDim acCirc As Circle = New Circle()acCirc.SetDatabaseDefaults()acCirc.Center = New Point3d(5, 4.5, 0)acCirc.Radius = 1acBlkTblRec.AppendEntity(acCirc)acTrans.AddNewlyCreatedDBObject(acCirc, True)'' 添加圓到對象編號集合中去 Adds the circle to an object id collectionacObjIdColl.Clear()acObjIdColl.Add(acCirc.ObjectId)'' 追加圓作為填充的內部環并計算它 Append the circle as the inner loop of the hatch and evaluate itacHatch.AppendLoop(HatchLoopTypes.Default, acObjIdColl)acHatch.EvaluateHatch(True)'' 保存新對象到數據庫中 Save the new object to the databaseacTrans.Commit()End Using End Sub

編輯填充圖案

用戶可以修改現有填充圖案的角度或間距,也可以將其替換為實體填充、斜線填充圖案或 AutoCAD 提供的預定義圖案。“邊界圖案填充”對話框中的“圖案”選項顯示了這些圖案的列表。為了縮小文件的大小,圖案填充在圖形中被定義為單一的圖形對象。

使用以下特性和方法來編輯填充圖案:

  • GardientAngle
  • 指定填充圖案的角度。
  • GardientName
  • 指定填充傾斜的名稱。
  • GardientShift
  • 指定填充傾斜間距
  • GardientType
  • 返回填充的傾斜類型
  • PatternAngle
  • 指定填充圖案的角度
  • PatternDouble
  • 指定用戶定義的圖案填充是否雙向填充。
  • PatternName
  • 返回填充的填充圖案的名稱(使用 SetHatchPattern 方法使用填充圖案的名稱和圖案的類型)。
  • PatternScale
  • 指定填充圖案的縮放比例
  • PatternSpace
  • 指定用戶定義的填充圖案間距。
  • PatternType
  • 返回填充的填充圖案類型。(使用 SetHatchPattern 方法設置填充的填充圖案名稱和類型。)
  • SetGradient
  • 設置圖案的傾斜類型和名稱。
  • SetHatchPattern
  • 設置填充的圖案類型和名稱。

修改填充的圖案間距

Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry<CommandMethod("EditHatchPatternScale")> _ Public Sub EditHatchPatternScale()'' 獲得當前文檔和數據庫 Get the current document and databaseDim acDoc As Document = Application.DocumentManager.MdiActiveDocumentDim acCurDb As Database = acDoc.Database''啟動一個事務 Start a transactionUsing acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()'' 以只讀方式打開塊表 Open the Block table for readDim acBlkTbl As BlockTableacBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _OpenMode.ForRead)'' 以寫方式打開模型空間塊表記錄 Open the Block table record Model space for writeDim acBlkTblRec As BlockTableRecordacBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _OpenMode.ForWrite)'' 創建一個作為填充的邊界的圓對象 Create a circle object for the boundary of the hatchDim acCirc As Circle = New Circle()acCirc.SetDatabaseDefaults()acCirc.Center = New Point3d(5, 3, 0)acCirc.Radius = 3acBlkTblRec.AppendEntity(acCirc)acTrans.AddNewlyCreatedDBObject(acCirc, True)'' 添加圓弧和直線到對象編號集合中去 Adds the arc and line to an object id collectionDim acObjIdColl As ObjectIdCollection = New ObjectIdCollection()acObjIdColl.Add(acCirc.ObjectId)'' 創建圖案填充對象并添加到塊表記錄中 Create the hatch object and append it to the block table recordDim acHatch As Hatch = New Hatch()acBlkTblRec.AppendEntity(acHatch)acTrans.AddNewlyCreatedDBObject(acHatch, True)'' 設置Hatch 對象的屬性 Set the properties of the hatch object'' Associative must be set after the hatch object is appended to the '' block table record and before AppendLoopacHatch.SetDatabaseDefaults()acHatch.SetHatchPattern(HatchPatternType.PreDefined, "ANSI31")acHatch.Associative = TrueacHatch.AppendLoop(HatchLoopTypes.Outermost, acObjIdColl)''計算填充 Evaluate the hatchacHatch.EvaluateHatch(True)''圖案比例增加2 并重算圖案 Increase the pattern scale by 2 and re-evaluate the hatchacHatch.PatternScale = acHatch.PatternScale + 2acHatch.SetHatchPattern(acHatch.PatternType, acHatch.PatternName)acHatch.EvaluateHatch(True)'' 保存新對象到數據庫中 Save the new object to the databaseacTrans.Commit()End Using End Sub

總結

以上是生活随笔為你收集整理的autoCAD编辑图案填充的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。