Hi All,
I have a hypothetical question about importing outside rules. Is it possible to set up conditional imports? I know in python it is very easy to do something like this:
try:
import pandas as pd
except:
arcpy.AddError("This BetterBusBuffers tool requires the python library pandas, but the tool was unable to import the library.")
I was curious if something similar is possible in CGA. In my earliest attempts, I start with a simple import statement:
import Street_Text : "Street_Text.cga"
Then, I figured, because the text for import is just text, I can just replace it with a const.
const conditional_text_import= case fileExists("Street_Text.cga"): "Street_Text.cga" else: "/ESRI.lib/rules/General/Text.cga"
import Street_Text : conditional_text_import
This however returns an error. I have since tried doing the import statements within rules and other variations (I did not think they would work but I thought I would try). Is this simply not possible in CityEngine? Any alternatives?
My goal is to essentially make a rule not being in the folder not be catastrophic to the rules function. It is a small thing, and there are other options, but I just want to keep a rules user experience a little easier. I think I am especially concerned when the functionality being added is not critical to many people's use cases.
Relevant docs:
import
Using CE 2017. Any thoughts appreciated.
CWilkins-esristaff to your knowledge is this possible?
David Wasserman, AICP