Find nodes and packages in use in a graph

xml
#13

Hi All,

Here is my revised node (to be distributed in package in the coming weeks)
Please note that I have only had the ability to test this on my systems architecture, so let me know if you get any different results.

Node capabilities:

  • File Name
  • File Size
  • Workspace Version
  • Total Connectors
  • Unique Node Names, Types, Numbers and Packages (with versions if available)
  • Node Types and Numbers
  • Total Nodes

Options:

  • Export Report to CSV
  • Export an Audited DYN containing a code block listing Audit information.
    (Both are placed in the same folder as the original DYN)

sas3

This node will only generate package information when used on the creators PC before distribution. This is due to the need to reference script nodes to package node locations locally. (This does mean that the run time for this node can be a little long, as it explores the contents of your package folder/s each time)

So to make users aware of required packages, the Audited DYN could be sent in lieu of the original as no other changes to the script are made apart from adding a code block full of text.

Special thanks to @awilliams for some super python scripting advice!

EDIT/UPDATE: FILE REMOVED, SEE POSTING BELOW FOR UP TO DATE FILE

Enjoy! :wink:

7 Likes

Identifying Custom Nodes Publisher
Revit Slows down after large Dynamo script
#14

Big ask here, hopefully not too much trouble: Is it possible to also include a list of node names for nodes which are unresolved?

0 Likes

#15

What do you mean by unresolved?
If the node can’t find an appropriate package for the type it will substitute a value, this may be used as a “heads-up”

At the moment it is as below:
Custom nodes = Package Not Found
Zerotouch nodes = The node type as what has been stated in the data already

At least that’s how it was working on my end. :face_with_raised_eyebrow:

1 Like

#16

Lookng forward to trying this tomorrow @Ewan_Opie :grin: will be very helpful when I transition the firm over to Revit 2018 and have all my Dynamo Player workflows ready to go by having all of the correct packages on the server

2 Likes

#17

I’ll try this out on my end once I get Dynamo installed (having some difficulty with the new laptop - bear with me), but my thought was to see if t could break the unresolved nodes (not installed on the system running the analysis) out into a separate list so you knew what nodes would throw issues so as a manager/organizer/lead/power user you could search for the node names you need when a user writes a script with a custom node from a package which isn’t yet in the office’s library, so that hypothetical manager/organizer/lead/power user could make an informed decision on the need for the missing package.

0 Likes

#18

@JacobSmall it sounds from this statement that this node will do what you are describing to some degree :slight_smile: I suppose we’ll both find out once we have Dynamo to try it out!

1 Like

#19

Bingo! Can’t wait to feed in an aggregated list of DYFs to see what happened…

0 Likes

#20

Why do I get the feeling you’re going to make a bunch of valueless custom nodes, make a .dyn using all of them, then delete the .dyfs and then run this node on that .dyn? :rofl:

Just kidding, but I think it’d be cool to somehow integrate the What the Node capabilities within this node for unresolved nodes (and of course, replacing null outputs with something else)

2 Likes

#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.

1 Like

#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.

1 Like

#23

Good thought and worth consideration. :smiley:

0 Likes

#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

0 Likes

#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.

0 Likes

#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!

1 Like

Dynamo Pack & 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…

1 Like

#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:

4 Likes

#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

2 Likes

#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…

5 Likes

#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!

0 Likes

#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:

1 Like