XVector Example

Using Programming Languages other than VBA

Sub Example_XVector()
	' This finds the current setting of XVector for a given UCS.
	' It then changes the XVector and resets the UCS.

	Dim viewportObj As AcadViewport

	' Set the viewportObj variable to the activeviewport
	Set viewportObj = ThisDrawing.ActiveViewport

	' Define a new UCS and turn on the UCS icon at the origin.
	Dim ucsObj As AcadUCS
	Dim origin(0 To 2) As Double
	Dim xAxisPoint(0 To 2) As Double
	Dim yAxisPoint(0 To 2) As Double

	origin(0) = 2: origin(1) = 2: origin(2) = 0
	xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
	yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0

	Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
	ThisDrawing.ActiveUCS = ucsObj
	viewportObj.UCSIconOn = True
	viewportObj.UCSIconAtOrigin = True
	ThisDrawing.ActiveViewport = viewportObj

	' Display the current setting of the XVector
	MsgBox "The current XVector is: " _
			& ucsObj.XVector(0) & ", " & ucsObj.XVector(1) & ", " & ucsObj.XVector(2) & vbCrLf _
			& "The current YVector is: " _
			& ucsObj.YVector(0) & ", " & ucsObj.YVector(1) & ", " & ucsObj.YVector(2), , "XVector Example"

	' Change the setting of XVector
	Dim newVector(0 To 2) As Double
	newVector(0) = 1: newVector(1) = 1: newVector(2) = 0
	ucsObj.XVector = newVector

	' Reset the active UCS to see the change
	ThisDrawing.ActiveUCS = ucsObj

	MsgBox "The new XVector is: " _
			& ucsObj.XVector(0) & ", " & ucsObj.XVector(1) & ", " & ucsObj.XVector(2) & vbCrLf _
			& "The YVector is: " _
			& ucsObj.YVector(0) & ", " & ucsObj.YVector(1) & ", " & ucsObj.YVector(2), , "XVector 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.