CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

显示旋转属性 (ActiveX)

2023-1-3 06:12| 发布者: admin| 查看: 188| 评论: 0|来自: AutoCAD

摘要: 确定地理地图图像、光栅图像或擦除是否以其旋转值显示。

确定地理地图图像、光栅图像或擦除是否以其旋转值显示。

支持的平台:仅窗口

签名

工 务 局:

object.ShowRotation
对象

类型:地理地图图像,栅格图像擦除

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:以存储在“旋转”属性中的旋转值显示光栅图像。
  • False:不以存储在“旋转”属性中的旋转值显示光栅图像。

言论

没有额外的评论。

例子

工 务 局:

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

Visual LISP:

(vl-load-com)
(defun c: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
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.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.
    
    ;; Define Raster object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotationAngle 0)
    
    ;; Loads a raster image into model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))
        
            ;; Limit the raster image rotations to 90 degrees
            (vla-put-ShowRotation rasterObj :vlax-true)
    
            ;; Rotate the raster image 180 degrees
            (vla-Rotate rasterObj insertionPoint 180)
            (vla-ZoomExtents acadObj)
        )
        (alert (strcat imageName " could not be found."))
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 17:09

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部