Current Workspace for Parameters in Model Builder

1197
1
07-21-2023 10:01 AM
EuropaxEarth
Regular Contributor

Hello,

I have created a model that clips DEM data to my selected parcel boundary to output "Contours_Layer" and "Slope_Symbolized". I have them set as parameters. 

This model will ultimately be used in different projects. The goal would be to use the model without having to manually type in the file paths of the current project I am in.

 Is it possible to set the file path for "Contours_Layers" and "Slope_Symbolized" to the current geodatabase? 

I tried using "default.gdb" "%CurrentWorkspace%\" but recived the following error message: 000875: <value>: <value>'s workspace is an invalid output workspace.

What is the correct way to set the output of my parameters to the current workspace?

I believe in arcpy the proper syntax is as follows: 

import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")

 

Unless I were to add a script into the model, I doubt the syntax above is the same for model builder. 

 

Thank you in advance!

 

1 Reply
BryanJohnstone
Emerging Contributor

Wondering if you ever found a solution to this as I am experiencing a similar issue...

From my investigations, you might need to use %workspace%\Contours_Layer & %workspace%\Slope_Symbolized

%workspace% should reference the current default gdb.

My issue is that when I create my model, package it up in a toolbox and then into a Project Template (.aptx) for other users to access...the %workspace% in the output parameter of my model is changed to a temp location in the AppData folder...

Cant figure out how to just have the model retain the %workspace% shortcut so that it always just outputs to the current gdb given that users are accessing this all through a .aptx template.

0 Kudos