We are often faced with the task of knowing the lengths of certain elements in a drawing.Here is a simple example using VBA that adds up the length of all existing arcs in the active model sheets.
Dim sum As Double
sum = 0
Dim ee As ElementEnumerator
Dim Sc As New ElementScanCriteria
Set ee = ActiveModelReference.GraphicalElementCache.Scan(Sc)
Do While ee.MoveNext
sum = sum + ee.Current.AsArcElement.Length
If sum = 0 Then
MsgBox "No Sheets Found", vbOKOnly
MsgBox "Total length of all sheets: " & sum, vbOKOnly
In the above example, the active arcs' model is read, and then the lengths of the individual active arcs are read and added together.The result is displayed in a dialog box, or if no sheet has been found that is specified.