Support

As evidenced by over 30 years of development history, trust-worthy Korean CAD, CADian!

FAQ · 2013.12.11
CADian VBA Sample Code - 11 [ Rotate ]
Rotates an object around a base point.

Signature
object.Rotate BasePoint, RotationAngle

Object
All Drawing Objects, AttributeReference
The object this method applies to.

BasePoint
Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying the point through which the axis of rotation is defined as parallel to the Z axis of the UCS.

RotationAngle
Double; input-only
The angle in radians to rotate the object. This angle determines how far an object rotates around the base point relative to its current location.


""**********************************************
""* Example 1
"" Create the line
Dim myDoc As IntelliCAD.Document
Dim myLine As IntelliCAD.Line
Dim myStartPt As IntelliCAD.Point
Dim myEndPt As IntelliCAD.Point
Set myDoc = Application.ActiveDocument
Set myStartPt = Library.CreatePoint(4, 4)
Set myEndPt = Library.CreatePoint(7, 3)
Set myLine = myDoc.ModelSpace.AddLine(myStartPt, myEndPt)
myLine.Update

"" Copy and rotate the line
Dim copymyLine As IntelliCAD.Line
Set copymyLine = myLine.Copy()
copymyLine.Rotate myStartPt, 10
MsgBox "Rotated the copied line 10 radians."
ThisDocument.ActiveViewport.ZoomExtents


""**********************************************
""* Example 2
Dim icadDoc As IntelliCAD.Document
Dim myText As String
Dim textObj As IntelliCAD.Text
Dim insPt As IntelliCAD.Point
Dim height As Double
Dim NewRotation As Double

Set icadDoc = ActiveDocument
Set insPt = Library.CreatePoint(0, 9)

height = 5
myText = "Test string for the AddText method"

"" Add the Text object
Set textObj = icadDoc.ModelSpace.AddText(myText, insPt, height)
textObj.Update

ThisDocument.ActiveViewport.ZoomExtents

MsgBox "Rotation: " & textObj.Rotation
NewRotation = InputBox("Type a rotation (in radians):")

textObj.Rotation = NewRotation
textObj.Update
ThisDocument.ActiveViewport.ZoomExtents

Added to cart.

VIEW CART

Please sign in first.

JOIN