CustomScale プロパティ(ActiveX)

ビューポートのカスタム尺度を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.CustomScale
object

タイプ: PViewport

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 倍精度浮動小数点数型

ビューポートのカスタム尺度

注意

ビューポートをカスタム尺度に設定するには、まず StandardScale プロパティを acVpCustomScale に設定してから、このプロパティを使用してカスタム尺度を定義します。

VBA:

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)))
)