1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| Private Function FacettiserEllipse(ByRef obj As AcadEllipse)
Debug.Print "facettiser"
Dim TWOPI As Double
TWOPI = 2 * 3.14159
Dim angle As Double
Dim x As Double
Dim y As Double
Dim x0 As Double
Dim y0 As Double
Dim rx As Double
Dim ry As Double
Dim objLine As AcadLine
Debug.Print obj.RadiusRatio & " " & obj.MajorAxis(0) & " " & obj.MajorAxis(1)
angle = 0
If obj.MajorAxis(0) > obj.MinorAxis(0) Then
Debug.Print "x mineur"
rx = obj.MinorRadius
ry = obj.MajorRadius
Else
Debug.Print "x majeur"
rx = obj.MajorRadius
ry = obj.MinorRadius
End If
x0 = obj.Center(0) + (Cos(TWOPI * angle / 360) * rx)
y0 = obj.Center(1) + (Sin(TWOPI * angle / 360) * ry)
For angle = 0 To 360 Step 5
x = obj.Center(0) + (Cos(TWOPI * angle / 360) * rx)
y = obj.Center(1) + (Sin(TWOPI * angle / 360) * ry)
Set objLine = ThisDrawing.ModelSpace.AddLine(Pnt(x0, y0, 0), Pnt(x, y, 0))
objLine.Update
x0 = x
y0 = y
Next angle
End Function |