sDNA_GH is an open source (MIT licensed) plug-in providing components that run the tools from a local sDNA installation from within Grasshopper.
sDNA is able to calculate Betweenness, Closeness, Angular distance, and many other quantities including custom hybrid metrics, and is able to perform many other advanced functions as well.
- Reads a network's polyline Geometry from Rhino or Grasshopper, and Data from any User Text on it.
- Writes the network polylines (formed by one or more polylines) and user Data to a Shapefile.
- Initiates an sDNA tool that processes that shapefile, and e.g. carries out a network preparation or an analysis.
- Reads the shapefile produced by the sDNA tool.
- Displays the results from sDNA by colouring new polylines or the original ones.
1. Ensure you have an installation of Rhino 3D including Grasshopper (versions 6 and 7 are supported).
2. Ensure you have an installation of Python 2.7 or Python 2.7.18 that can run sDNA correctly from the command line, with pip for sDNA Learn. sDNA_GH runs sDNA from the command line. Command line use of sDNA has been tested with Python versions 2.6 and 2.7 . Do not run sDNA with Iron Python 2.7, as invalid shape files may be produced (it is not possible to access the Iron Python shipped with Rhino from the command line, in any case).
3. sDNA Learn requires numpy. Numpy can be added after installing Python 2.7.18 by opening a cmd window and typing: "cd C:\Python27\Scripts" and "pip2.7 install numpy".
4. To use sDNA with sDNA_GH, ensure you have an installation of sDNA. sDNA itself may require the 64 bit (x64) Visual Studio 2008 redistributable (alternative download link). The closed source "free as in beer" version of sDNA and sDNA+ may also require the 32 bit (x86) Visual Studio 2008 redistributable (alternative download link) in order to unlock sDNA with a serial number.
5. Download sdna-gh.zip from food4rhino or the sDNA_GH releases page on Github.
6. Ensure sdna-gh.zip is unblocked: Open File Explorer and go to your Downloads folder (or whichever folder you saved it in). Right click it and select Properties from the bottom of the menu. Then click on the Unblock check box at the bottom (right of Security), and click OK or Apply. The check box and _Security_ section should disappear. This should unblock all the files in the zip archive. Please do not automatically trust and unblock all software downloaded from anywhere on the internet (the source code and build scripts for sDNA_GH are visible on Github).
7. Open Rhino and Grasshopper.
8. In Grasshopper's pull down menus (above the tabs ribbon at the top) click File -> Special folders -> User Objects Folder. The default in Rhino 7 is %appdata%\Grasshopper\UserObjects. Note, this is not the Components Folder used by many other plug-ins (i.e. not %appdata%\Grasshopper\Libraries).
9. Copy sdna-gh.zip to this folder (it should be at e.g.%appdata%\Grasshopper\UserObjects\sdna-gh.zip).
10. Unzip sdna-gh.zip to this location (in Windows 10 right click sdna-gh.zip and select Extract All ..., then click Extract to use the suggested location). In the User Objects folder, a single folder called sdna-gh should have been created, itself containing a subfolder called sDNA_GH.
11. Restart Rhino and Grasshopper.
12. The sDNA_GH plug in components should now be available under a new sDNA tab in the ribbon amongst the tabs for any other plug-ins installed (right of Mesh, Intersect, Transform and Display etc).
13. To use sDNA with sDNA_GH, if no preferences are specified, sDNA_GH will search for sDNA and Python 2.7 installations automatically, using the first one of each it finds. To ensure sDNA_GH uses a particular version of sDNA and the correct Python 2.7 interpreter it is recommended on first usage to:
-place a Config component on the canvas (the component with a gear/cog icon in Extra).
-Specify the file path of the sDNA folder (containing sDNAUISpec.py and runsdnacommand.py) of the sDNA installation you wish to use in the sDNA_folders input.
-Specify the file path of the Python 2.7 interpreter's main executable in the python input.
-Specify any other options you wish to save and reuse on all projects, if necessary by adding custom input Params with the option's name.
-Connect a true boolean toggle to go. An installation wide user options file (config.toml) will be created if there isn't one already.
To save options to other project specific `config.toml` files, specify the file path in `save_to` and repeat the previous 4 sub steps.
14. If a newer version of sDNA is used in future with tools unknown to sDNA_GH at the time it was built, if a Config component is placed, and the path of the new sDNA specified in sDNA_folders, sDNA_GH will then attempt to automatically build components and user objects for the new sDNA tools, and add them to Grasshopper for you. Set make_new_comps to false to prevent this.
A detailed manual can be viewed online here, and is also included in sdna-gh.zip (in a text panel component, and in .md & .pdf forms). Numerous test cases showing example use are available on the Github releases page.
Copyright (c)  [Cardiff University, a body incorporated by Royal Charter and a registered charity (number: 1136855) whose administrative offices are at 7th floor 30 - 36 Newport Road, University CF24 0DE, Wales, UK