Linear Dimension

Discussion in 'AutoCAD' started by talledo, Jul 23, 2004.

  1. talledo

    talledo Guest

    Hello,
    I made this macro in VBA to calculate the perimeter of a polyline and insert dimensions in all the segments.


    Public Function LengthOfPolyline(PLine As AcadLWPolyline) As Double

    Dim ExplodedObjects As Variant

    On Error Resume Next
    ExplodedObjects = PLine.Explode

    Dim Index As Integer
    Dim Perimeter As Double
    Dim line As AcadLine
    Dim punto1(0 To 2) As Double
    Dim punto2(0 To 2) As Double
    Dim loc(0 To 2) As Double
    Dim quota As AcadDimension

    For Index = 0 To UBound(ExplodedObjects)
    Perimeter = Perimeter + ExplodedObjects(Index).Length
    Set line = ExplodedObjects(Index)
    punto1(0) = line.StartPoint(0)
    punto1(1) = line.StartPoint(1)
    punto1(2) = line.StartPoint(2)
    punto2(0) = line.EndPoint(0)
    punto2(1) = line.EndPoint(1)
    punto2(2) = line.EndPoint(2)
    loc(0) = punto1(0) + ((punto2(0) - punto1(0)) / 2)
    loc(1) = punto1(1) + ((punto2(1) - punto1(1)) / 2)
    loc(2) = 0
    'Disegno la quota
    Set quota = ThisDrawing.ModelSpace.AddDimAligned(punto1, punto2, loc)
    quota.Layer = "QUOTE"
    line.Delete
    Next Index
    ThisDrawing.Regen True

    LengthOfPolyline = Round(Perimeter)
    End Function

    Dimensions are “Aligned Dimensions†but I want to have “Linear Dimensionsâ€.
    How can I resolve this matter?

    Thank you
    Diego Alejandro Talledo
     
    talledo, Jul 23, 2004
    #1
  2. you want "dimlinear" with the "rotated" option set to angle of line. also, I
    would look into dimensioning using VBA methods.

    Paul
    insert dimensions in all the segments.
     
    Paul Richardson, Jul 23, 2004
    #2
  3. Dimensions are ´Aligned Dimensions¡ but I want to have ´Linear Dimensions¡.
    because YOU added them:
    Set quota = ThisDrawing.ModelSpace.AddDimRotated(punto1, punto2, loc)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jul 23, 2004
    #3
  4. talledo

    talledo Guest

    Thank you for help.
     
    talledo, Jul 26, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.