Turns 属性 (ActiveX)
指定螺旋线的圈数。 支持的平台:仅限 Windows 属性值只读:不 类型: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 可视化 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) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 12:34
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.