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);
Advertisements

Triaxial Waffling Grasshopper3d Definition

triaxialwaffle01

Almost 4 months after my last post..:( i have been really busy lately , mostly with amazingly interesting stuff that I’ll have the time (me thinks!) to unveil in the near future, plus the development for the next build of Nudibranch  to be up-to-date with the new grasshopper version 0.9.0052.

But just to get things rolling and before moving into any major update, I decided to share a fabrication oriented definition of mine, that was developed quite a long time ago. I tried to narrow it down , clean it up and share it along with a small code snippet in Python to generate dot text objects in the rhino viewport (this is now embedded in the new gh), but it serves the general purpose of learning how to interact with rhino objects through Gh.

triaxialwaffle02

triax002

triax004

On the other hand, this definition is really useful (though my point of view at least) especially for the many advantages it has over the normal 2-dimensional waffling system, mainly in terms of rigidness and detail. At the same time this fabrication methodology provides a denser structural framework for any possible post-processing routine in order to describe better the analysed and fabricated design (most of the times a freeform, double curved surface or object) like for example the implementation of a gap filling material like stucco, cement or resin forming somehow an interesting composite system.

triax001

triax003

The system takes on single surface and translates it into ready to laser-cut stripes laying on three different grid systems, + tags + the quantification of the joints of the system(python snippet). The code of which is just a few lines as you can see below.

</pre>
import Rhino

dots = []

att = Rhino.DocObjects.ObjectAttributes()
att.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
att.ObjectColor = col

for i in range(len(pos)):
 dot = Rhino.Geometry.TextDot(text+str(i),pos[i])
 dots.append(dot)
 if bake == True:
 D = Rhino.RhinoDoc.ActiveDoc.Objects.AddTextDot(text+str(i),pos[i],att)

Dots= dots
<pre>

Let me know if there is any way to improve this definition or if bugs are brought up.  You can grab it the usual place ..

🙂

“Ichnos” – CNC Milled Generative Ornament

ichnos006

“Ichnos v.01” is the first CNC milled derivative of the “Ichnos” series, a project I have been working on in collaboration with Wade Martin of AxisCutParts in Auburn Washington. Ichnology  is the branch of geology that deals with traces of organismal behavior, such as burrows and footprints. “Ίχνος” is the trace in ancient and modern Greek. The design of Ichnos is based on the traces of  grey-scale image samples, those traces are deformed , tessellated, distorted and finally smoothened into embossed meshes. The algorithm is developed in Grasshopper3D, contains some VB.Net scripting and part of it can be accessed here.

ichnos002

ichnos003

The produced geometry is exported from rhino, then imported into the CNC software where using surface machining processes is roughed out with .125 inch call nose, while  the finish pass is made with a .0625 inches by a step-over of .003 inches. The overall process took over 4 hours to be completed. The material used in the sample is a solid 12 mm thick white corian surface of 5×10 inches.

ichnos008

ichnos012

ichnos013

ichnossnapshot