Helix Example |
Using Programming Languages other than VBA
Sub Example_Helix_BaseRadius() Dim ssetObj As AcadSelectionSet Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX") Dim mode As Integer 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 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 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 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 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 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
Comments? |