Hi
I use this code to Transform Cordinate System
How can I Transform all object in open drawing just loop through all object and Transform
<CommandMethod("CONVERT_TO")> _
Sub Convert_to()
Dim path_File As String = OpenFile()
If (path_File = "") Then
Exit Sub
Else
Dim editor As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim Attach_file As String = path_File
Dim Project_M As ProjectModel = HostMapApplicationServices.Application.ActiveProject
Project_M.Options.MarkObjectsForEditingWithoutPrompting = True
Dim keywordOptions = New PromptKeywordOptions(vbLf & "Select [LL84/ISN93]: ", "LL84 ISN93")
keywordOptions.Keywords.[Default] = "ISN93"
Dim keywordResult As PromptResult = editor.GetKeywords(keywordOptions)
If keywordResult.Status = PromptStatus.OK Then
If keywordResult.StringResult = "LL84" Then
Project_M.Projection = "LL84"
End If
ElseIf keywordResult.StringResult = "ISN93" Then
Project_M.Projection = "ISN93.IcelandGrid"
End If
Dim dwgset As DrawingSet = Project_M.DrawingSet
dwgset.AttachDrawing(Attach_file)
Dim Query_Model As QueryModel = Project_M.CurQuery
Query_Model.Mode = QueryType.QueryDraw
Query_Model.Clear()
Dim qryRoot As QueryBranch = QueryBranch.Create()
Dim locationcondition As New LocationCondition()
locationcondition.LocationType = Autodesk.Gis.Map.Constants.LocationType.LocationCrossing
locationcondition.Boundary = AllBoundary.Create()
qryRoot.AppendOperand(locationcondition)
Query_Model.Define(qryRoot)
Dim queriedobjids As ObjectIdCollection = Query_Model.Execute(dwgset)
Query_Model.Clear()
dwgset.DetachDrawing(Attach_file)
Dim acadApp As Object = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
acadApp.ZoomExtents()
End If
End Sub
Public Function OpenFile() As String
Dim strFileName = ""
Dim fileDialogBox As New OpenFileDialog()
fileDialogBox.Filter = "Autocad Drawing|*.dwg"
fileDialogBox.FilterIndex = 3
fileDialogBox.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
If (fileDialogBox.ShowDialog() = DialogResult.OK) Then
strFileName = fileDialogBox.FileName
End If
Return strFileName
End Function