You can also use Universal Translator.
You can run UT, or the FME Quick Translator, from a bat file.
I haven’t tried that with shape but below is an example I have used to convert to DWG:
'Translation is two stage process:
'(1) Generate Semantic mapping\Control file
'(2) Run Mapping file through translator (IMUT.exe)
'To Generate the mapping file:
If SystemInfo(SYS_INFO_MIVERSION) >= 1200 Then
sCmdExe = Chr$(34) & ProgramDirectory$()+ "UT\fme.exe" & Chr$(34)
Else
sCmdExe = Chr$(34) & ProgramDirectory$()+ "UT\IMUT.exe" & Chr$(34)
End If
If FileExists(FILEWindowsTempFolder() & "__UT__.bat") Then
Kill FILEWindowsTempFolder() & "__UT__.bat"
End If
If FileExists(FMEQTGetLogFileName()) Then
Kill FMEQTGetLogFileName()
End If
Open File FILEWindowsTempFolder() & "__UT__.bat"
For Append
As 234
CharSet "CodePage850" 'This will match the code page of the "dos prompt"
Print #234, sCmdExe
+ " CFGenerate"
+ " " + sInputFormat + " " + sDestFormat
+ " " + chr$(34) + sInputFile + chr$(34)
+ " " + chr$(34) + sMappingFile + chr$(34)
+ " LOG_STANDARDOUT " + sLogFileOut
+ " LOG_FILENAME " + Chr$(34) + sLogFileName + chr$(34)
+ " LOG_APPEND " + chr$(34) + sLogAppend + chr$(34)
+ " --Dest_ATTR " + chr$(34) + sDestAttr + chr$(34)
+ " --Dest_ATTRKIND " + chr$(34) + sDestATTRKIND + chr$(34)
+ " --Dest_REL " + chr$(34) + sDestReleaseVer + chr$(34)
Print #234, sCmdExe
+ " " + chr$(34) + sMappingFile + chr$(34)
+ " SourceDataset " + chr$(34) + sInputFile + chr$(34)
+ " --DestDataset " + Chr$(34) + sOutputFile + chr$(34)
+ " --_ATTRKIND " + sDestATTRKIND
+ " --_REL " + sDestReleaseVer
+ " --_EXTENSION " + sExtension
+ " --_BASENAME " + sBaseName
+ " --_FULLBASENAME " + sFullBaseName
+ " LOG_STANDARDOUT " + sLogFileOut
+ " LOG_FILENAME " + Chr$(34) + FMEQTGetLogFileName() + chr$(34)
Close File #234
If SYSExecuteAndWait(FILEWindowsTempFolder() & "__UT__.bat", SW_SHOWNORMAL) Then
End If
You can find the full source code for the export to DWG on Github in the file FMEQuickTranslatorLib.MB
Safe has documentation for the Command Line here: https://docs.safe.com/fme/2020.0/html/FME_CommandLine/
There’s also an old documentation for Universal Translator with documentation for the Command Line tool here: https://docplayer.net/21398922-Universal-translator-11-0-user-guide.html
Be aware that these days we don’t use IMUT.exe but FME.exe.
And that the UT documentation is for v11 so parameters might have changed.
It is easier with our new GDAL/OGR support as Bob mentioned earlier
From: mapi...@googlegroups.com <mapi...@googlegroups.com>
On Behalf Of Bob Fortin
Sent: 7. oktober 2021 19:56
To: MapInfo-L <mapi...@googlegroups.com>
Subject: [MI-L] Re: MapBasic export to Shapefile
This message originated Externally. Use proper judgement and caution with attachments, links, or responses. |
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mapinfo-l/09808f50-0361-48c6-beff-020b260e6b51n%40googlegroups.com.