I want to create a model in model builder that corresponds to an AML script. How?

1867
7
11-24-2016 05:33 AM
MichaelKennedy
New Contributor

This is the first step (of 2) in converting an AML to a Python script. It seems to me that by this time someone should have written such a converter and the process should be straight forward. But I can't find any evidence that such a converter exists. Finding such a converter is my first choice. Second choice is AML to ModelBuilder. Then ModelBuilder can create a Python script (a straightforward process).

0 Kudos
7 Replies
NeilAyres
MVP Alum

Have you run through the steps in the aml by hand first to see what are the equivalent modern tools to do this?

It is always important to get the workflow sorted out first, then try and automate it using model builder or python / arcpy.

0 Kudos
MichaelKennedy
New Contributor

Have you run through the steps in the aml by hand first [Yes. I wrote the AML years ago and it worked great.]

to see what are the equivalent modern tools to do this? [No. It seems to me this would be like beginning a conversion by hand.]

I confess I just want the process to work. Like high level language to assembler to binary. Regardless of the source language the object (binary) should be the same. My approach, admittedly confined to years of high level language programming, is to make a conversion and, if it doesn't work figure out why and fix it. The better the conversion process the less fixing requited. 

0 Kudos
NeilAyres
MVP Alum

Not sure what you are saying here.

Quite a few contributors here go back to the days of AML (myself included).

But most have moved on through the various ways of programmatically get Arc to do "stuff" that we have had to deal with over the years.

The "tools" or "commands" have changed quite a bit since then and now.

RebeccaStrauch__GISP
MVP Emeritus

Not all things will have a direct conversion to python, but these may help for things that do

Python equivalents to AML directives—Help | ArcGIS for Desktop 

Python equivalents to AML functions—Help | ArcGIS for Desktop 

Using AML with script tools—Help | ArcGIS for Desktop 

To my knowledge there has never been an automatic conversion process, but Python to me is the first esri option that is as easy and equally powerful as AML is/was.  Just like AML, if you can find the built-in command you can use is in your code.  Usually the help pages even show scripting samples, but if not, run the command and grab the snippet from the Results table and then just update it with the variable that you need.

You can also use a Model Builder to get you started, and convert it to a script to get you started. But I find the conversion adds a lot of overhead that is not needed (granted,  have not used this method in years), and in the long run I would suggest having it in a script.

I still have a few AMLs myself but most I have successfully converted using these steps.  Just like AML, I find python to be fun....that is, do a lot with not too much code (vs the ArcObject, C++, or any of the other options).  But that is just my opinion.

MichaelKennedy
New Contributor

Thanks, Rebecca. I'm guessing that you are right about the lack of a converter. It seems strange, given all the AML that must have been out there when Python first came along, and ESRI's resources. (I'm resisting the urge to jump into writing one, but that would be a waste of time at this late date.)

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

There was never any official convert from Avenue either. I had a 3rd party book once that had some "recipes" but in the long run, my scripts were to specific to get much out of the converter cookbook.

if you know and understand what your AMLs are doing, and you are comfortable or knowledgable with Desktop, I don't think you will have that much problem.  My suggestion is to take a step back, and as Neil mentioned, break down the steps and processes of the AML.  If you can figure out that part, it's very likely that the the tool is the same or similar enough in the Desktop tools that it will work.  I actually find that the python takes a lot less code than the AMLs.  Use a browser search with keywords and ArcGIS and you may find others that have done the same conversion.

If you get stuck,  post details of the issue and "we" can brainstorm.  There are still a bunch of us old timers hanging around the forums.  

0 Kudos
MichaelKennedy
New Contributor

Anyway, thanks for the reply. If you (or anyone else on the list) comes across anything else helpful please send it my way.

0 Kudos