[原创]发布一个ObjectARX .NET AutoCAD 二次开发 添加各种实体的类
<IMG id=Code_Open_Image style="DISPLAY: inline" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" height=16 src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width=11 align=top><BR><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports Autodesk.AutoCAD.ApplicationServices<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports Autodesk.AutoCAD.DatabaseServices<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports Autodesk.AutoCAD.Runtime<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports Autodesk.AutoCAD.Geometry<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports Autodesk.AutoCAD.EditorInput<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports Autodesk.AutoCAD.Colors<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>Imports DBTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/None.gif" align=top>REM Line, Circle, Arc, Ellipse, Polyline, DBText, MText, Table, Hatch and the Dimensions<BR><IMG id=Codehighlighter1_393_16470_Open_Image onclick="this.style.display='none'; Codehighlighter1_393_16470_Open_Text.style.display='none'; Codehighlighter1_393_16470_Closed_Image.style.display='inline'; Codehighlighter1_393_16470_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_393_16470_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_393_16470_Closed_Text.style.display='none'; Codehighlighter1_393_16470_Open_Image.style.display='inline'; Codehighlighter1_393_16470_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>Public Class PublicClassClass PublicClass<BR><IMG id=Codehighlighter1_415_572_Open_Image onclick="this.style.display='none'; Codehighlighter1_415_572_Open_Text.style.display='none'; Codehighlighter1_415_572_Closed_Image.style.display='inline'; Codehighlighter1_415_572_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_415_572_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_415_572_Closed_Text.style.display='none'; Codehighlighter1_415_572_Open_Image.style.display='inline'; Codehighlighter1_415_572_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Enum PPColorEnum PPColor<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Red = 1<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Yellow = 2<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Green = 3<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> cyan = 4 '青色<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Blue = 5<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Fuchsin = 6 '品红<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> White = 7<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Enum<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM <summary><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''函数注释<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''</summary> <BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''<typeparam name="msg">变量参数的注释说明</typeparam><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''<remarks><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''自己的注释说明<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''</remarks><BR><IMG id=Codehighlighter1_737_873_Open_Image onclick="this.style.display='none'; Codehighlighter1_737_873_Open_Text.style.display='none'; Codehighlighter1_737_873_Closed_Image.style.display='inline'; Codehighlighter1_737_873_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_737_873_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_737_873_Closed_Text.style.display='none'; Codehighlighter1_737_873_Open_Image.style.display='inline'; Codehighlighter1_737_873_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Sub ShowMessage()Sub ShowMessage(ByVal msg As String)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(Chr(10) + msg)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Sub<BR><IMG id=Codehighlighter1_886_1088_Open_Image onclick="this.style.display='none'; Codehighlighter1_886_1088_Open_Text.style.display='none'; Codehighlighter1_886_1088_Closed_Image.style.display='inline'; Codehighlighter1_886_1088_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_886_1088_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_886_1088_Closed_Text.style.display='none'; Codehighlighter1_886_1088_Open_Image.style.display='inline'; Codehighlighter1_886_1088_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Sub SendCommand()Sub SendCommand(ByVal cmd As String)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim dotnetDoc As Document = Application.DocumentManager.MdiActiveDocument<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> dotnetDoc.SendStringToExecute(cmd + Chr(13), True, False, False)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Sub<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_1103_1422_Open_Image onclick="this.style.display='none'; Codehighlighter1_1103_1422_Open_Text.style.display='none'; Codehighlighter1_1103_1422_Closed_Image.style.display='inline'; Codehighlighter1_1103_1422_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1103_1422_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1103_1422_Closed_Text.style.display='none'; Codehighlighter1_1103_1422_Open_Image.style.display='inline'; Codehighlighter1_1103_1422_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function GetPointAR()Function GetPointAR(ByVal pt1 As Point3d, ByVal angle As Double, ByVal length As Double) As Point3d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM angle(计算sin cos 时 是以弧度计量的角度)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> angle = angle * Math.PI / 180<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim pt2 As New Point3d(pt1.X + length * Math.Cos(angle), pt1.Y + length * Math.Sin(angle), pt1.Z)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return pt2<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' Public Sub ShowMessage(ByVal msg As String, ByVal ex As Autodesk.AutoCAD.Runtime.Exception)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ShowMessage(Chr(10) + msg + "错误信息如下:" + Chr(10) + ex.Message)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' End Sub<BR><IMG id=Codehighlighter1_1622_2377_Open_Image onclick="this.style.display='none'; Codehighlighter1_1622_2377_Open_Text.style.display='none'; Codehighlighter1_1622_2377_Closed_Image.style.display='inline'; Codehighlighter1_1622_2377_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1622_2377_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1622_2377_Closed_Text.style.display='none'; Codehighlighter1_1622_2377_Open_Image.style.display='inline'; Codehighlighter1_1622_2377_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddEntity()Function AddEntity(ByVal ent As Entity) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim tm As DBTransMan = db.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ta As Transaction = tm.StartTransaction<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Try<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim bt As BlockTable = ta.GetObject(db.BlockTableId, OpenMode.ForWrite, False)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim btr As BlockTableRecord = ta.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim objId As ObjectId = btr.AppendEntity(ent)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.AddNewlyCreatedDBObject(ent, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Commit()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return objId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Catch ex As Exception<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ShowMessage("AddEntity出错了:" + ex.Message)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End Try<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_2390_3593_Open_Image onclick="this.style.display='none'; Codehighlighter1_2390_3593_Open_Text.style.display='none'; Codehighlighter1_2390_3593_Closed_Image.style.display='inline'; Codehighlighter1_2390_3593_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2390_3593_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2390_3593_Closed_Text.style.display='none'; Codehighlighter1_2390_3593_Open_Image.style.display='inline'; Codehighlighter1_2390_3593_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddLayer()Function AddLayer(ByVal LayerName As String, ByVal newColor As PPColor, ByVal LineWeithS As LineWeight, ByVal LineTypeName As String, Optional ByVal Description As String = "没有描述")<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim objId As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim tm As DBTransMan = db.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ta As Transaction = tm.StartTransaction<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim lt As LayerTable = tm.GetObject(db.LayerTableId, OpenMode.ForWrite)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> If lt.Has(LayerName) Then<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = lt.Item(LayerName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Else<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ltr As New LayerTableRecord<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ltr.Name = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ColorType As Type = GetType(PPColor)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim color1 As Color<BR><IMG id=Codehighlighter1_3180_3593_Open_Image onclick="this.style.display='none'; Codehighlighter1_3180_3593_Open_Text.style.display='none'; Codehighlighter1_3180_3593_Closed_Image.style.display='inline'; Codehighlighter1_3180_3593_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_3180_3593_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_3180_3593_Closed_Text.style.display='none'; Codehighlighter1_3180_3593_Open_Image.style.display='inline'; Codehighlighter1_3180_3593_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> color1 = Color.FromColorIndex(ColorMethod.ByAci, Enum].Parse(ColorType, newColor.ToString))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ltr.Color = color1<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ltr.LineWeight = LineWeithS<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ltr.LinetypeObjectId = LineType(LineTypeName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ltr.Description = Description<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = lt.Add(ltr)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.AddNewlyCreatedDBObject(ltr, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Commit()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End If<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return objId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_3606_4014_Open_Image onclick="this.style.display='none'; Codehighlighter1_3606_4014_Open_Text.style.display='none'; Codehighlighter1_3606_4014_Closed_Image.style.display='inline'; Codehighlighter1_3606_4014_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_3606_4014_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_3606_4014_Closed_Text.style.display='none'; Codehighlighter1_3606_4014_Open_Image.style.display='inline'; Codehighlighter1_3606_4014_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddArc()Function AddArc(ByVal centerPoint As Point3d, ByVal normal As Vector3d, ByVal radius As Double, ByVal startAngle As Double, ByVal endAngle As Double, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 此处不用设置线型,颜色等,因为这些已经在图层里设置好了<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim a As New Arc(centerPoint, normal, radius, startAngle, endAngle)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> a.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM a.Clone() REM 复制实体<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(a)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_4027_4255_Open_Image onclick="this.style.display='none'; Codehighlighter1_4027_4255_Open_Text.style.display='none'; Codehighlighter1_4027_4255_Closed_Image.style.display='inline'; Codehighlighter1_4027_4255_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_4027_4255_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_4027_4255_Closed_Text.style.display='none'; Codehighlighter1_4027_4255_Open_Image.style.display='inline'; Codehighlighter1_4027_4255_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddLine()Function AddLine(ByVal startPt As Point3d, ByVal endpt As Point3d, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim line As New Line(startPt, endpt)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> line.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(line)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_4268_4548_Open_Image onclick="this.style.display='none'; Codehighlighter1_4268_4548_Open_Text.style.display='none'; Codehighlighter1_4268_4548_Closed_Image.style.display='inline'; Codehighlighter1_4268_4548_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_4268_4548_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_4268_4548_Closed_Text.style.display='none'; Codehighlighter1_4268_4548_Open_Image.style.display='inline'; Codehighlighter1_4268_4548_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddLine()Function AddLine(ByVal startPt As Point3d, ByVal angle As Double, ByVal length As Double, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim line As New Line(startPt, GetPointAR(startPt, angle, length))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> line.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(line)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_4561_4963_Open_Image onclick="this.style.display='none'; Codehighlighter1_4561_4963_Open_Text.style.display='none'; Codehighlighter1_4561_4963_Closed_Image.style.display='inline'; Codehighlighter1_4561_4963_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_4561_4963_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_4561_4963_Closed_Text.style.display='none'; Codehighlighter1_4561_4963_Open_Image.style.display='inline'; Codehighlighter1_4561_4963_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddMLine()Function AddMLine(ByVal scale As Double, ByVal newVertex As Point3d, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 多样线<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ml As New Mline<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ms As New MlineStyle<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ms.Name = "standard"<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ml.Style = ms.ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ml.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ml.Scale = scale<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ml.AppendSegment(newVertex)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ml.AppendSegment(New Point3d(20, 20, 0))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_4976_5367_Open_Image onclick="this.style.display='none'; Codehighlighter1_4976_5367_Open_Text.style.display='none'; Codehighlighter1_4976_5367_Closed_Image.style.display='inline'; Codehighlighter1_4976_5367_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_4976_5367_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_4976_5367_Closed_Text.style.display='none'; Codehighlighter1_4976_5367_Open_Image.style.display='inline'; Codehighlighter1_4976_5367_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddTrace()Function AddTrace(ByVal pointer1 As Point3d, ByVal pointer2 As Point3d, ByVal pinter3 As Point3d, ByVal pointer4 As Point3d, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 有问题吧<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim myTrace As New Trace(pointer1, pointer2, pinter3, pointer4)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> myTrace.LineWeight = LineWeight.LineWeight200<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> myTrace.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(myTrace)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_5380_5694_Open_Image onclick="this.style.display='none'; Codehighlighter1_5380_5694_Open_Text.style.display='none'; Codehighlighter1_5380_5694_Closed_Image.style.display='inline'; Codehighlighter1_5380_5694_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_5380_5694_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_5380_5694_Closed_Text.style.display='none'; Codehighlighter1_5380_5694_Open_Image.style.display='inline'; Codehighlighter1_5380_5694_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddShape()Function AddShape(ByVal position As Point3d, ByVal size As Double, ByVal shapeName As String, ByVal rotation As Double, ByVal widthFactor As Double) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM shapeName ??? 有问题吧<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim sh As New Shape(position, size, shapeName, rotation, widthFactor)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(sh)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_5709_6100_Open_Image onclick="this.style.display='none'; Codehighlighter1_5709_6100_Open_Text.style.display='none'; Codehighlighter1_5709_6100_Closed_Image.style.display='inline'; Codehighlighter1_5709_6100_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_5709_6100_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_5709_6100_Closed_Text.style.display='none'; Codehighlighter1_5709_6100_Open_Image.style.display='inline'; Codehighlighter1_5709_6100_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddPolygon()Function AddPolygon(ByVal upperLeft As Point3d, ByVal upperRight As Point3d, ByVal lowerLeft As Point3d, ByVal lowerRight As Point3d) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim rect As New Rectangle3d(upperLeft, upperRight, lowerLeft, lowerRight)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim rect3d As Entity3d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' Dim m As New Plane(New Point3d(100, 100, 0), New Point3d(100, 200, 0), New Point3d(100, 200, 100))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''<summary><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''获取或设置外部处理过程的委托<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''</summary><BR><IMG id=Codehighlighter1_6170_6410_Open_Image onclick="this.style.display='none'; Codehighlighter1_6170_6410_Open_Text.style.display='none'; Codehighlighter1_6170_6410_Closed_Image.style.display='inline'; Codehighlighter1_6170_6410_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_6170_6410_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_6170_6410_Closed_Text.style.display='none'; Codehighlighter1_6170_6410_Open_Image.style.display='inline'; Codehighlighter1_6170_6410_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddCircle()Function AddCircle(ByVal center As Point3d, ByVal radius As Double) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim myCircle = New Circle(center, Vector3d.ZAxis, radius)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim circleId As ObjectId = AddEntity(myCircle)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return circleId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''<remarks><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''自己的注释说明<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''</remarks><BR><IMG id=Codehighlighter1_6473_6979_Open_Image onclick="this.style.display='none'; Codehighlighter1_6473_6979_Open_Text.style.display='none'; Codehighlighter1_6473_6979_Closed_Image.style.display='inline'; Codehighlighter1_6473_6979_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_6473_6979_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_6473_6979_Closed_Text.style.display='none'; Codehighlighter1_6473_6979_Open_Image.style.display='inline'; Codehighlighter1_6473_6979_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddEllipse()Function AddEllipse(ByVal centerPoint As Point3d, ByVal majorAxis As Vector3d, ByVal radiusRatio As Double, ByVal startAngle As Double, ByVal endAngle As Double)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 画完整椭圆时,开始角度= 终止角度,调整角度,就可以调整方向<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 可能存在问题<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' Ellipse(Ellipse = New Ellipse(center, Vector3d.ZAxis, New Vector3d(3, 0, 0), 0.5, 0, 0))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim unitNormal = Vector3d.ZAxis<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim e As New Ellipse(centerPoint, unitNormal, majorAxis, radiusRatio, startAngle, endAngle)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(e)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''<typeparam name="text">变量参数的注释说明</typeparam><BR><IMG id=Codehighlighter1_7044_7657_Open_Image onclick="this.style.display='none'; Codehighlighter1_7044_7657_Open_Text.style.display='none'; Codehighlighter1_7044_7657_Closed_Image.style.display='inline'; Codehighlighter1_7044_7657_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_7044_7657_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_7044_7657_Closed_Text.style.display='none'; Codehighlighter1_7044_7657_Open_Image.style.display='inline'; Codehighlighter1_7044_7657_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddDBText()Function AddDBText(ByVal text As String, ByVal Position As Point3d, ByVal LayerName As String)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> '''<typeparam name="msg">变量参数的注释说明</typeparam><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim mytext As New DBText<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.TextString = text REM TextString Contents<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.Position = Position REM location position<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.VerticalMode = TextVerticalMode.TextVerticalMid '垂直对齐方式<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.HorizontalMode = TextHorizontalMode.TextCenter '水平对齐方式<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' mytext.AlignmentPoint = Position '文本的坐标 mytext.Position = Position 重复 ???矛盾<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(mytext)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_7670_7943_Open_Image onclick="this.style.display='none'; Codehighlighter1_7670_7943_Open_Text.style.display='none'; Codehighlighter1_7670_7943_Closed_Image.style.display='inline'; Codehighlighter1_7670_7943_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_7670_7943_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_7670_7943_Closed_Text.style.display='none'; Codehighlighter1_7670_7943_Open_Image.style.display='inline'; Codehighlighter1_7670_7943_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddMText()Function AddMText(ByVal text As String, ByVal Position As Point3d, ByVal LayerName As String)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim mytext As New MText<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.Contents = text<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.Location = Position<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytext.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(mytext)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_7956_9671_Open_Image onclick="this.style.display='none'; Codehighlighter1_7956_9671_Open_Text.style.display='none'; Codehighlighter1_7956_9671_Closed_Image.style.display='inline'; Codehighlighter1_7956_9671_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_7956_9671_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_7956_9671_Closed_Text.style.display='none'; Codehighlighter1_7956_9671_Open_Image.style.display='inline'; Codehighlighter1_7956_9671_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddHatch()Function AddHatch(ByVal PointArray() As Point3d, ByVal HatchStyleType As HatchStyle, ByVal PatternScale As Double, ByVal PatternAngle As Double, ByVal LayerName As String, Optional ByVal PatternName As String = "ANSI31") As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 多点填充<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 圆,圆弧的填充呢??<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim hl As New HatchLoop REM 少了new 时:未将对象设置引用到实例<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim P3d As Point3d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim p As Point2d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim bv As BulgeVertex<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> For Each P3d In PointArray<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Try<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> p = New Point2d(P3d.X, P3d.Y)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> bv = New BulgeVertex(p, 0)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM ShowMessage("bv.Bulge= " + bv.Bulge.ToString)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM ShowMessage(" bv.Vertex.ToString" + bv.Vertex.ToString)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> hl.Add(bv)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' hl.LoopType = HatchLoopTypes.Default REM 改怎么选<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Catch ex As Exception<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ShowMessage("错" + ex.Message)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End Try<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Next<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ha As New Hatch REM 还有很多属性可以设置<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.HatchStyle = HatchStyleType<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.HatchStyle = HatchStyle.Normal REM 三种<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.PatternAngle = PatternAngle REM 填充图案角度 0 90,270<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.PatternScale = PatternScale<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.HatchObjectType = HatchObjectType.HatchObject REM 2种<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.SetHatchPattern(HatchPatternType.PreDefined, PatternName) REM 预定义 ,自定义 ,用户定义 三种<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.SetGripStatus(GripStatus.GripsToBeDeleted)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> 'ha.SetGradient(GradientPatternType.PreDefinedGradient,"")<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.IntersectWith(ent, Intersect.ExtendThis, d, 0, 0)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.EvaluateGradientColorAt(1)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.BoundingBoxIntersectWith(<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.AppendLoop<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.AppendLoop(hl)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.EvaluateHatch(True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(ha)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_9684_10481_Open_Image onclick="this.style.display='none'; Codehighlighter1_9684_10481_Open_Text.style.display='none'; Codehighlighter1_9684_10481_Closed_Image.style.display='inline'; Codehighlighter1_9684_10481_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_9684_10481_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_9684_10481_Closed_Text.style.display='none'; Codehighlighter1_9684_10481_Open_Image.style.display='inline'; Codehighlighter1_9684_10481_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddHatch()Function AddHatch(ByVal idC As ObjectIdCollection, ByVal HatchStyleType As HatchStyle, ByVal PatternScale As Double, ByVal PatternAngle As Double, ByVal LayerName As String, Optional ByVal PatternName As String = "ANSI31") As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 圆的填充()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 多边形与圆组合的填充 ????<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ha As New Hatch<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.HatchStyle = HatchStyleType<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.HatchStyle = HatchStyle.Normal REM 三种<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.PatternAngle = PatternAngle REM 填充图案角度 0 90,270<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.PatternScale = PatternScale<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' ha.HatchObjectType = HatchObjectType.HatchObject REM 2种<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.SetHatchPattern(HatchPatternType.PreDefined, PatternName) REM 预定义 ,自定义 ,用户定义 三种<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.AppendLoop(0, idC)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ha.EvaluateHatch(True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(ha)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_10495_11068_Open_Image onclick="this.style.display='none'; Codehighlighter1_10495_11068_Open_Text.style.display='none'; Codehighlighter1_10495_11068_Closed_Image.style.display='inline'; Codehighlighter1_10495_11068_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_10495_11068_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_10495_11068_Closed_Text.style.display='none'; Codehighlighter1_10495_11068_Open_Image.style.display='inline'; Codehighlighter1_10495_11068_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddPolyline()Function AddPolyline(ByVal ptArr As Point3dCollection, ByVal LayerName As String, Optional ByVal width As Double = 0) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 有 Polyline Polyline2d Polyline3d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim pl As New Polyline<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> pl.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim i As Integer<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim bulge, startWidth, endWidth As Double<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> bulge = 0<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> startWidth = width<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> endWidth = width<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> For i = 0 To ptArr.Count - 1<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> pl.AddVertexAt(i, New Point2d(ptArr(i).X, ptArr(i).Y), bulge, startWidth, endWidth)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Next<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(pl)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_11082_11438_Open_Image onclick="this.style.display='none'; Codehighlighter1_11082_11438_Open_Text.style.display='none'; Codehighlighter1_11082_11438_Closed_Image.style.display='inline'; Codehighlighter1_11082_11438_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_11082_11438_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_11082_11438_Closed_Text.style.display='none'; Codehighlighter1_11082_11438_Open_Image.style.display='inline'; Codehighlighter1_11082_11438_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddPolyline()Function AddPolyline(ByVal ptArr As Point3dCollection, ByVal closed As Boolean, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 有 Polyline Polyline2d Polyline3d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> 'closed表示闭合 只有添加多边形时才闭合<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim pline3d As New Polyline3d(Poly3dType.SimplePoly, ptArr, closed)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> pline3d.Layer = LayerName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddEntity(pline3d)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_11451_11807_Open_Image onclick="this.style.display='none'; Codehighlighter1_11451_11807_Open_Text.style.display='none'; Codehighlighter1_11451_11807_Closed_Image.style.display='inline'; Codehighlighter1_11451_11807_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_11451_11807_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_11451_11807_Closed_Text.style.display='none'; Codehighlighter1_11451_11807_Open_Image.style.display='inline'; Codehighlighter1_11451_11807_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddRectangle()Function AddRectangle(ByVal pt1 As Point3d, ByVal pt3 As Point3d, ByVal LayerName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ptArr As New Point3dCollection<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ptArr.Add(pt1)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ptArr.Add(New Point3d(pt1.X, pt3.Y, 0))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ptArr.Add(pt3)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ptArr.Add(New Point3d(pt3.X, pt1.Y, 0))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddPolyline(ptArr, True, LayerName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_11820_12571_Open_Image onclick="this.style.display='none'; Codehighlighter1_11820_12571_Open_Text.style.display='none'; Codehighlighter1_11820_12571_Closed_Image.style.display='inline'; Codehighlighter1_11820_12571_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_11820_12571_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_11820_12571_Closed_Text.style.display='none'; Codehighlighter1_11820_12571_Open_Image.style.display='inline'; Codehighlighter1_11820_12571_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddPolygon()Function AddPolygon(ByVal centerPoint As Point3d, ByVal number As Integer, ByVal radius As Double, ByVal LayerName As String, Optional ByVal width As Double = 0) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 半径指的是外接圆的半径<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim angle As Double<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> angle = Math.PI * 2 / number<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ptArr As New Point3dCollection<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim pt As Point3d<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim i As Integer<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> For i = 0 To number - 1<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' pt.X = centerPoint.X + radius * Math.Cos(i * angle)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' pt.Y = centerPoint.Y + radius * Math.Sin(i * angle)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> pt = New Point3d(centerPoint.X + radius * Math.Cos(i * angle), centerPoint.Y + radius * Math.Sin(i * angle), 0)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ptArr.Add(pt)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Next<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return AddPolyline(ptArr, True, LayerName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 没有成功<BR><IMG id=Codehighlighter1_12598_13089_Open_Image onclick="this.style.display='none'; Codehighlighter1_12598_13089_Open_Text.style.display='none'; Codehighlighter1_12598_13089_Closed_Image.style.display='inline'; Codehighlighter1_12598_13089_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_12598_13089_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_12598_13089_Closed_Text.style.display='none'; Codehighlighter1_12598_13089_Open_Image.style.display='inline'; Codehighlighter1_12598_13089_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddTable()Function AddTable(ByVal Position As Point3d, ByVal row As Integer, ByVal col As Integer) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim mytable As New Table<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.NumRows = row<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.NumColumns = col<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.SetRowHeight(1, 3)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.SetTextHeight(3, 2, 2.5)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.Position = Position<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.SetBackgroundColor(2, 2, Color.FromColorIndex(ColorMethod.ByAci, 1))<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> mytable.SetTextString(0, 0, "你是SB") REM 还有其他的<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> AddEntity(mytable)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG id=Codehighlighter1_13091_13901_Closed_Image onclick="this.style.display='none'; Codehighlighter1_13091_13901_Closed_Text.style.display='none'; Codehighlighter1_13091_13901_Open_Image.style.display='inline'; Codehighlighter1_13091_13901_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top><IMG id=Codehighlighter1_13091_13901_Open_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_13091_13901_Open_Text.style.display='none'; Codehighlighter1_13091_13901_Closed_Image.style.display='inline'; Codehighlighter1_13091_13901_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top>创建组#Region "创建组"<BR><IMG id=Codehighlighter1_13116_13889_Open_Image onclick="this.style.display='none'; Codehighlighter1_13116_13889_Open_Text.style.display='none'; Codehighlighter1_13116_13889_Closed_Image.style.display='inline'; Codehighlighter1_13116_13889_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_13116_13889_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_13116_13889_Closed_Text.style.display='none'; Codehighlighter1_13116_13889_Open_Image.style.display='inline'; Codehighlighter1_13116_13889_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Sub AddGroup()Sub AddGroup(ByVal objIds As ObjectIdCollection, ByVal pGroupName As System.String)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim tm As DBTransMan = db.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> 'start a transaction<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ta As Transaction = tm.StartTransaction()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Try<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim gp As New Group(pGroupName, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim dict As DBDictionary = tm.GetObject(db.GroupDictionaryId, OpenMode.ForWrite, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> dict.SetAt("ASDK_NEWNAME", gp)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim thisId As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> For Each thisId In objIds<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> gp.Append(thisId)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Next<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.AddNewlyCreatedDBObject(gp, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Commit()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Finally<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End Try<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Sub<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>#End Region<BR><IMG id=Codehighlighter1_13903_14694_Closed_Image onclick="this.style.display='none'; Codehighlighter1_13903_14694_Closed_Text.style.display='none'; Codehighlighter1_13903_14694_Open_Image.style.display='inline'; Codehighlighter1_13903_14694_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top><IMG id=Codehighlighter1_13903_14694_Open_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_13903_14694_Open_Text.style.display='none'; Codehighlighter1_13903_14694_Closed_Image.style.display='inline'; Codehighlighter1_13903_14694_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top>添加UCS#Region "添加UCS"<BR><IMG id=Codehighlighter1_13930_14682_Open_Image onclick="this.style.display='none'; Codehighlighter1_13930_14682_Open_Text.style.display='none'; Codehighlighter1_13930_14682_Closed_Image.style.display='inline'; Codehighlighter1_13930_14682_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_13930_14682_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_13930_14682_Closed_Text.style.display='none'; Codehighlighter1_13930_14682_Open_Image.style.display='inline'; Codehighlighter1_13930_14682_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddUcs()Function AddUcs(ByVal UcsName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim objId As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim tm As DBTransMan = db.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ta As Transaction = tm.StartTransaction<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ut As UcsTable = tm.GetObject(db.UcsTableId, OpenMode.ForWrite)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> If ut.Has(UcsName) Then<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = ut.Item(UcsName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Else<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim utr As New UcsTableRecord<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> utr.Name = UcsName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> 'utr.Origin=<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' utr.XAxis<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = ut.Add(utr)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.AddNewlyCreatedDBObject(utr, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Commit()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End If<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return objId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>#End Region<BR><IMG id=Codehighlighter1_14696_15571_Closed_Image onclick="this.style.display='none'; Codehighlighter1_14696_15571_Closed_Text.style.display='none'; Codehighlighter1_14696_15571_Open_Image.style.display='inline'; Codehighlighter1_14696_15571_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top><IMG id=Codehighlighter1_14696_15571_Open_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_14696_15571_Open_Text.style.display='none'; Codehighlighter1_14696_15571_Closed_Image.style.display='inline'; Codehighlighter1_14696_15571_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top>添加视口#Region "添加视口"<BR><IMG id=Codehighlighter1_14722_15559_Open_Image onclick="this.style.display='none'; Codehighlighter1_14722_15559_Open_Text.style.display='none'; Codehighlighter1_14722_15559_Closed_Image.style.display='inline'; Codehighlighter1_14722_15559_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_14722_15559_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_14722_15559_Closed_Text.style.display='none'; Codehighlighter1_14722_15559_Open_Image.style.display='inline'; Codehighlighter1_14722_15559_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddViewport()Function AddViewport(ByVal ViewPortName As String) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim objId As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim tm As DBTransMan = db.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ta As Transaction = tm.StartTransaction<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim vpt As ViewportTable = tm.GetObject(db.ViewportTableId, OpenMode.ForWrite)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> If vpt.Has(ViewPortName) Then<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = vpt.Item(ViewPortName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Else<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim vptr As New ViewportTableRecord<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> vptr.Name = ViewPortName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ' Autodesk.AutoCAD.Geometry.CoordinateSystem3d()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> 'vptr.Ucs()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = vpt.Add(vptr)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.AddNewlyCreatedDBObject(vptr, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Commit()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End If<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.Dispose()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return objId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>#End Region<BR><IMG id=Codehighlighter1_15573_16457_Closed_Image onclick="this.style.display='none'; Codehighlighter1_15573_16457_Closed_Text.style.display='none'; Codehighlighter1_15573_16457_Open_Image.style.display='inline'; Codehighlighter1_15573_16457_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top><IMG id=Codehighlighter1_15573_16457_Open_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_15573_16457_Open_Text.style.display='none'; Codehighlighter1_15573_16457_Closed_Image.style.display='inline'; Codehighlighter1_15573_16457_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top>添加视图#Region "添加视图"<BR><IMG id=Codehighlighter1_15599_16445_Open_Image onclick="this.style.display='none'; Codehighlighter1_15599_16445_Open_Text.style.display='none'; Codehighlighter1_15599_16445_Closed_Image.style.display='inline'; Codehighlighter1_15599_16445_Closed_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_15599_16445_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_15599_16445_Closed_Text.style.display='none'; Codehighlighter1_15599_16445_Open_Image.style.display='inline'; Codehighlighter1_15599_16445_Open_Text.style.display='inline';" src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> Public Function AddView()Function AddView(ByVal ViewName As String, ByVal render As RenderMode, ByVal ucsId As ObjectId) As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM 添加视图() 这个和添加图层是相同的<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim tm As DBTransMan = db.TransactionManager<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim ta As Transaction = tm.StartTransaction<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim vt As ViewTable = ta.GetObject(db.ViewTableId, OpenMode.ForWrite)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim objId As ObjectId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> If vt.Has(ViewName) Then<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = vt.Item(ViewName)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Else<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Dim vtr As New ViewTableRecord<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> vtr.Name = ViewName<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> vtr.RenderMode = render<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> vtr.SetUcs(ucsId)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> REM vtr.SetUcs(<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> objId = vt.Add(vtr)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> tm.AddNewlyCreatedDBObject(vtr, True)<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> ta.Commit()<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> End If<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Return objId<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> End Function<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>#End Region<BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://objectarx.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>End Class<BR> 对不起,我试用时发现添加图层函数的,设定线型的LINETYPE函数好像不对。请楼主指点。谢谢楼主提供这么好的东东。 这么好的贴子怎么没人顶起。大家都有眼无珠啊!我再来顶一下…… <P>顶一下 ,不错,呵呵,学习!</P> 谢谢无私精神。 本帖最后由 作者 于 2006-5-31 21:26:14 编辑再顶一下。现在这个论谈里的人最少了。给楼主送花一朵。 顶,好东西!!! 顶一下,谢了! <P>先顶了,接下来在慢慢研究</P> <P>缺少一个重要的东东——制作块</P>
<P>另外,我个人认为直线用多义线代替就行了,因为多义线编辑比较方便</P>
页:
[1]
2