AutoCAD Map 3D Forum
Welcome to Autodesk’s AutoCAD Map 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error setting projection in map project...

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
276 Views, 3 Replies

Error setting projection in map project...

Any ideas on why this code produces an error? How do I change a
project's projection?

version AutoCad Map 2000i

Option Explicit
Global Acad As AcadApplication
Global acMap As AutocadMAP.AcadMap
Global MapProj As AutocadMAP.Project

Public Sub SetProjection()
' access project object and attach drawing
Set Acad = ThisDrawing.Application
Set acMap = Acad.GetInterfaceObject("AutoCADMap.Application")
Set MapProj = acMap.Projects(ThisDrawing)

' attempt to set current projection to NAD83 LatLong
MapProj.CurrentProjection = "LL83"
'the set of this property produces an error.
'error = Method CurrentProjection of object Project failed
end sub
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

I am having eactly the same problem as Keath. Has anyone answered this
question? Is it not just a simple property that can be set or is there more
to it? It is quite easy to return the currentprojection property, but I
just cannot find anyway to set it.

Any ideas would be greatly appreciated.

Cheers,
Scott

"Keath E Long" wrote in message
news:3B7BEDCC.E51A158D@lvvwd.com...
> Any ideas on why this code produces an error? How do I change a
> project's projection?
>
> version AutoCad Map 2000i
>
> Option Explicit
> Global Acad As AcadApplication
> Global acMap As AutocadMAP.AcadMap
> Global MapProj As AutocadMAP.Project
>
> Public Sub SetProjection()
> ' access project object and attach drawing
> Set Acad = ThisDrawing.Application
> Set acMap = Acad.GetInterfaceObject("AutoCADMap.Application")
> Set MapProj = acMap.Projects(ThisDrawing)
>
> ' attempt to set current projection to NAD83 LatLong
> MapProj.CurrentProjection = "LL83"
> 'the set of this property produces an error.
> 'error = Method CurrentProjection of object Project failed
> end sub
>
>
Message 3 of 4
Anonymous
in reply to: Anonymous

I too, have encountered this - the only alternative I found was to use
SendCommand - But you can not trap errors with it - I would like to trap
1233 - dwgHasQueriedObject to let me know the coordsys can not be changed.

ThisDrawing.SendCommand ("cmddia" & vbCr & "0" & vbCr & "_adesetcrdsys" & _
vbCr & "s" & vbCr & "ll83" & vbCr & "x" & vbCr & "cmddia" & vbCr & "1" &
vbCr)

Hope This Helps,
Scott


"Scott Cifelli" wrote in message
news:6FA64D825F968E67DA5707F5DCCD0E54@in.WebX.maYIadrTaRb...
> I am having eactly the same problem as Keath. Has anyone answered this
> question? Is it not just a simple property that can be set or is there
more
> to it? It is quite easy to return the currentprojection property, but I
> just cannot find anyway to set it.
>
> Any ideas would be greatly appreciated.
>
> Cheers,
> Scott
>
> "Keath E Long" wrote in message
> news:3B7BEDCC.E51A158D@lvvwd.com...
> > Any ideas on why this code produces an error? How do I change a
> > project's projection?
> >
> > version AutoCad Map 2000i
> >
> > Option Explicit
> > Global Acad As AcadApplication
> > Global acMap As AutocadMAP.AcadMap
> > Global MapProj As AutocadMAP.Project
> >
> > Public Sub SetProjection()
> > ' access project object and attach drawing
> > Set Acad = ThisDrawing.Application
> > Set acMap = Acad.GetInterfaceObject("AutoCADMap.Application")
> > Set MapProj = acMap.Projects(ThisDrawing)
> >
> > ' attempt to set current projection to NAD83 LatLong
> > MapProj.CurrentProjection = "LL83"
> > 'the set of this property produces an error.
> > 'error = Method CurrentProjection of object Project failed
> > end sub
> >
> >
>
>
Message 4 of 4
Anonymous
in reply to: Anonymous

Thanks Scott! Although I too would like the error trapping capability, at
least this works and solves an immediate problem that I was having. I have
actually set up some trigger functionality for sending a _pline command via
the sendcommand method. It took a bit of work to get right as stopping the
trigger was a bit tricky, but ulitmately it works. You can just filter the
trigger (withevents procedure in a class module using the begincommand and
endcommand document events) by the command name and then do whatever is
required. I suspect you could do the same with the projection command as
well.

Cheers,
Scott

"Scott Friedrich" wrote in message
news:823166C19E23F9F9988876D58CE666C2@in.WebX.maYIadrTaRb...
> I too, have encountered this - the only alternative I found was to use
> SendCommand - But you can not trap errors with it - I would like to trap
> 1233 - dwgHasQueriedObject to let me know the coordsys can not be changed.
>
> ThisDrawing.SendCommand ("cmddia" & vbCr & "0" & vbCr & "_adesetcrdsys" &
_
> vbCr & "s" & vbCr & "ll83" & vbCr & "x" & vbCr & "cmddia" & vbCr & "1" &
> vbCr)
>
> Hope This Helps,
> Scott
>
>
> "Scott Cifelli" wrote in message
> news:6FA64D825F968E67DA5707F5DCCD0E54@in.WebX.maYIadrTaRb...
> > I am having eactly the same problem as Keath. Has anyone answered this
> > question? Is it not just a simple property that can be set or is there
> more
> > to it? It is quite easy to return the currentprojection property, but I
> > just cannot find anyway to set it.
> >
> > Any ideas would be greatly appreciated.
> >
> > Cheers,
> > Scott
> >
> > "Keath E Long" wrote in message
> > news:3B7BEDCC.E51A158D@lvvwd.com...
> > > Any ideas on why this code produces an error? How do I change a
> > > project's projection?
> > >
> > > version AutoCad Map 2000i
> > >
> > > Option Explicit
> > > Global Acad As AcadApplication
> > > Global acMap As AutocadMAP.AcadMap
> > > Global MapProj As AutocadMAP.Project
> > >
> > > Public Sub SetProjection()
> > > ' access project object and attach drawing
> > > Set Acad = ThisDrawing.Application
> > > Set acMap = Acad.GetInterfaceObject("AutoCADMap.Application")
> > > Set MapProj = acMap.Projects(ThisDrawing)
> > >
> > > ' attempt to set current projection to NAD83 LatLong
> > > MapProj.CurrentProjection = "LL83"
> > > 'the set of this property produces an error.
> > > 'error = Method CurrentProjection of object Project failed
> > > end sub
> > >
> > >
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost