Find nodes and packages in use in a graph

xml

#21

Actually I was going to temporarily archive a useful package like spring nodes… but yeah the combination of ‘what the node’ with the output of sastrugi is more or less what I’ll be looking at. May even put out a blog post or some such type thing… that is after I get my laptop functioning.


#22

Just thinking out loud here… but if we’re able to export the audit report to Excel, you could potentially have another graph that checks a location for missing nodes and copies them to your main library.

This is assuming you have a staging or backup location for nodes/packages as well as a “published” library for end users.


#23

Good thought and worth consideration. :smiley:


#24

All the scrips I create are saved to my personal drive located on our servers not my computer. Once they are done I move them to an accessible drive for others to use. I have successfully ran your node on scrips in my personal drive and on the open server.

I am able to run your node on the .dyf file you provided for the node. This only works on my computer it does not work on my personal drive or my firms open server. It will not create the .csv or the Audited DYN though. Not sure what’s going on with that.

The CSV files are of the same script. One from my personal drive and one from our open servers.
The image is your .dyf file being ran on my computer.

Thank you for the node @Ewan_Opie, I along with many look forward to your package release.

Add or Remove Revision on Sheets_Audit.xlsx (10.2 KB)
Add or Remove Revision on Sheets_Audit_from Surver.xlsx (10.2 KB)

Steve


#25

Also in the spirit of breaking everything nice people give you. It does not work when you feed it 156 dyn files. :sweat_smile: not that it needs to was just checking. It does get the file size of each file though so thats something.


#26

Hi All,

@awilliams informed me of a CSV export error, I believe this is now fixed
(Null Values being passed).

I have removed the last download link and here is the new one:

Sastrugi - Audit DYN File.dyf (251.4 KB)

Also, I have investigated integrating a similar search function to the “What-the-Node” in Rhythm. This got a tad intense, so I have adjusted the Audit node to tell users when a node’s package isn’t found and suggests using the Rhythm node separately.

@Steven I am glad that it functions on your PC. This node was written to process .DYN files, so feeding .DYF file will cause errors.

@JacobSmall and @Nick_Boyts The CSV export could be used for the workflows you describe, let me know how you go!


#27

I ALMOST have all my software up and running now (dynamo is the big outstanding one left oddly enough), and should be able to take a look soonish… I hope…


#28

@Ewan_Opie thanks for the updated version! I will try it when back on a cpu with Dynamo in the morning and report, but am confident you’ve resolved the issue in this version.

I tend to agree with you after looking at the inner makings of the “What the Node” Rhythm node that adding this to your script would just be cause for handling even more nulls and a longer execution period. The suggestion to use that node (in lieu of including its capabilities) is an awesome addition :slight_smile:

Also, goodness @Steven how long was the wait period when you tried that? Haha. System overload if you ask me :rofl:


#29

IDK I just told it to run and went a did some work on other things :grin:

@Ewan_Opie the .DYF did run on my computer. you can see im my first image that you have 315 nodes in the file. Its interesting that it works sometimes and not others.

Thanks for the update,
Steven


#30

To complement the initial graph that was missing Zero Touch nodes and packages, I have been working on a Python script that reads the xml files in the Dynamo packages directory. I am happy to share it to see if any improvement is necessary. The output is a list where the name of the package is the first item of a sublist containing nodes names in a form that needs some cleaning but is usable. The script will probably take several minutes to run the first time if you have many packages installed. Any comments are welcome :slight_smile:

#Copyright(c) 2017, Yna_Db, forum.dynamobim.com
import clr
clr.AddReference('System.Xml')
import System
from System.IO import TextReader
from System.IO import File, Path
from System.Xml import XmlReader

# ref http://www.ironpython.info/index.php?title=File_as_TextReader
class PythonFileReader(TextReader):
    def __init__(self, f):
        self.f = f
    def Read(self, buffer, index, count):
        chars = self.f.read(count).ToCharArray()
        chars.CopyTo(buffer, index)
        return len(chars)

filesList = IN[0]
filePaths = []
NdsNames = []
NdsNamesSlcd = []

for fl in filesList:
	filePaths.append(Path.GetFullPath(fl))
for fp in filePaths:
	pfr = PythonFileReader(open(str(fp)))
	xmlr = XmlReader.Create(pfr)
	while xmlr.Read():
		if xmlr.IsStartElement():
			ndNam = xmlr.Name
			NdsNames.append(ndNam)
			loc = NdsNames.index(ndNam)
			if ndNam != 'name' and ndNam != 'member' and ndNam != 'assembly':
				NdsNames[loc] = 'null'
			elif ndNam == 'member':
				NdsNames[loc] = xmlr.GetAttribute('name')
			elif ndNam == 'name':
				NdsNames[loc] = xmlr.ReadElementContentAsString()
			elif NdsNames != {}:
				NdsNamesSlcd = [[]]
				for i in NdsNames:
					if i == 'assembly':
						NdsNamesSlcd.append([])
					NdsNamesSlcd[-1].append(i)
			else:
				continue

NdsLst = [[i for i in nstd if i != 'assembly' and i != 'null'] for nstd in NdsNamesSlcd]

OUT = NdsLst

Edit: I will take the time to add some descriptions very soon…


#31

please don’t forget to add some descriptions as i’m really interested. also, could you help me a little bit, that’s a little later in case i am going to have some questions to ask you? thank you!


#32

@JameShawn
I have edited the post to first add the reference I used for creating the text reader. If you need help on your workflow, the best is to create a new topic mentioning the references you are interested in, and showing screenshots of your work with some explanation. A question that is properly introduced gets more chance to receive an appropriate answer. In case of any doubt on how to do that, please refer to the forum guidelines (I would also recommend to add some details in case no answer has been given within the first 24 hours, excluding WE). If you need help with Python, here is a thread with a list of useful links. Knowing all that, you should be able to introduce your request with confidence :slightly_smiling_face: