I would like to use VBA to set the coordinate system - specifically "LA83-SF-MOD" (NAD 83 Louisiana State Plane, Southern Zone, US Survey Foot).
Does anyone know how to do this?
Thanks very much,
Kevin
It can be done quite eazily in VBA, where you need to set reference to "AutoCAD Map 3D 2005" (AcMapVbApi.tlb), by going to menu "Tools->Refernces...". Do not be confused by "....2005", though, because the AutoCAD Map COM API has been "frozen" since AutoCAD Map 2005, thus the name of Map COM API refering "...2005".
After setting the reference to Map's COM API library, following simple code will do what you need:
Public Sub SetProjection() Dim acMap As AutocadMAP.AcadMap Set acMap = _ Application.GetInterfaceObject("AutoCADMap.Application") Dim proj As AutocadMAP.Project Set proj = acMap.Projects(ThisDrawing) MsgBox "Current projection: " & _ IIf(proj.CurrentProjection = "", _ "not set", proj.CurrentProjection) proj.CurrentProjection = "LA83-SF-MOD" MsgBox "Current projection has been set to: " & _ proj.CurrentProjection End Sub
By the way, I run this code OK with AutoCAD Map 2015/Civil 2015.
HTH
Norman Yuan
Thanks! I will give that a shot. I am really using Civil 3D (as I see you are), but did not see a Developer's forum under that product. This will be a BIG help because I WAS passing along the GEOREMOVE command from VBA, which worked, but because of a glitch in 2016, I have discovered in the forums that you cannot issue more than one COMMAND from VBA without getting a VBA error. Si I had to put message boxes in the code for the user to do that first before proceeding.
Now that I can use VBA to get out of State Plane and back in, I can totally automate my procedure. (BTW, for some reason the GEOTIFFs that our local government provides will not come in correctly unless we ermove the coordinate system first.)
Thanks for helping out!
Can't find what you're looking for? Ask the community or share your knowledge.