Height プロパティ(ActiveX)

オブジェクトの高さを変更します。

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

構文と要素

VBA:

object.Height
object

タイプ: ApplicationAttributeAttributeReferenceDgnUnderlayDwfUnderlayExtrudedSurfaceGeomapImageHelixMTextOLEPdfUnderlayPointCloudPViewportRasterImageShapeTableTextTextStyleToolbarViewViewportWipeout

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

プロパティの値

読み込み専用: いいえ(GeomapImageRasterImage、および Toolbar オブジェクトを除く。これらのオブジェクトの場合は読み込み専用)

タイプ: 倍精度浮動小数点数型(整数タイプのアプリケーションおよびツールバーオブジェクトを除く)

この値は負ではなく必ず正でなければなりません。

注意

Application: メイン アプリケーション ウィンドウの高さ(ピクセル単位)。

GeoPositionMarker、MText、Text: 大文字の高さ。高さは現在の単位で計測されます。Height プロパティは、文字の高さと幅の両方の尺度として使用されます。



GeomapImage、RasterImage: ラスター イメージの高さ(ピクセル単位)。

Viewport: ビューポートの高さは、ビューポート フレームの Y 軸方向の長さです。

View: ビューの高さは、モデルの表示に使用されているビューポート内の領域の Y 軸方向の長さです。

例 - Text

VBA:

Sub Example_Height()
    ' This example creates a text object in model space.
    ' It then changes the height of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
    
    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5
    
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The text height is " & textObj.height, vbInformation, "Height Example"
    
    ' Change the value of the Height to 1
    textObj.height = 1
    textObj.Update
    MsgBox "The text height is set to " & textObj.height, vbInformation, "Height Example"
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Height()
    ;; This example creates a text object in model space.
    ;; It then changes the height of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 3 3 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)
    (vla-Update textObj)
    (alert (strcat "The text height is " (rtos (vla-get-height textObj) 2)))
    
    ;; Change the value of the Height to 1
    (vla-put-height textObj 1)
    (vla-Update textObj)
    (alert (strcat "The text height is set to " (rtos (vla-get-height textObj) 2)))
)

例 - ExtrudedSurface

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption
    
    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption
    
    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption
    
    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption
    
    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption
    
    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )      
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")
  
    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))
  
    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)


(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted) 

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)  
  
    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)  

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)