Depth Example
Examples:
Sub Example_Depth_AecLayoutGrid2D() 'This example displays the depth of a 2D layout grid Dim obj As Object Dim pt As Variant Dim grid As AecLayoutGrid2D Dim msg As String Dim angAsString As String ' Ask user to select a grid. ThisDrawing.Utility.GetEntity obj, pt, "Select a 2D Layout Grid" If TypeOf obj Is AecLayoutGrid2D Then Set grid = obj Set obj = Nothing ' If the grid is radial, then Depth is an angle, in radians. ' There is no way to check the grid type, because there is ' no Shape property exposed. So this example displays both ' the raw value (to three decimal places) and the value in ' degrees (converted from radians). msg = msg & "Depth is " & Format(grid.Depth, "0.000") ' Convert the radian value to degrees with a precision of 2. angAsString = ThisDrawing.Utility.AngleToString(grid.Depth, acDegrees, 2) msg = msg & " (if radial, this is " & angAsString & " degrees)" & vbCrLf MsgBox msg, vbInformation, "Depth Example" Else MsgBox "Not a 2D Layout Grid", vbExclamation, "Depth Example" End If
End Sub
Sub Example_Depth_AecLayoutGrid3D()'This example displays the depth of a 3D layout grid Dim obj As Object Dim pt As Variant Dim grid As AecLayoutGrid3D ThisDrawing.Utility.GetEntity obj, pt, "Select a 3D Layout Grid" If TypeOf obj Is AecLayoutGrid3D Then Set grid = obj MsgBox "Grid Depth is: " & grid.Depth, vbInformation, "Depth Example" Else MsgBox "Not a 3D Layout Grid", vbExclamation, "Depth Example" End If
End Sub
Sub Example_Depth_AecMassElement() 'This example shows the size of the mass element in its relative Y direction Dim object As Object Dim mass As AecMassElement Dim count As Integer 'initalize count = 0 For Each object In ThisDrawing.ModelSpace If TypeOf object Is AecMassElement Then count = count + 1 Set mass = object MsgBox "Mass Element " & count & " Depth is: " & mass.Depth, vbInformation, "Depth Example" End If Next If count = 0 Then MsgBox "No Mass Elements Present in Drawing", vbInformation, "Depth Example" End If
End Sub