Hi,
I am new to python. I want to create a script that will take a geodatabase/featuredataset as input and place the featuredataset in TOC of a new mapdocument. My intension is to use the same dataframe in the current map document. My Idea is like this,
# Import module
import os
import arcpy
from arcpy import env
# Set input parameter (I want to connect this script to the model output which is a geodatabase)
def getParameterInfo(self):
param0 = arcpy.Parameter(
displayName="Input Geodata",
name="in_workspace",
datatype="DEGeodatasetType",
parameterType="Required",
direction="Input")
return param0
# Set environment
arcpy.env.workspace = ("param0")
mxd = arcpy.mapping.MapDocument("CURRENT")
# Copy the dataframe from current mxd to a new mxd and add the inputted gdb to map document.
for df in arcpy.mapping.ListDataFrames(mxd):
for ds in arcpy.mapping.ListDataset
for fc in arcpy.mapping.ListFeatureClasses
!!
!!
mxd.saveACopy(r"C:\Users\attrab01\Downloads\PK\\" + "Project"+ ".mxd")
del mxd1
# Open the new mxd automatic
os.startfile(r"C:\Users\attrab01\Downloads\PK\\" + "Project" + ".mxd")
This is a workflow of my desired output. I would really appreciate if you can give me an exaple how to compile the code in python. Thanks in advance.