DBText and Dimension text entities are mirrored

DBText and Dimension text entities are mirrored

Anonymous
Not applicable
1,832 Views
5 Replies
Message 1 of 6

DBText and Dimension text entities are mirrored

Anonymous
Not applicable
Hi,

I am using the function listed below for mirroring a collection of entities. I don't want the DBText entities and the Dimension texts to be mirrored. But they are always mirrored, even after setting the system variable 'MirrorText' to 0. Please somebody let me know what I am doing wrong.

I am using AutoCAD 2007 and Visual Studio 2005.

Public Shared Sub MirrorVertically(ByVal ObjIds As ArrayList, ByVal MirrorPt As Point3d, ByVal Delete As Boolean)
Dim Doc As Document = Acad.DocumentManager.MdiActiveDocument
Dim DB As Database = Doc.Database
Dim ED As Editor = Doc.Editor
Dim TR As Transaction = Doc.TransactionManager.StartTransaction()
Dim BT As BlockTable = CType(TR.GetObject(DB.BlockTableId, OpenMode.ForRead), BlockTable)
Dim BTR As BlockTableRecord

Try
BTR = CType(TR.GetObject(BT(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
For Each objId As ObjectId In ObjIds
Dim obj As Object = TR.GetObject(objId, OpenMode.ForWrite)
Dim ent As Entity = CType(obj, Entity)
Dim MirrorLine As New Line3d(MirrorPt, New Point3d(MirrorPt.X, MirrorPt.Y + 10, MirrorPt.Z))
Dim MirrorMatrix As Matrix3d = Matrix3d.Mirroring(MirrorLine)
If Delete Then
ent.TransformBy(MirrorMatrix)
Else
Dim ent1 As Entity = ent.Clone
ent1.TransformBy(MirrorMatrix)
BTR.AppendEntity(ent1)
TR.AddNewlyCreatedDBObject(ent1, True)
End If
Next
TR.Commit()
Catch ex As Autodesk.AutoCAD.Runtime.Exception
MsgBox(ex.Message)
Finally
TR.Dispose()
End Try
End Sub


Thanks,
Bala
0 Likes
1,833 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
This is sort of a long way around the problem, but you can check if the DBObject is of type DBText - if it is, set DBText.IsMirroredInX and DBText.IsMirroredInY accordingly.
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks for your reply. It solves the DBText problem.
Any method for Dimension entities? The text in dimensions are also mirrored.
0 Likes
Message 4 of 6

Anonymous
Not applicable
Any help regarding the dimension text mirror problem will be very much appreciated.
0 Likes
Message 5 of 6

Anonymous
Not applicable

I've had this problem too. The answer is that you save the normal of the dimension before the mirror, then set it back to the former value after the mirror e.g.:

 

Dim Norm as Vector3d

Norm = myDim.Normal

 

'(do the mirroring here)

 

myDim.Normal = Norm

 

This worked nicely for me.

 

Jacqui

0 Likes
Message 6 of 6

Anonymous
Not applicable

Thanks a lot. It works now.

0 Likes