.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
DBText and Dimension text entities are mirrored
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
660 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
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)
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
Re: DBText and Dimension text entities are mirrored
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: DBText and Dimension text entities are mirrored
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Any method for Dimension entities? The text in dimensions are also mirrored.
Re: DBText and Dimension text entities are mirrored
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-20-2010 09:05 PM in reply to:
bala1201
Any help regarding the dimension text mirror problem will be very much appreciated.
Re: DBText and Dimension text entities are mirrored
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: DBText and Dimension text entities are mirrored
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-11-2010 02:47 AM in reply to:
bala1201
Thanks a lot. It works now.
