TheSwamp

Code Red => .NET => Topic started by: sigster on February 14, 2023, 05:47:30 AM

Title: Rotate Object ObjectIdCollection
Post by: sigster on February 14, 2023, 05:47:30 AM

Hi

in my Drawing I am try to rotate Entity sample Text, Mtext,block

it don't work I was hoping to in this sample Mtext get new location and the polyline another location

see picture what I am try to do

Code: [Select]
          Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = doc.Editor
            Dim db As Database = doc.Database
            Dim tr As Transaction = doc.TransactionManager.StartTransaction()
            Dim pr As PromptResult = ed.GetString(vbLf & "Enter name of layer: ")
            Dim curUCSMatrix As Matrix3d = doc.Editor.CurrentUserCoordinateSystem
            Dim curUCS As CoordinateSystem3d = curUCSMatrix.CoordinateSystem3d

            If pr.Status = PromptStatus.OK Then
                Dim ents As ObjectIdCollection = GetEntitiesOnLayer(pr.StringResult)

                Using tr
                    Dim space As BlockTableRecord = DirectCast(tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead), BlockTableRecord)
                    For Each id As ObjectId In space
                        ents.Add(id)
                    Next

                    For i As Integer = 0 To ents.Count - 1
                        Dim ent As Entity = TryCast(tr.GetObject(ents(i), OpenMode.ForWrite), Entity)
                        ent.TransformBy(Matrix3d.Rotation(0.7854, curUCS.Zaxis, Point3d.Origin))
                    Next
                    tr.Commit()
                End Using





Regards
Sigster