SetVariable Example

Using Programming Languages other than VBA

Sub Example_SetVariable()
	' This example sets various system variables, each of
	' a different data type.

	Dim sysVarName As String
	Dim sysVarData As Variant
	Dim DataType As Integer

	' Set FILEDIA system variable (data type Integer) to 1. NOTE that
	' you need to declare a variable as the data type of system variable,
	' assign data to that variable and then make it variant type
	Dim intData As Integer
	sysVarName = "FILEDIA"
	intData = 1
	sysVarData = intData	' Integer data
	ThisDrawing.SetVariable sysVarName, sysVarData

	' Check the variable using GetVariable
	sysVarData = ThisDrawing.GetVariable(sysVarName)
	MsgBox sysVarName & " = " & sysVarData, , "SetVariable Example"

	' Set DCTCUST system variable (data type String) to "My Custom Dictionary"
	Dim strData As String
	sysVarName = "DCTCUST"
	strData = "My Custom Dictionary"
	sysVarData = strData		' String data
	ThisDrawing.SetVariable sysVarName, sysVarData

	' Check the variable using GetVariable
	sysVarData = ThisDrawing.GetVariable(sysVarName)
	MsgBox sysVarName & " = " & sysVarData, , "SetVariable Example"
   
	' Set CHAMFERA system variable (data type Double) to 1.5
	Dim dataDouble As Double
	sysVarName = "CHAMFERA"
	dataDouble = 1.5
	sysVarData = dataDouble ' Double data
	ThisDrawing.SetVariable sysVarName, sysVarData
	' Check the variable using GetVariable
	sysVarData = ThisDrawing.GetVariable(sysVarName)
	MsgBox sysVarName & " = " & sysVarData, , "SetVariable Example"
   
	' Set INSBASE system variable (data type array) to (1.0,1.0,0)
	Dim arrayData3D(0 To 2) As Double
	sysVarName = "INSBASE"
	arrayData3D(0) = 1#: arrayData3D(1) = 1#: arrayData3D(2) = 0
	sysVarData = arrayData3D	' 3D array data
	ThisDrawing.SetVariable sysVarName, sysVarData
	' Check the variable using GetVariable
	sysVarData = ThisDrawing.GetVariable(sysVarName)
	MsgBox sysVarName & " = " & sysVarData(0) & ", " & sysVarData(1) & ", " & sysVarData(2), , "SetVariable 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.