GradientColor1 Example

Using Programming Languages other than VBA

Sub Example_GradientColor1()
	' This example changes the value of the GradientColor1 property.

	Dim hatchObj As AcadHatch
	Dim patternName As String
	Dim PatternType As Long
	Dim bAssociativity As Boolean

	' Define the hatch
	patternName = "CYLINDER"
	PatternType = acPreDefinedGradient '0
	bAssociativity = True

	' Create the associative Hatch object in model space
	Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
	Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor, newColor As AcadAcCmColor
	Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
	Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
	Set newColor = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
	Call col1.SetRGB(255, 0, 0)
	Call col2.SetRGB(0, 255, 0)
	Call newColor.SetRGB(0, 100, 0)
	hatchObj.GradientColor1 = col1
	hatchObj.GradientColor2 = col2

	' Create the outer boundary for the hatch (a circle)
	Dim outerLoop(0 To 0) As AcadEntity
	Dim center(0 To 2) As Double
	Dim radius As Double
	center(0) = 3: center(1) = 3: center(2) = 0
	radius = 1
	Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

	' Append the outerboundary to the hatch object, and display the hatch
	hatchObj.AppendOuterLoop (outerLoop)
	hatchObj.Evaluate
	ThisDrawing.Regen True
	MsgBox "Initial value of GradientColor1 is :" & vbCrLf & _
					"red = " & hatchObj.GradientColor1.Red & vbCrLf & _
					"green = " & hatchObj.GradientColor1.Green & vbCrLf & _
					"blue = " & hatchObj.GradientColor1.Blue

	hatchObj.GradientColor1 = newColor
	MsgBox "New value of GradientColor1 is :" & vbCrLf & _
					"red = " & hatchObj.GradientColor1.Red & vbCrLf & _
					"green = " & hatchObj.GradientColor1.Green & vbCrLf & _
					"blue = " & hatchObj.GradientColor1.Blue
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.