CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

自定义缩放属性 (ActiveX)

2023-1-3 19:25| 发布者: admin| 查看: 485| 评论: 0|来自: AutoCAD

摘要: 指定视区的自定义比例因子。

指定视区的自定义比例因子。

支持的平台:仅窗口

签名

工 务 局:

object.CustomScale
对象

类型:光伏港

此属性适用的对象。

属性值

只读:

类型:

视区的自定义比例因子。

言论

若要将视区设置为自定义比例,请先将属性设置为 ,然后使用此属性定义自定义比例值。StandardScaleacVpCustomScale

例子

工 务 局:

Sub Example_CustomScale()
    ' This example adds a line in paper space, creates a new paper space viewport, and cycles through some common paper space custom scale sizes
    ' for the new paper space viewport
   
    Dim lineObj As AcadLine
    Dim PViewPort As AcadPViewport
    Dim startPoint(0 To 2) As Double, endPoint(0 To 2)  As Double
    Dim center(0 To 2) As Double
    Dim width As Double, height As Double
    
    ' Define the start and end points for the line
    startPoint(0) = 1: startPoint(1) = 1: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0
    
    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40: height = 40
    
    ' Create the line in paper space
    Set lineObj = ThisDrawing.PaperSpace.AddLine(startPoint, endPoint)
       
    ' Create the paper space viewport
    Set PViewPort = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
   
    ' Set the paper space viewport scale to custom 
    PViewPort.StandardScale = acVpCustomScale
    
    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace
    
    ' Read and display the existing paper space viewport scale setting
    MsgBox "The scale of the new PViewport is: " & PViewPort.CustomScale
    
    ' Change the custom scale setting to 1:10 scale
    PViewPort.CustomScale = 0.1
   
    ' Read and display the new paper space viewport scale setting
    MsgBox "The scale of the new PViewport has been changed to: " & PViewPort.CustomScale

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CustomScale()
    ;; This example adds a line in paper space, creates a new paper space viewport, and cycles through some common paper space custom scale sizes
    ;; for the new paper space viewport
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0)) 
    
    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)
    
    ;; Create the line in paper space
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq lineObj (vla-AddLine paperSpace startPoint endPoint))
       
    ;; Create the paper space viewport
    (setq PViewPort (vla-AddPViewport paperSpace center width height))
   
    ;; Set the paper space viewport scale to custom 
    (vla-put-StandardScale PViewPort acVpCustomScale)
    
    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)
    (vla-Regen doc acAllViewports)
    (vla-ZoomAll acadObj)
    
    ;; Read and display the existing paper space viewport scale setting
    (alert (strcat "The scale of the new PViewport is: " (rtos (vla-get-CustomScale PViewPort) 2)))
    
    ;; Change the custom scale setting to 1:10 scale
    (vla-put-CustomScale PViewPort 0.1)
   
    ;; Read and display the new paper space viewport scale setting
    (alert (strcat "The scale of the new PViewport has been changed to: " (rtos (vla-get-CustomScale PViewPort) 2)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 02:56

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部