- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
I'm trying to write a routine to explode text but I've had some issues code is below.
The issue is that when I export/import the WMF I don't believe it's doing this on the mirrored entity.
I've tried many different ways but I can't seem to get the wmf import/export to work on the mirrored entity.
I was also wondering if there's a better way for me to create the line to mirror the entity right now the entity ends up very far from the original when I'd like it to be mirrored beside so I can mirror it back.
Thanks!
Public Shared Sub TextExplode(ent As Entity)
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Dim acadSel As AcadSelectionSet = Nothing
Try
' Open application and document
Dim acadApp As AcadApplication = Application.AcadApplication
Dim acadDoc As AcadDocument = acadApp.ActiveDocument
Application.SetSystemVariable("MIRRTEXT", 1)
' Mirror text
'ed.Command("MIRROR", ent.ObjectId, "", Point3d.Origin, "", New Point3d(0, 1, 0), "", "y", "")
Dim MirrorAxis As New Line3d(Point3d.Origin, New Point3d(0.0,
1.0,
0.0))
Dim transform As Matrix3d = Matrix3d.Mirroring(MirrorAxis)
ent.TransformBy(transform)
Dim insPoint As Point3d = Point3d.Origin
If TypeOf ent Is DBText Then
Dim parent As DBText = CType(ent, DBText)
insPoint = parent.Position
ElseIf TypeOf ent Is MText Then
Dim parent As MText = CType(ent, MText)
insPoint = parent.Location
ElseIf TypeOf ent Is BlockReference Then
Dim parent As BlockReference = CType(ent, BlockReference)
insPoint = parent.Position
End If
' Create entity array
Dim acadEnt(0) As AcadEntity
acadEnt(0) = CType(ent.AcadObject, AcadEntity)
' Create selection set with entity
acadSel = acadDoc.SelectionSets.Add("SS1")
acadSel.AddItems(acadEnt)
' Export to WMF
Dim tempPath As String = String.Concat(IO.Path.GetTempPath(), "txtexp")
acadDoc.Export(tempPath, "WMF", acadSel)
' Import WMF
Dim pt As Double() = New Double() {insPoint.X, insPoint.Y, insPoint.Z}
acadDoc.Import(String.Concat(System.IO.Path.GetTempPath(), "txtexp.wmf"), CType(pt, Object), 1.0)
Catch ex As Exception
ReportError(ex)
Finally
If acadSel IsNot Nothing Then acadSel.Delete()
End Try
End Sub
Solved! Go to Solution.
Link copied