AnsweredAssumed Answered

Lock on feature class in Geometric Network?

Question asked by soldous on Feb 8, 2017

Hello,

I try to automatically create a geometrick network and after that schematic diagram using python script. Both should rewrite after each start of the script. Here is my code:

import arcpy
mxd=arcpy.mapping.MapDocument(r"D:\ELTODO\pracovnislozka\topologie_geom_site_uka_prj\AllData.mxd")
ftrDataset = r"\\gis\D$\DATA\Schematics\DataProTemplate.gdb\NetData"
arcpy.env.workspace = ftrDataset
arcpy.env.overwriteOutput = 1


cisloZM = arcpy.GetParameterAsText(0)
sqlClause = "ZM = " + "'" + cisloZM + "'"
listLayers = arcpy.mapping.ListLayers(mxd)
for lyr in listLayers:
        newlyr=arcpy.MakeFeatureLayer_management(lyr,"in_memory" + r"\\" + lyr.name,"ZM = " + "'" + cisloZM + "'")
        arcpy.CopyFeatures_management(newlyr,ftrDataset + r"\\" + lyr.name)
        print ("Exportuji " + lyr.name)
        arcpy.Delete_management(newlyr)

arcpy.CreateGeometricNetwork_management(ftrDataset,"GeomNet","arch_svet_prv SIMPLE_JUNCTION NO;del_skrin SIMPLE_JUNCTION NO;kab_vede SIMPLE_EDGE NO;m_rozhlas SIMPLE_JUNCTION NO;nasv_ploch SIMPLE_JUNCTION NO;plyn_osv SIMPLE_JUNCTION NO;pripoj_mm SIMPLE_JUNCTION NO;prechod SIMPLE_JUNCTION NO;radic_SSZ SIMPLE_JUNCTION NO;slav_osv SIMPLE_JUNCTION NO;spec_arch_osv SIMPLE_JUNCTION NO;stoz_SSZ SIMPLE_JUNCTION NO;ver_osv SIMPLE_JUNCTION NO;zap_mist SIMPLE_JUNCTION YES;zastav SIMPLE_JUNCTION NO")

First run of the script is ok but when the geometric network is created ones I can't rewrite feature classes using CopyFeatures. 

So I have a question. Does the geometric network hold a locks on features participated in the network? And if so ...is here any possibillity how to do what I need?

 

Thanks a lot

Outcomes