Unblocking GH add-ons + more a.k.a Why the add-on is not installed?

unblock_lib_title_DS

A really common question, of new or less new Grasshopper3d users, is why the 3rd party add-ons they’re trying to install are not appearing on the ribbon layout of the canvas. In the, not at all exaggerated, 99% of the cases, the issue lies in the fact that these files are “blocked” by windows.

You can briefly learn more about why windows block some files, especially downloaded from the web, here.

The common solution to this to prompt the user to right-click on the blocked .gha or .dll file, open the properties tab and click the unblock option on the bottom right corner of the properties window. Something that is efficient, but can take ages, if you don’t know which file is blocked, or have to unblock many files at the same time.

The code below saves all the fuss that could emerge from looking which files are blocked, or even by just clicking three times on a file to unblock it (yes I am kind of lazy..)

It also saves some people (GH forum users) the trouble explaining or troubleshooting the same scenario every single time.

So, by just clicking on the button toggle of this Grasshopper3d definition and executing the script you automatically unblock all the files in your local GH libraries directory. This ensures that when you restart Grasshopper, all the add-ons in this folder will be loaded onto the ribbon tab.

I also added an extra option that will install a special key to your registry, so that an complementary option of unblocking files is going to appear on the dropdown right – click menu. This of course means that you can select multiple files and unblock the simultaneously. Info on how to get rid of this extra option is provided while running the component. As you may have guessed, adding new keys to your registry relies heavily on your admin rights.

Following is a simple illustrated breakdown of the process.

unblock_lib_snap01 unblock_lib_snap02 unblock_lib_snap03 unblock_lib_snap04 unblock_lib_snap05If your IT department has block your admin privileges don’t expect this to work. However it has been tested successfully on personal pc’s, on Windows 7, 8.1 and 10. Special thanks to Angel, Mateusz, Michael, Stamatis and Andrea for beta testing.

I will upload the c# code on my github account. So any takes and tweaks are more than welcome.

The code utilizes extracts from these two discussions

Beware that this code might not be bug free (most probably is full of bugs) and I do not take any responsibility if you destroy your computer.

You can grab the def and an extra GH user object to keep this snippet constantly in your GH toolbox here.

unblock_lib_def

Enjoy. 😉

 

Automated A.I. vector graphics export from Grasshopper3d

If you spend 12 or more hours on an airplane travelling somewhere, it’s time to write something on your blog.

ghtoAi

 

I had to provide a sequence of transformations for a design at work, that could be easily manipulated by a graphic designer (change line-weights, color etc). So instead of exporting the typical raster image format from the slider animate, I wrote a small C# routine that enable to export any GH created Curve/line/ 1 dimensional object to a native Adobe illustrator file.

Parameters include: incremental export, layer name, directory to save and file name. I trust that many people will find this code snippet quite useful, as I have encountered many times this wish for vector graphics export instead of flattened images.

Please find the code and an example at the usual page.

automated_AI

Enjoy,

M.

Ps. SourceCode below:


 private void RunScript(List<Curve> curves, int series, string name, string layername, string filepath, bool execute)
 {

 #region Authorship
 //[Aytomated AI Export] was written by Marios Tsiliakos on 06 / 11 / 2014 in grasshopper 0.9.0076
 //This definition is for the pubic domain feel free to use it , share it and modify it, by providing proper citing. The author, Marios Tsiliakos of digitalsubstance.wordpress.com , makes no warranty, expressed or implied, as to the usefulness of the software and documentation for any purpose.If this tool is used for commercial purposes please notify the author. This work is licensed under a Creative Commons Attribution-Share Alike 3.0
 //for more information visit digitalsubstance.wordpress.com.
 #endregion

 if (!execute)return;

 else
 {
 //check
 for (int i = 0; i < curves.Count;i++){
 if ((curves.Count == 0) || (curves[i] == null))
 {
 Print("No curves or valid curves provided");
 return;
 }
 }
 //create alist of guids
 List<Guid> mycurves = new List<Guid>();
 // layer to bake the objects to
 create_layer(layername);
 //create a directory to store the ai files
 create_dir(filepath);

 for(int i = 0; i < curves.Count; i++){
 //declare the objects attributes
 Rhino.DocObjects.ObjectAttributes attr = new Rhino.DocObjects.ObjectAttributes();
 //set attributes
 attr.LayerIndex = doc.Layers.Find(layername, true);

 Guid id = Guid.Empty;

 //bake the curves
 if(curves[i].ObjectType == Rhino.DocObjects.ObjectType.Curve)
 {
 id = doc.Objects.AddCurve((Curve) curves[i], attr);
 }

 // add the curves to the mycurve_guid list
 if(id.ToString().Length > 0) mycurves.Add(id);
 }
 // select the curves in Rhino to successfully export them
 for(int i = 0; i < mycurves.Count; i++)
 {
 doc.Objects.Select(mycurves[i], true);
 }
 //where to save
 string save_directory = filepath + ("\\" + name) + series.ToString("0000") + ".ai";
 //and export them
 Rhino.RhinoApp.RunScript("-_Export\n\"" + save_directory + "\"\n _Enter", false);
 //delete the curves after exporting them
 for(int i = 0; i < mycurves.Count; i++) doc.Objects.Delete(mycurves[i], true);

Tree Iterator – Animate GH Data Trees

forest_hike_icon_500new

Dear “Diary”,

I know it has a while since I last wrote. But I recently had a great opportunity to apply part of my research to actual build geometry, and for that I am grateful.

In the meanwhile I thought i should share in the form of a .gha assembly a routine that I use frequently to animate data that get into my hands from grasshopper definitions that use Hoopsnake and Anemone(Lately). The main issue with these data sets is that while these two add-ons are running, due to their intrinsic characteristics, is kind of difficult to animate their wonderful iterative and recursive formations.

Canvas at 00;48;58

So, to be brief, what ever formation you create with these two looping tools, you can now easily post-animate it and iterate through the various steps of the solution.

The component is fairly simple to use. Data as input and a few toggles for different options of iterating. It can either work with a timer or by a slider. You will find it under the tab “Extra”

I will post the gha file and an example here and I will also include it in the Milkbox group of the Grasshopper3d forum.

Please bear in mind that this component is probably full of bugs, which I plan to resolve in the future.There is a slight change to include a stable version of this routine in the next version of Nudibranch. Please use it “as is”, it does not come with warranties. Please give credit where credit is due according to the CC license of this website.

Suggestion, comments, criticism are always welcome.