Here's my code: Im using the Point3AngularDimension object to get the angle between 2 lines and now i've also added code to get the the bisector between the 2 lines (see purple line in pic).
I pulled the code to get he angular dimension off the AutoCad .NET Developer's Guide.
Sending a pic of the final outcome. Thanks again for your help.
Proctor
<CommandMethod("CreateAngularDimension")> _
Public Function GetAngle(ByVal myPreviousLine, ByVal myLine) As Double
' Get the current database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Dim dAngle As Double = 0 'angle of line
Dim dMeasurment As Double = 0
Dim pMidpoint As Point3d
Dim sDirection As String = ""
Dim myCenterPoint As Point3d = Nothing
Dim myNewLine As Line = Nothing
Dim myTriangleLineToGetBisector As Line = Nothing
Dim myTriangleLineToGetBisector1 As Line = Nothing
Dim myTriangleLineToGetBisector2 As Line = Nothing
Dim myBisectorLine As Line = Nothing
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim myIntersectPts As New Point3dCollection
Dim myLine3d As Line3d
' Open the Block table for read
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
'Open the Block table record Model space for write
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
' Create an angular dimension
Dim acLinAngDim As Point3AngularDimension = New Point3AngularDimension()
acLinAngDim.SetDatabaseDefaults()
'this represents the vertex point (point between the 2 lines)
If myLine.startpoint.Equals(myPreviousLine.startpoint) Then
myTriangleLineToGetBisector = New Line(myLine.startpoint, myLine.endpoint)
myTriangleLineToGetBisector1 = New Line(myPreviousLine.startpoint, myPreviousLine.endpoint)
acLinAngDim.CenterPoint = New Point3d(myLine.startpoint.x, myLine.startpoint.y, 0)
'this is the point that's not the vertex for myLine
acLinAngDim.XLine1Point = New Point3d(myLine.endpoint.x, myLine.endpoint.y, 0)
'this is the point that's not the vertex for myPreviousLine
acLinAngDim.XLine2Point = New Point3d(myPreviousLine.endpoint.x, myPreviousLine.endpoint.y, 0)
ElseIf myLine.startpoint.Equals(myPreviousLine.endpoint) Then
myTriangleLineToGetBisector = New Line(myLine.startpoint, myLine.endpoint)
myTriangleLineToGetBisector1 = New Line(myPreviousLine.endpoint, myPreviousLine.startpoint)
acLinAngDim.CenterPoint = New Point3d(myLine.startpoint.x, myLine.startpoint.y, 0)
'this is the point that's not the vertex for myLine
acLinAngDim.XLine1Point = New Point3d(myLine.endpoint.x, myLine.endpoint.y, 0)
'this is the point that's not the vertex for myPreviousLine
acLinAngDim.XLine2Point = New Point3d(myPreviousLine.startpoint.x, myPreviousLine.startpoint.y, 0)
ElseIf myLine.endpoint.Equals(myPreviousLine.startpoint) Then
myTriangleLineToGetBisector = New Line(myLine.endpoint, myLine.startpoint)
myTriangleLineToGetBisector1 = New Line(myPreviousLine.startpoint, myPreviousLine.endpoint)
acLinAngDim.CenterPoint = New Point3d(myLine.endpoint.x, myLine.endpoint.y, 0)
'this is the point that's not the vertex for one myLine
acLinAngDim.XLine1Point = New Point3d(myLine.startpoint.x, myLine.startpoint.y, 0)
'this is the point that's not the vertex for myPreviousLine
acLinAngDim.XLine2Point = New Point3d(myPreviousLine.endpoint.x, myPreviousLine.endpoint.y, 0)
ElseIf myLine.endpoint.Equals(myPreviousLine.endpoint) Then
myTriangleLineToGetBisector = New Line(myLine.endpoint, myLine.startpoint)
myTriangleLineToGetBisector1 = New Line(myPreviousLine.endpoint, myPreviousLine.startpoint)
acLinAngDim.CenterPoint = New Point3d(myLine.endpoint.x, myLine.endpoint.y, 0)
'this is the point that's not the vertex for myLIne
acLinAngDim.XLine1Point = New Point3d(myLine.startpoint.x, myLine.startpoint.y, 0)
'this is the point that's not the vertex for myPreviousLine
acLinAngDim.XLine2Point = New Point3d(myPreviousLine.startpoint.x, myPreviousLine.startpoint.y, 0)
End If
'going to find the bisecting line between the angle:
'create 2 lines - from the center point going in the same direction as the lines:
Dim myPointForMyTriangleLineToGetBisector As Point3d = myTriangleLineToGetBisector.GetPointAtDist(1)
Dim myPointForMyTriangleLineToGetBisector1 As Point3d = myTriangleLineToGetBisector1.GetPointAtDist(1)
DrawLine(myTriangleLineToGetBisector.StartPoint, myPointForMyTriangleLineToGetBisector, "Blue")
myPointForMyTriangleLineToGetBisector1 = myTriangleLineToGetBisector1.GetPointAtDist(1)
DrawLine(myTriangleLineToGetBisector1.StartPoint, myPointForMyTriangleLineToGetBisector1, "Red")
myTriangleLineToGetBisector2 = New Line(myPointForMyTriangleLineToGetBisector, myPointForMyTriangleLineToGetBisector1)
DrawLine(myTriangleLineToGetBisector2.StartPoint, myTriangleLineToGetBisector2.EndPoint, "Pink")
pMidpoint = myTriangleLineToGetBisector2.StartPoint.Add(myTriangleLineToGetBisector2.StartPoint.GetVectorTo(myTriangleLineToGetBisector2.EndPoint).MultiplyBy(0.5))
'get midline of this line and then you have the bisector
myLine3d = New Geometry.Line3d(myTriangleLineToGetBisector2.StartPoint, myTriangleLineToGetBisector2.EndPoint)
pMidpoint = pMidpoint.Subtract(myLine3d.Direction.Negate.GetPerpendicularVector.MultiplyBy(1))
DrawLine(myTriangleLineToGetBisector2.StartPoint, myTriangleLineToGetBisector2.EndPoint, "Gold")
myBisectorLine = New Line(myTriangleLineToGetBisector2.StartPoint, myTriangleLineToGetBisector2.EndPoint)
acLinAngDim.DimensionStyle = acCurDb.Dimstyle
myCenterPoint = acLinAngDim.CenterPoint
Debug.Print("My Center Point: " & myCenterPoint.ToString())
'Draw Bisecting line:
myBisectorLine = New Line(myCenterPoint, pMidpoint)
DrawLine(myBisectorLine.StartPoint, myBisectorLine.EndPoint, "Purple")
acLinAngDim.ArcPoint = New Point3d(myBisectorLine.EndPoint.X, myBisectorLine.EndPoint.Y, 0)
sDirection = GetLineDirrection(myBisectorLine)
colLISTOfAngularDimensionsDirection.Add(sDirection)
dMeasurment = acLinAngDim.Measurement
dAngle = Math.Round(dMeasurment * 180 / Math.PI)
Debug.Print("Angle: " & dAngle.ToString())
' Add the new object to Model space and the transaction
acBlkTblRec.AppendEntity(acLinAngDim)
acTrans.AddNewlyCreatedDBObject(acLinAngDim, True)
acTrans.Commit()
End Using
End Function