ShowRotation Example |
Using Programming Languages other than VBA
Sub Example_ShowRotation() ' This example adds a raster image in model space and rotates the image. ' One rotation is done without angle limits, one is done with ShowRotation, ' which limits rotations to 90 degrees ' This example uses the "downtown.jpg" found in the sample ' directory. If you do not have this image, or it is located ' in a different directory, insert a valid path and file name ' for the imageName variable below. Dim insertionPoint(0 To 2) As Double Dim scalefactor As Double, rotationAngle As Double Dim imageName As String Dim rasterObj As AcadRasterImage imageName = "c:\Autocad\sample\downtown.jpg" ' Define Raster object insertionPoint(0) = 5: insertionPoint(1) = 5: insertionPoint(2) = 0 scalefactor = 1#: rotationAngle = 0 On Error GoTo ERRORTRAP ' Loads a raster image into model space Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle) ' Limit the raster image rotations to 90 degrees rasterObj.ShowRotation = True ' Rotate the raster image 180 degrees rasterObj.Rotate insertionPoint, 180 ThisDrawing.Application.ZoomAll Exit Sub ' If you get an error (most likely a problem with the file path), ' then display an error message
ERRORTRAP: If Err.Description <> "" Then MsgBox Err.Description End If End Sub
Comments? |