Turns プロパティ(ActiveX)

らせんの回転数を指定します。

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

構文と要素

VBA:

object.Turns
object

タイプ: Helix

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

プロパティの値

読み込み専用: いいえ

タイプ: ACAD_NOUNITS

回転の数。

注意

追加の注意はありません。

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer
    
    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen
    
    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer
    
    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen
    
    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer
    
    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen
    
    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer
    
    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen
    
    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer
    
    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen
    
    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer
    
    AppActivate ThisDrawing.Application.Caption
    
    ssetObj.SelectOnScreen
    
    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)
    
    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)
    
    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)
    
    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
	        (if (= (vla-get-Twist helix) acCCW)
	            (vla-put-Twist helix acCW)
	            (vla-put-Twist helix acCCW)
	        )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)
    
    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)
    
    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)
    
    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)