Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone!
I am trying to get the angle between two lines, I have attached the image
For getting the angle in Z axis I have changed the ucs and then I tried to get the angle, but It has been showing the angle in xy, only ucs has been changed to specified point.
Dim Vuline As Line = New Line(center, ptver)
'' Add the line to the drawing
curSpace.AppendEntity(Vuline)
tr.AddNewlyCreatedDBObject(Vuline, True)
Dim Vlline As Line = New Line(center, ptlow)
'' Add the line to the drawing
curSpace.AppendEntity(Vlline)
tr.AddNewlyCreatedDBObject(Vlline, True)
Dim vlPt1 As Point3d = Vlline.StartPoint
Dim vlPt2 As Point3d = Vlline.EndPoint
Dim vuPt1 As Point3d = Vlline.StartPoint
Dim vuPt2 As Point3d = Vlline.EndPoint
'change use
Dim acUCSTbl As UcsTable
acUCSTbl = tr.GetObject(acCurDb.UcsTableId, OpenMode.ForRead)
Dim acUCSTblRec As UcsTableRecord
' Check to see if the "Window_UCS" UCS table record exists
If acUCSTbl.Has("New_UCS") = False Then
acUCSTblRec = New UcsTableRecord()
acUCSTblRec.Name = "New_UCS"
'' Open the UCSTable for write
acUCSTbl.UpgradeOpen()
'' Add the new UCS table record
acUCSTbl.Add(acUCSTblRec)
tr.AddNewlyCreatedDBObject(acUCSTblRec, True)
Else
acUCSTblRec = tr.GetObject(acUCSTbl("New_UCS"), OpenMode.ForWrite)
End If
Dim StartPts = center
Dim EndPts = New Point3d(ptver.X, ptver.Y, center.Z)
Dim AnglePts = ptver
Dim xVex As Vector3d
Dim yVex As Vector3d
Dim zVex As Vector3d
Dim AngleCord As Matrix3d
xVex = center.GetVectorTo(EndPts).GetNormal()
zVex = xVex.CrossProduct(StartPts.GetVectorTo(AnglePts)).GetNormal()
yVex = zVex.CrossProduct(xVex).GetNormal()
AngleCord = Matrix3d.AlignCoordinateSystem(Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis, StartPts, xVex, yVex, zVex)
acUCSTblRec.Origin = AngleCord.CoordinateSystem3d.Origin
acUCSTblRec.XAxis = AngleCord.CoordinateSystem3d.Xaxis
acUCSTblRec.YAxis = AngleCord.CoordinateSystem3d.Yaxis
'' Open the active viewport
Dim acVportTblRec As ViewportTableRecord
acVportTblRec = tr.GetObject(acDoc.Editor.ActiveViewportId,
OpenMode.ForWrite)
'' Display the UCS Icon at the origin of the current viewport
acVportTblRec.IconAtOrigin = True
acVportTblRec.IconEnabled = True
'' Set the UCS current
acVportTblRec.SetUcs(acUCSTblRec.ObjectId)
acDoc.Editor.UpdateTiledViewportsFromDatabase()
Dim acLinAngDimv As LineAngularDimension2 = New LineAngularDimension2()
acLinAngDimv.XLine1Start = New Point3d(vlPt1.X, vlPt1.Y, 0)
acLinAngDimv.XLine1End = New Point3d(vlPt2.X, vlPt2.Y, 0)
acLinAngDimv.XLine2Start = New Point3d(vuPt1.X, vuPt1.Y, 0)
acLinAngDimv.XLine2End = New Point3d(vuPt2.X, vuPt2.Y, 0)
'acLinAngDims.ArcPoint = New Point3d(3, 5, 0)
acLinAngDimv.DimensionStyle = acCurDb.Dimstyle
'' Add the new object to Model space and the transaction
curSpace.AppendEntity(acLinAngDimv)
tr.AddNewlyCreatedDBObject(acLinAngDimv, True)
could anyone guide me, how to changed the code to achieve the result..
Solved! Go to Solution.