From e63c80b00d01d6474883de88aaa77787a70f6229 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Mon, 16 Jan 2017 18:30:49 +0300 Subject: [PATCH] TopoSeries: remove self-link, and extra logging * fixed TopoSeries detect TopoSeries itself linking to the array object. * extra logging - report which links were actually subsequenced. --- lattice2TopoSeries.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lattice2TopoSeries.py b/lattice2TopoSeries.py index 51e6f92..14f6676 100644 --- a/lattice2TopoSeries.py +++ b/lattice2TopoSeries.py @@ -39,13 +39,15 @@ import lattice2Subsequencer as Subsequencer # --------------------------- general routines ------------------------------------------------ -def findAllLinksTo(doc_obj): +def findAllLinksTo(doc_obj, exclude = []): """findAllLinksTo(doc_obj): finds all link properties pointing to supplied object. Returns them as list of tuples (dependent_object_name, property_name). Does not include expression links.""" ret = [] doc = doc_obj.Document for obj in set(doc_obj.InList): # InList sometimes reports same object multiple times. Wrapping with set() removes the duplicates. + if obj in exclude: + continue for prop_name in obj.PropertiesList: typ = obj.getTypeIdOfProperty(prop_name) if typ == 'App::PropertyLink': @@ -94,7 +96,7 @@ class LatticeTopoSeries(lattice2BaseFeature.LatticeFeature): def makeSubsequence(self, selfobj, object_to_loop): # gather up the links - links = findAllLinksTo(object_to_loop) + links = findAllLinksTo(object_to_loop, exclude= [selfobj]) if self.isVerbose(): print ("All links to {feature}:\n {links}" .format(feature= object_to_loop.Document.Name+"."+object_to_loop.Name, @@ -113,6 +115,8 @@ class LatticeTopoSeries(lattice2BaseFeature.LatticeFeature): object_filter= [object_to_loop] ) if self.isVerbose(): print ("Subsequence made. Length: {n_seq}".format(n_seq= ret[0])) + print ("Links subsequenced: \n {links}" + .format(links= "\n ".join([link[0]+"."+link[1] for link in ret[1].keys()])) ) return ret