0% found this document useful (0 votes)
5 views2 pages

VBA Script for Circle and Line Analysis

The provided VBA code defines a subroutine 'SurfCercle' that iterates through all entities in the model space of a drawing. It calculates and displays the circumference and area of circles, and the length and angle of lines, adding corresponding text annotations to the drawing. The code also adjusts the rotation of the text based on the angle of the lines.

Uploaded by

Mohamed Kbìrí
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

VBA Script for Circle and Line Analysis

The provided VBA code defines a subroutine 'SurfCercle' that iterates through all entities in the model space of a drawing. It calculates and displays the circumference and area of circles, and the length and angle of lines, adding corresponding text annotations to the drawing. The code also adjusts the rotation of the text based on the angle of the lines.

Uploaded by

Mohamed Kbìrí
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

Public Sub SurfCercle()

Dim element As AcadEntity

pi = 3.14

taille = 400

nbcercle = 0

For Each element In [Link]

Select Case [Link]

Case "AcDbCircle"

Dim pt As Variant

nbcercle = nbcercle + 1

pt = [Link]

surf = Format([Link], "# ### ###.00") & _

"mL" & ", " & Format([Link], "# ### ###.00") & "m\u+00b2"

[Link] "C" & nbcercle & "=" & surf, pt, taille

Case "AcDbLine"

Dim pt1, pt2 As Variant

Dim pt3(0 To 2) As Double

pt1 = [Link]

pt2 = [Link]

pt3(0) = (pt1(0) + pt2(0)) / 2

pt3(1) = (pt1(1) + pt2(1)) / 2

txt = Format([Link], "# ### ###.00") & "mL"

Set contenu = [Link](txt, pt3, taille)

MsgBox [Link]

If [Link] > pi / 2 And [Link] <= pi Then


aangle = [Link] - pi

Else

aangle = [Link]

End If

[Link] = aangle

End Select

Next

End Sub

You might also like