Message 1 of 4
Replace Spline to Circle - False size
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i wrote a VBA, which should replace all spline with circles. I get size of spline with GetBoundingBox, calculate center point and create circle on the same place.
Sub spline2circle()
Dim pt(2) As Double
Dim rd As Double
Dim min As Variant
Dim max As Variant
Dim cr As AcadCircle
Dim curSpline As AcadSpline
Dim ent As AcadEntity
Dim key As Variant
For Each ent In ThisDrawing.ModelSpace
If TypeOf ent Is AcadSpline Then
Set curSpline = ent
curSpline.GetBoundingBox min, max
pt(0) = min(0) + (max(0) - min(0)) / 2
pt(1) = min(1) + (max(1) - min(1)) / 2
pt(2) = 0
rd = (Abs(((max(1) - min(1)) * 0.5)) + Abs(((max(0) - min(0)) * 0.5))) * 0.5
Set cr = ThisDrawing.ModelSpace.AddCircle(pt, rd)
End If
Next
End Sub
You can see screenshot;
green=spline
white= circle
Circle is bigger than spline and aligned to top-right corner of them. Why?