jordi xirgo you should add features in your topology dataset before add rule on its.
As you done in your first code block:
AddFeatureClassToTopology_management(in_topology, in_featureclass, xy_rank, z_rank)
Doesn't seem to get old...
I have the same problem, AddRuleToTopology_management is returning with ERROR 999999, even though topology is set with full path, and so is the feature class.
arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> gdb topo_path <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>gdb<SPAN class="punctuation token">,</SPAN> fd<SPAN class="punctuation token">,</SPAN> topo<SPAN class="punctuation token">)</SPAN> fc_path <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>gdb<SPAN class="punctuation token">,</SPAN> fd<SPAN class="punctuation token">,</SPAN> fc<SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddRuleToTopology_management<SPAN class="punctuation token">(</SPAN>topo_path<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Must Not Intersect (Line)"</SPAN><SPAN class="punctuation token">,</SPAN> fc_path<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
All paths are actually correct and of type String, but I always get 999999 in my face. That's in a stand-alone script I am developing in Eclipse. ArcGIS is in version 10.5
When debuging then I can see the error is raised in line 16214 in the management.py file. Since I went step by step through the process I was able to confirm that all paths went correct through the gp_fixargs() function, and optional argument not given have been also correctly taken of the arguments list.
I assume the process is failing in the subsequent run of gp.AddRuleToTopology_management().
--> AddRuleToTopology
<SPAN class="number token">16208</SPAN> <SPAN class="keyword token">from</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>geoprocessing<SPAN class="punctuation token">.</SPAN>_base <SPAN class="keyword token">import</SPAN> gp<SPAN class="punctuation token">,</SPAN> gp_fixargs <SPAN class="number token">16209</SPAN> <SPAN class="keyword token">from</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>arcobjects<SPAN class="punctuation token">.</SPAN>arcobjectconversion <SPAN class="keyword token">import</SPAN> convertArcObjectToPythonObject <SPAN class="number token">16210</SPAN> <SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="number token">16211</SPAN> retval <SPAN class="operator token">=</SPAN> convertArcObjectToPythonObject<SPAN class="punctuation token">(</SPAN>gp<SPAN class="punctuation token">.</SPAN>AddRuleToTopology_management<SPAN class="punctuation token">(</SPAN><SPAN class="operator token">*</SPAN>gp_fixargs<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN>in_topology<SPAN class="punctuation token">,</SPAN> rule_type<SPAN class="punctuation token">,</SPAN> in_featureclass<SPAN class="punctuation token">,</SPAN> subtype<SPAN class="punctuation token">,</SPAN> in_featureclass2<SPAN class="punctuation token">,</SPAN> subtype2<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="number token">16212</SPAN> <SPAN class="keyword token">return</SPAN> retval <SPAN class="number token">16213</SPAN> <SPAN class="keyword token">except</SPAN> Exception<SPAN class="punctuation token">,</SPAN> e<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">16214</SPAN> <SPAN class="keyword token">raise</SPAN> e<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I was using the PyScripter IDE.
I was able to figure out the issue. In the AddFeatureClassToTopology and AddRuleToTopology geoprocessing tools, the full path to the feature class and topology name must be provided, even though arcpy.env.workspace was set.
Hello Thomas, could you try disabling background processing, then run the tool again? Alternatively, I'd try running the tool from an IDE or command line and not the Python window.
Cheers,
Shaun
I'm having exactly the same issue. I realize the topic is old, but were you ever able to resolve the issue?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.