could [you] assist me constructing a python expression using calculate value to solve a similar problem. I've attached two print screens of my current model. I'm selecting CAD Features based on their layer name and then using Feature Class to Feature Class to write out the CAD Features to a File Geodatabase based on the Layer Name. The problem that I have is that I need to remove invalid characters from the Layers Name.
ValidateName(r"%Layer name%",r"%Output geodatabase%")
def ValidateName(fc,wks): import arcpy vName = arcpy.ValidateTableName(fc,wks) return vName
ValidatePath(r"%Output Raster%")
def ValidatePath(ds): import arcpy import os # extract pathname dspath = os.path.dirname(ds) dsname = os.path.basename(ds) # fix weird characters in dataset name dsname = arcpy.ValidateTableName(dsname,dspath) # for grids, truncate to 10 characters dsname = dsname[:10] return os.path.join(dspath,dsname)
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.