Community
Hey guys, what I am trying to do is 3DRotate a polyline to "stand it up."
I am using the TransformBy method to do this. The problem is, I put 90 degrees as the angle parameter (to rotate it 90 degrees and stand it up) but It is not rotating the full 90 degrees. Here is a picture of the outcome: http://snag.gy/wXNe6.jpg . As you can see, the piece is still a bit slanted, and not fully stood up.
Here is my code:
<CommandMethod("multirotate")> _ Public Shared Sub rectangles() Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Dim acEd As Editor = acDoc.Editor Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() Dim acBlkTbl As BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _ OpenMode.ForRead) Dim acBlkTblRec As BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _ OpenMode.ForWrite) Dim opts As New PromptEntityOptions(vbLf & "Select an entity :") opts.SetRejectMessage(vbLf & "Must be a Polyline...") opts.AddAllowedClass(GetType(Polyline), True) Dim res As PromptEntityResult = acEd.GetEntity(opts) MsgBox(acTrans.GetObject(res.ObjectId, OpenMode.ForRead).GetType().ToString()) Dim acBR As Polyline = acTrans.GetObject(res.ObjectId, OpenMode.ForWrite) Dim curUCSMatrix As Matrix3d = acDoc.Editor.CurrentUserCoordinateSystem Dim curUCS As CoordinateSystem3d = curUCSMatrix.CoordinateSystem3d acBR.TransformBy(Matrix3d.Rotation(90, curUCS.Yaxis, acBR.StartPoint)) acTrans.Commit() End Using End Sub