1

I have a model that exports GIS data to CAD. The model has two nested models, the first collects the data to be exported and the other exports it. The export to cad tool has a seed file parameter and I would like to make this a drop down box of two seed(.dwg) files that I have. I am able to make it a parameter but not a drop down list. I thought I could go into properties-->parameters-->filter but nothing happens when I click on the "filter" box which is set to none. What am I missing?

3

I am assuming you have 2 cad files that exist and you want to use one of these as a seed file?

This can be achieved by creating a string, populating it as a list and converting the string into a CAD dataset.

The image below shows a model and how to set the value list for your drop down:

Model and setting string value list

The calculate value tool is set up as shown below:

Calculate Value tool

When you run this model you will be offered a drop down listing only 2 full paths to the CAD files. These must obviously exist.

  • 2
    Why bother with the code block at all? Just set the expression to "%String%", no? – Jason Scheirer Mar 7 '14 at 0:26
  • Jason, You are right as usual! I keep forgetting to enclose in-line substitution variables with quotes. So I originally tried just %String% which failed so then I created the code block which as you point out is unnecessary. – Hornbydd Mar 7 '14 at 10:19
  • Thank you for the responses. That is exactly what I'm trying to do. I am able to get it to work in the export to cad sub model, however, when I run the parent model, I do not see the parameter where I can select the drop down box. What do I need to modify in the parent model to have it show up there? Also, I ended up using String in the code box. "%String%" was giving errors. – Steve Mar 7 '14 at 14:16
  • For the time being I've removed the export to cad submodel and placed the export to cad tool in the parent model so now the parent model has one nested model and the export to cad tool. I hope this does not cause any other issues but I've got it to work in this scenario. Thanks for your help on this. And if you do know a way where I can have two nested models and still have the drop down box show up in the parent model, please let me know. – Steve Mar 7 '14 at 14:35
  • Another caveat to this is I'm converting the model to a Python script which is how it will be run. Is there a way to create the value list in the script properties as there is in modelbuilder? – Steve Mar 7 '14 at 14:49
1

Steve,

As you are now asking about a different issue I am providing another answer.

I created a very simple python script as shown below that would take the input parameters and convert to CAD, the seed file can be a simple full path string to an existing CAD file.

import arcpy

# Get parameters
fl = arcpy.GetParameterAsText(0)
output = arcpy.GetParameterAsText(1)
seedfile = arcpy.GetParameterAsText(2)

res = arcpy.ExportCAD_conversion(fl,"#",output,"#","#",seedfile)
if res.status == 4:
    arcpy.AddMessage("Success!")

The properties of the script are set up as shown below, make sure your output is set to output:

Script properties

  • Hornbydd, thank you for your help and patience on this. Below I've linked the python script I'm using (click on tmp4E6F.txt). The script was exported from a model that has the "Setup" and "Export" models nested. When the script is run from ArcToolbox, it requires two parameters, an output dwg file and a seed file. It runs successfully. Is it possible to make the seed file parameter a drop down list from this script? Also below is a linked screenshot of the script parameters (click on "screenshot.jpg). sites.google.com/site/shobuddy/screenshots – Steve Mar 10 '14 at 14:04
  • I think the problem is that the data type "CAD Drawing Dataset" does not support a list filter so you can never have a drop down. A parameter type of String does and in my answers this is the parameter with the full path names preset. So a string feeds into the calculate tool that converts the string (which is the full path) to a CAD dataset type which is what the Export to CAD tool is expecting. When you are linking tools in model builder output type is everything as this controls how tools link, but in python you can treat them a strings as in my second answer. – Hornbydd Mar 10 '14 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.