DecimalSeparator Example

Using Programming Languages other than VBA

Sub Example_DecimalSeparator()
	' This example creates a Dim3PointAngular object in model space
	' and allows the user to change the decimal separator appearance
	' using the DecimalSeparator property

	Dim DimPointAngularObj As AcadDim3PointAngular
	Dim AngleVertex(0 To 2) As Double
	Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
	Dim TextPoint(0 To 2) As Double
	Dim oldSeparator As String, newSeparator As String

	' Define the new Dim3PointAngular object
	AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
	FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
	SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
	TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

	' Create the new Dim3PointAngular object in model space
	Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)

	' Set precision so that degrees are visible
	DimPointAngularObj.TextPrecision = acDimPrecisionFour

	ThisDrawing.Application.ZoomAll

	' Read and display current decimal separator
	MsgBox "The decimal separator for this object is currently set to: [" & DimPointAngularObj.DecimalSeparator & "]"

	' Alter the decimal separator property for this object
	oldSeparator = DimPointAngularObj.DecimalSeparator
	newSeparator = InputBox("Enter a new decimal separator", "Change Decimal Separator", oldSeparator)

	If newSeparator = "" Then
		Exit Sub
	Else
		' Set new decimal separator, making sure to use only one character
		DimPointAngularObj.DecimalSeparator = Left(newSeparator, 1)
	End If

	ThisDrawing.Regen acAllViewports

	' Read and display current decimal separator
	MsgBox "The decimal separator for this object is now set to: [" & DimPointAngularObj.DecimalSeparator & "]"
End Sub

 

   Comments?