DistanceToReal Example |
Using Programming Languages other than VBA
Sub Example_DistanceToReal() ' This example passes several different distances in ' different units to be converted to real values. Dim distAsString As String Dim unit As Long Dim distAsReal As Double ' Convert the distance to a real in scientific units unit = acScientific distAsString = "1.75E+01" distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit) MsgBox "1.75E+01 converts to " & distAsReal & " in scientific units.", , "DistanceToReal Example" ' Convert the distance to a real in decimal units unit = acDecimal distAsString = "17.5" distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit) MsgBox "1.75 converts to " & distAsReal & " in decimal units.", , "DistanceToReal Example" ' Convert the distance to a real in engineering units unit = acEngineering distAsString = "1'-5.50""" distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit) MsgBox "1'-5.50"" converts to " & distAsReal & " in engineering units.", , "DistanceToReal Example" ' Convert the distance to a real in architectural units unit = acArchitectural distAsString = "1'-5 1/2""" distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit) MsgBox "1'-5 1/2"" converts to " & distAsReal & " in architectural units.", , "DistanceToReal Example" ' Convert the distance to a real in fractional units unit = acFractional distAsString = "17 1/2" distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit) MsgBox "1'-5 1/2"" converts to " & distAsReal & " in fractional units.", , "DistanceToReal Example" End Sub
Comments? |