.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DBText and Dimension text entities are mirrored

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
1642 Views, 5 Replies

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

DBText and Dimension text entities are mirrored

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
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

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

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.
Message 3 of 6
Anonymous
in reply to: Anonymous

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

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

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

Any help regarding the dimension text mirror problem will be very much appreciated.
Message 5 of 6
Anonymous
in reply to: Anonymous

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

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

Message 6 of 6
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

Thanks a lot. It works now.

0 Likes

Thanks a lot. It works now.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report