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.

NudiBranch 0.028 is out!

mainreleasebanner

Seven months later after the first official release, I kind of managed to properly update Nudibranch to the Grasshopper 0.9.005X series. The new version out is 0.028 (yes there were 27 different incremental attempts in between..) and it marks bug fixes (two evident plus more that were not that easy to spot), minor updates and optimization of some components, and finally 5 brand new components (**more details further down on this post). Bouncers, Slicer, BundleAttractor, MeshClimber, FrameGrid(new sub-tab Utilities) and Box3dGrid(new sub-tab Utilities).

iconsCapture

Hopefully this is a major update, not only for introducing new components but mainly for improving the existing functionality of the add-on, specifically by reinforcing its global character, increasing its accessibility and user-friendliness, while exponentially reducing the calculation time for many of the existing routines. This release is unfortunately supported only by Rhino 5.0. The previous release for Rhino 4.0 is still going to be available to anyone who might be using the previous version of the software but its functionality is limited.

Some snapshots of the New Features are displayed in the following figures.

bouncers001

bundle001meshclimber001

slicer001
Of course your feedback is valuable in any case, so do not hesitate to contact us and add your comments or critique, either here on the blog or though the official Nudibranch group in the Grasshopper3d forum.
You can download Nudibranch of the Food4Rhino website.
Enjoy 🙂
**
BUG FIXES
• Satellite Component: The component was throwing an exception when loading geometry that was of Type IGH_GeometricGoo. This is fixed. (thanks Igor GH Forum for noticing)
• PointAttractor and CurveAttractor: These components were creating Null vectors when the attractors where further than the attraction range. This is fixed, they return Zero length vectors. (thanks Igor GH Forum for noticing)
EXISTING COMPONENT IMPROVEMENTS
• AttractorValues + CurveValues:
 Switched data arrangement to longest list
 Added additional right-click drop down menu to the distribution input
 Added auto-fill options when a value-list component is connected to the distribution input
 Added three options for the attractor solver as a right-click menu on the component (Minimum, Average, Maximum)
• PointAttractor + CurveAttractor:
 Switched data arrangement to longest list
 Added additional right-click drop down menu to the distribution input
 Added auto-fill options when a value-list component is connected to the distribution input
• TwirlAttractor:
 Switched data arrangement to longest list NUDIBRANCH Version History
Nudibranch Version History
• Railway:
 Added inheritance of the DataPath for the curves used as rails to organize the
generated points in a branched structure of the original.
• Walkers:
 Added an extra input for randomizing the speed for each walker in the
domain of (-Factor to Factor)
• PointHicking + CurveHicking + PointPatrolling:
 Switched data arrangement to longest list
• Uphill + Downhill:
 These components were replaced by the Climber Component
 Added two options for the solver as a right-click menu on the component
(DownHill, UpHill)
NEW COMPONENTS
• Bouncers:
 Animators Tab: Generates and animates a Number of Particles bouncing
within a user defined Box boundary.
• Slicer:
 Animators Tab: Generates and animates Rhino Clipping planes for a set of
user defined curves.
• BundleAttractor:
 Attractors Tab: Generates an iteratively bundled point list for any given
DataTree population of points.
• MeshClimber:
 Scramblers Tab: Generates the gradient descent or ascent paths on a Mesh
object for any provided point list.
• FrameGrid:
 Utilities Tab: Generates a 2-dimensional grid of points distributed as a
row/column structure for any given 3dRectangle.
• Box3DGrid:
 Utilities Tab: Generates a 3-dimensional grid of points distributed as a
row/flippedrow/column structure for any given Box.
EXTRA NOTES
• All modified components have been marked as “OBSOLETE”; hence they will continue to
operate in existing files with the previous release functionality. The “OLD” logo will appear on
top of the component’s icon.
• Added a tab icon for the 0.9.005x series
• Added a new icon in component Libraries
• Loaded from COFF Data
Creative Commons License

Nudibranch Copyright (C) 2013 by Marios Tsiliakos is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Permissions beyond the scope of this license may be available at www.digitalsubstance.wordpress.com.