Author Topic: RadialDimensionLarge  (Read 2535 times)

0 Members and 1 Guest are viewing this topic.

bikelink

  • Guest
RadialDimensionLarge
« on: May 05, 2009, 06:09:27 AM »
Have  someone an example of use of RadialDimensionLarge ? I really don't understood how to build this dimension!   :?

fixo

  • Guest
Re: RadialDimensionLarge
« Reply #1 on: May 08, 2009, 05:42:45 AM »
Have  someone an example of use of RadialDimensionLarge ? I really don't understood how to build this dimension!   :?
Here is a my quick example almoust not tested thoug
Give it a try
Code: [Select]
    <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

~'J'~

bikelink

  • Guest
Re: RadialDimensionLarge
« Reply #2 on: May 19, 2009, 09:21:15 AM »
Hi Daniel, your suggest is always precious!
I'made for a quick solution another way. Of course this week i'll try as soon as possible your code ;)
Thank you very much!

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8691
  • AKA Daniel
Re: RadialDimensionLarge
« Reply #3 on: May 19, 2009, 09:31:14 AM »
Glad I could help  :?

bikelink

  • Guest
Re: RadialDimensionLarge
« Reply #4 on: May 22, 2009, 07:55:42 AM »
 :-D :-D I have spent too much time to my keyboard this days, and my view is  fogged ...
Thanks fixo!

fixo

  • Guest
Re: RadialDimensionLarge
« Reply #5 on: May 22, 2009, 03:37:53 PM »
The same thing with me  :-D
I forgot about this thread 
Glad if that helps
Cheers  :-)

~'J'~