VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Scaling of polyline

1 REPLY 1
Reply
Message 1 of 2
ah_4032
181 Views, 1 Reply

Scaling of polyline

I write this loop for enlarging selected polylines to enlarge their area. when I select one polyline, I don't have any problems but when I select many polylines, the enlarged polylines (magenta color polyline) displaced on x-axis My code is here:

If ClosedPolyNumber > 0 Then
 For j = 0 To UBound(arClosePolyline)
   BaseScalPnt(0) = arClosePolyline(j, 0)
   BaseScalPnt(1) = arClosePolyline(j, 1)
   BaseScalPnt(2) = 0 DeltaArea = 0.1
   AreaRatio = 1
   up = UBound(arClosePolyline(j, 4))
   arCPolyPnts = arClosePolyline(j, 4)
   ReDim Preserve arPolyRPnts(up + (up + 1) / 2) k = 0
     For i = 0 To UBound(arCPolyPnts) Step 2
       arPolyRPnts(3 * k) = arCPolyPnts(i)
       k = k + 1 Next k = 0
         For i = 1 To UBound(arCPolyPnts) Step 2
           arPolyRPnts(3 * k + 1) = arCPolyPnts(i)
           arPolyRPnts(3 * k + 2) = 0
           k = k + 1
         Next
         Set curves(j) = ThisDrawing.ModelSpace.AddPolyline(arPolyRPnts)
         Do While DeltaArea < 1.2
           curves(j).ScaleEntity BaseScalPnt, AreaRatio DeltaArea = curves(j).Area / arClosePolyline(j, 3)
           If DeltaArea < 1.2 Then
             AreaRatio = AreaRatio + 0.01
           End If
           Loop
           curves(j).Update
           Erase arPolyRPnts()
           Erase arPolyPnts()
         Next
       End If
1 REPLY 1
Message 2 of 2
ed57gmc
in reply to: ah_4032

I reformatted what you posted, but it won't run as is. Please post your code using the link in my signature. You can edit your first post by clicking on the 3 vertical dots and choosing "Edit Reply". Post all your code for the command.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report