0 Members and 1 Guest are viewing this topic.
Have someone an example of use of RadialDimensionLarge ? I really don't understood how to build this dimension!
<CommandMethod("RDL")> _ Public Sub TestRadLargeDimension() Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Using tr As AcDb.Transaction = db.TransactionManager.StartTransaction() Dim rad As Double = 5.0 Dim Pi As Double = Math.PI Dim pc As New AcGe.Point3d(0.0, 0.0, 0.0) Dim ps As New AcGe.Point3d(Math.Sin(Pi / 4) * rad, Math.Sin(Pi / 4) * rad, 0) 'start of jogged dimension Dim ang = AngleFromX(pc, ps, ed)'angle from circle/arc center to starting point of dimension Dim ang1 As Double = Pi + ang Dim angjogg = Pi / 4 'jogg angle (to suit) Dim ang2 = ang + angjogg Dim pn As Point3d = PolarPoint(ps, ang1, rad * 1.25)'left point of zigzag Dim pm As Point3d = PolarPoint(pn, ang2, rad * 0.4)'right point of zigzag Dim pj As New AcGe.Point3d((pn.X + pm.X / 2), (pn.Y + pm.Y) / 2, 0) 'middle point of zigzag squiggle Dim pe As New AcGe.Point3d(Math.Sin(Pi / 4) * rad*1.25, Math.Sin(Pi / 4) * rad*1.25, 0) 'end of jogged dimension Dim txt = "Radius = " & rad.ToString() Try Dim bt As AcDb.BlockTable = CType(tr.GetObject(db.BlockTableId, AcDb.OpenMode.ForRead, False), AcDb.BlockTable) Dim btr As AcDb.BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, AcDb.OpenMode.ForWrite, False), AcDb.BlockTableRecord) Dim odim = New RadialDimensionLarge(pj, ps, pe, pm, angjogg, txt, db.Dimstyle) btr.AppendEntity(odim) tr.AddNewlyCreatedDBObject(odim, True) tr.Commit() Catch ex As Autodesk.AutoCAD.Runtime.Exception MsgBox(ex.StackTrace) End Try End Using End Sub Public Shared Function PolarPoint(ByVal BasePoint As Point3d, ByVal ang As Double, ByVal distance As Double) As AcGe.Point3d Dim x As Double = distance * Math.Cos(ang) Dim y As Double = distance * Math.Sin(ang) Return New Point3d(BasePoint.X + x, BasePoint.Y + y, BasePoint.Z) End Function Public Shared Function AngleFromX(ByVal pt1 As Point3d, ByVal pt2 As Point3d, ByVal ed As Editor) As Double Dim ucsmtx As Matrix3d = ed.CurrentUserCoordinateSystem Dim ucs As CoordinateSystem3d = ucsmtx.CoordinateSystem3d Dim ucsplane As Plane = New Plane(ucs.Origin, ucs.Xaxis, ucs.Yaxis) Dim vec As Vector3d = pt2 - pt1 Dim ang As Double = vec.AngleOnPlane(ucsplane) Return ang End Function