.NET

Reply
Contributor
bala1201
Posts: 12
Registered: ‎06-05-2009
Message 1 of 6 (765 Views)

DBText and Dimension text entities are mirrored

765 Views, 5 Replies
04-11-2010 11:58 PM
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
Active Contributor
fyathyrio8
Posts: 34
Registered: ‎02-11-2010
Message 2 of 6 (765 Views)

Re: DBText and Dimension text entities are mirrored

04-12-2010 07:00 AM in reply to: bala1201
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.
Contributor
bala1201
Posts: 12
Registered: ‎06-05-2009
Message 3 of 6 (764 Views)

Re: DBText and Dimension text entities are mirrored

04-13-2010 05:01 AM in reply to: bala1201
Thanks for your reply. It solves the DBText problem.
Any method for Dimension entities? The text in dimensions are also mirrored.
Contributor
bala1201
Posts: 12
Registered: ‎06-05-2009
Message 4 of 6 (765 Views)

Re: DBText and Dimension text entities are mirrored

04-20-2010 09:05 PM in reply to: bala1201
Any help regarding the dimension text mirror problem will be very much appreciated.
New Member
HillJ
Posts: 2
Registered: ‎05-30-2010
Message 5 of 6 (764 Views)

Re: DBText and Dimension text entities are mirrored

06-06-2010 11:54 PM in reply to: bala1201

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

Contributor
bala1201
Posts: 12
Registered: ‎06-05-2009
Message 6 of 6 (748 Views)

Re: DBText and Dimension text entities are mirrored

06-11-2010 02:47 AM in reply to: bala1201

Thanks a lot. It works now.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community