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? 
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@entercad.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.