.NET

Reply
Active Contributor
dancalgary
Posts: 46
Registered: ‎05-18-2007
Message 1 of 6 (787 Views)

how to set a global coordinate system

787 Views, 5 Replies
10-22-2009 02:15 PM

The following code works for querying the global coordinate system of a drawing


Dim Current1 As Autodesk.Gis.Map.MapApplication

Current1 = Autodesk.Gis.Map.HostMapApplicationServices.Application

Dim Proiect1 As Autodesk.Gis.Map.Project.ProjectModel

Proiect1 = Current1.ActiveProject

MsgBox(Proiect1.Projection.ToString)


The following line of code doesn't work

Proiect1.Projection = "UTM83-12"


On vb.net gives this: "Exception of type ‘Autodesk.Gis.Map.MapException was thrown."

In Autocad gives this error: "Cannot save projection code to the drawing"


The error log is:


<?xml version="1.0" ?>

- <Map3dErrorLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AcMap3dErrorLog.xsd">

- <Session user="dpopescu" start="10/22/2009 7:22:56 AM" document="Drawing1.dwg">

<Error code="1" type="2" dispensation="1" sId="2" occurrence="1">Cannot save projection code to the drawing.</Error>

</Session>

</Map3dErrorLog>

*Tony Tanzillo
Message 2 of 6 (787 Views)

Re: how to set a global coordinate system

10-22-2009 03:43 PM in reply to: dancalgary
What's the type of the Projection property? A string?

I'm asking because you're calling .ToString() on its value, which would
imply that it's not already a string.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6276574@discussion.autodesk.com...
The following code works for querying the global coordinate system of a
drawing



Dim Current1 As Autodesk.Gis.Map.MapApplication

Current1 = Autodesk.Gis.Map.HostMapApplicationServices.Application

Dim Proiect1 As Autodesk.Gis.Map.Project.ProjectModel

Proiect1 = Current1.ActiveProject

MsgBox(Proiect1.Projection.ToString)



The following line of code doesn't work

Proiect1.Projection = "UTM83-12"



On vb.net gives this: "Exception of type 'Autodesk.Gis.Map.MapException was
thrown."

In Autocad gives this error: "Cannot save projection code to the drawing"



The error log is:





-
xsi:noNamespaceSchemaLocation="AcMap3dErrorLog.xsd">

-
document="Drawing1.dwg">

Cannot save
projection code to the drawing.




Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 3 of 6 (787 Views)

Re: how to set a global coordinate system

10-22-2009 10:55 PM in reply to: dancalgary
This works for me.

HostMapApplicationServices.Application.ActiveProject.Projection = "LL84"
Active Contributor
dancalgary
Posts: 46
Registered: ‎05-18-2007
Message 4 of 6 (787 Views)

Re: how to set a global coordinate system

10-23-2009 05:51 AM in reply to: dancalgary
I have used exactly what you write and doesn't work.
Gives me the same error.
Active Contributor
dancalgary
Posts: 46
Registered: ‎05-18-2007
Message 5 of 6 (787 Views)

Re: how to set a global coordinate system

10-23-2009 05:52 AM in reply to: dancalgary
Yes its a string. My mistake
Valued Mentor
fieldguy
Posts: 379
Registered: ‎03-31-2005
Message 6 of 6 (316 Views)

Re: how to set a global coordinate system

05-23-2012 08:15 AM in reply to: dancalgary

This requires a document lock if you use document manager to open a dwg.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!