MAPIMPORT with IPF

MAPIMPORT with IPF

odoshi
Collaborator Collaborator
2,581 Views
10 Replies
Message 1 of 11

MAPIMPORT with IPF

odoshi
Collaborator
Collaborator

Hello,

 

I would like to script the MAPIMPORT command using an IPF file. I do not see a prompt for this using -MAPIMPORT. Is there an equivalent way through LISP, SCR, VBA or .NET?

 

Using Map 2011.

 

Thank you,

Mike

Mike Caruso
Autodesk Certified Instructor 2014
AutoCAD/Civil 3D Autodesk Certified Professional 2014, 2015, 2018
www.whitemountaincad.com
0 Likes
2,582 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

Hi Mike,


Pl check the following link where I showed 'how to use command line version of -mapexport for exporting to SHP file'. This will give you clue on how to use the same in Import.

 

http://adndevblog.typepad.com/infrastructure/2012/03/how-to-use-command-line-version-of-mapexport-fo...

 

You could also use Autodesk.Gis.Map.ImportExport API to Import and Export various types of data in Map 3D. In AutoCAD Map 3D SDK (download) you will see a sample "ImportExport" in C++ as well as .NET (C# & VB.NET).


Hope this helps.

0 Likes
Message 3 of 11

Anonymous
Not applicable

Hi,


I'm in need of using VB.net to import (like mapimport) a GML file.  It has to be automated by our script.  I've looked all over for information on the API for this, and indeed downloaded the Autodesk.Gis.Map.ImportExport API.  However in the ImportExport there is only a C++ example, there is not any VB code or documentation at all.  Unless I'm totally looking in the wrong location!  I've downloaded both the 2016 and 2014 versions.

 

Can anyone send me in the right direction for examples, even the API Documentation for VB.net would be greatly appreciated for ImportExport functionality.  I'm finding PDF files with just table of contents in them, and no documentation. 

 

Thanks


Tara

0 Likes
Message 4 of 11

norman.yuan
Mentor
Mentor

<Quote>

.. indeed downloaded the Autodesk.Gis.Map.ImportExport API...

</Quote>

 

How could you download this API separately?

 

To use managed (.NET) APIs in Autodesk.Gis.Map.ImportExport namespace, you do not need to download anything. It is in the .NET assembly ManagedMapApi.dll, coming with AutoCAD Map/Civil installation. You siimply start a C#/VB.NET DLL project and set refernce to this DLL (Copy Local is set to False), then off you go.

 

If you need .NET code sample of map Importing/Exporting, you can download MAP ObjectARX SDK (not vanilla AutoCAD ObjectARX SDK!), which will bring you a set of .NET code samples of using Map ObjectARX .NET APIs.

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 11

Anonymous
Not applicable

Thank you for your comments.

 

The entry above mine is from AutoDesk and has a link where to download them to see samples:

"You could also use Autodesk.Gis.Map.ImportExport API to Import and Export various types of data in Map 3D. In AutoCAD Map 3D SDK (download) you will see a sample "ImportExport" in C++ as well as .NET (C# & VB.NET)."

 

There is samples in C++ not in VB.net.  So I was just wondering where these 'samples' of ImportExport are in .NET.   I do know that the DLL just needs to be loaded (I have it loaded :)) but it would be nice to see an example to see what steps need to be done in order to import this file.  Or at least documenation so I can see what the different attributes are that need to be set or passed in etc. 

Thank you.

 

0 Likes
Message 6 of 11

Anonymous
Not applicable

And re-reading I see that the link they provided were the generic API, so that is what I'm missing 😉  So, I will find the MAP API download.  Thank you, hope this gets me to the right area.

0 Likes
Message 7 of 11

norman.yuan
Mentor
Mentor
Message 8 of 11

Anonymous
Not applicable

Ok, I did indeed download the MAP version previously, and just redownloaded with the link you sent.  Unzip it, and there is only C++ files in there.  Am I looking in the wrong place?  See my screenshot attachment...  Maybe this is as good as it gets, and hopefully can find some documenation on how the VB stuff is supposed to work....  Thanks for trying to help.

0 Likes
Message 9 of 11

norman.yuan
Mentor
Mentor

Well, if you looked into the folder "Map Samples" CAREFULLY, you should have noticed a folder named "DotNet", which contains all .NET API sample projects in C#, VB.NET or managed C++.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 10 of 11

Anonymous
Not applicable

Oh my WORD!  You are my hero.  I was looking in there, under the ImportExport directory!  I would have never looked for the subdir DotNet.  Totally see it now.   I cannot believe it has been staring me in the eyes without me noticing.  Some days need fresh eyes.  THANK YOU THANK YOU THANK YOU.  Very much appreciate it.

0 Likes
Message 11 of 11

Anonymous
Not applicable

Hi there,

 

I'm using *.IPFs in lisp for years. quite simple.

 

(command "-MAPIMPORT" "SHP" SHP-file-name "YES" IPF-file-name "PROCEED")

 

I guess from VBA it will be something like

 

sendCommand "-MAPIMPORT", "SHP", SHP-file-name, "YES", IPF-file-name, "PROCEED"

 

You can also edit IPF. For example I exchange this line in IPF with real coordinates

 

;;; <XMin>xMinCoord</XMin><YMin>yMinCoord</YMin><XMax>xMaxCoord</XMax><YMax>yMaxCoord</YMax>

;;; read source IPF

(setq f (open ipfFile "r"))
(setq text (read-line f))
(close f)

 

;;; replace text

  (setq text (vl-string-subst xMin "xMinCoord" text))
  (setq text (vl-string-subst yMin "yMinCoord" text))
  (setq text (vl-string-subst xMax "xMaxCoord" text))
  (setq text (vl-string-subst yMax "yMaxCoord" text))


;;; make temp IPF
  (setq ipfTemp "C:\\Temp\\temp.ipf")
  (setq f (open ipfTemp "w"))
  (write-line text f)
  (close f)
  (command "-MAPIMPORT" "SHP" SHP-file "YES" ipfTemp "PROCEED")

 

 

In the same way you can change layer, object data, block name and so on.

 

0 Likes