Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
Sunday, January 16, 2011
Update Baked Objs by C#
Link: update-bake
1.
Guid uuid = Guid.Empty;
uuid = doc.Objects.AddSurface(obj as Surface, att);
2.
Rhino.DocObjects.ObjRef RefObj = new Rhino.DocObjects.ObjRef(uuid);
doc.Objects.Replace(RefObj, srf);
Wednesday, January 12, 2011
SpaceMorph - Deformation Utility from Rhino SDK/RhinoCommon
Tutorial: link
To make a component that applies a deformation to geometry, try Rhino.Geometry.SpaceMorph with MorphVector. Yet, without using Morphvector, Rhino will just morph two nearby points and thus approximate the vector deformation.
To make a component that applies a deformation to geometry, try Rhino.Geometry.SpaceMorph with MorphVector. Yet, without using Morphvector, Rhino will just morph two nearby points and thus approximate the vector deformation.
Tuesday, December 28, 2010
String Format for Double
Tutorial Link: Local Project: http://www.csharp-examples.net/string-format-double/
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern „0.00“. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
Next example formats double to string with floating number of decimal places. E.g. for maximal two decimal places use pattern „0.##“.
Digits before decimal point
If you want a float number to have any minimal number of digits before decimal point use N-times zero before decimal point. E.g. pattern „00.0“ formats a float number to string with at least two digits before decimal point and one digit after that.
Align numbers with spaces
To align float number to the right use comma „,“ option before the colon. Type comma followed by a number of spaces, e.g. „0,10:0.0“ (this can be used only in String.Format method, not in double.ToString method). To align numbers to the left use negative number of spaces.
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern „0.00“. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
Next example formats double to string with floating number of decimal places. E.g. for maximal two decimal places use pattern „0.##“.
Digits before decimal point
If you want a float number to have any minimal number of digits before decimal point use N-times zero before decimal point. E.g. pattern „00.0“ formats a float number to string with at least two digits before decimal point and one digit after that.
Align numbers with spaces
To align float number to the right use comma „,“ option before the colon. Type comma followed by a number of spaces, e.g. „0,10:0.0“ (this can be used only in String.Format method, not in double.ToString method). To align numbers to the left use negative number of spaces.
Sunday, December 19, 2010
Create an automated screenshot
Original Link: http://www.grasshopper3d.com/forum/topics/having-grasshopper-create-an
Rectangle bounds = Screen.GetBounds(System.Drawing.Point.Empty);
using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using(Graphics g = Graphics.FromImage((Image) bitmap))
{
g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
}
bitmap.Save(@"C:\SomePath\SomeFilename.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
Saturday, December 18, 2010
DataTree in C#
How to create a DataTree in C# using Grasshopper:
DataTree
for (int i = 0; i <= y; i++){
// Adding data to a DataTree requires a path.
// In this case the path will have a single branch index.
// There will be only one Point associated with each path
Point3d pt = new Point3d(i, 0, 0);
EH_Path Path = new EH_Path(i);
Tree.Add(pt, Path);
}
Thursday, December 9, 2010
PQ Mesh
Reference from EAT-A-BUG:
http://eat-a-bug.blogspot.com/2010/09/planar-quad-mesh-design.html
http://eat-a-bug.blogspot.com/2010/09/planar-quad-mesh-design-pt-2.html
This is a exercise to create a Tool to generate a quad-dorminate mesh with only planar faces only--PQ Mesh, which was first presented in this paper.
Saturday, September 4, 2010
Friday, September 3, 2010
Voronoi 3D from Grasshopper3D
Tutorial Link:http://www.grasshopper3d.com/forum/topics/3d-voronoi-1
Tutorial from un didi:
http://dimitrie.wordpress.com/2009/05/01/3d-voronoi-in-grasshopper/
updated version: http://improved.ro/Grasshopper/Voronoi3dAndQconvex.zip
Qhull : http://www.qhull.org/
Automatic Differentiation
A C++ library that is unlicensed and freely available that performs AD is posted below. A discussion from Grasshopper3D.
Links:
http://www.grasshopper3d.com/forum/topics/gh-feature-request-automatic
Attachment: Fast Automatic Differentiation in C++.zip
http://www.codeproject.com/KB/cpp/fadcpp.aspx
Thursday, September 2, 2010
Path Mapper
from David:
The PathMapper is a very complicated piece of work, thousands of lines of code go into evaluating and parsing the mapping masks. You can however use PathMapper logic from your own code. What you need to do is create a
GH_LexerCombo
which contains the source and target mappings. Then you can callGH_Lexer.PerformLexicalReplace()
to map a data tree.link:http://www.grasshopper3d.com/forum/topics/hi-everyone-help-me-please-on
Friday, August 27, 2010
Isopotential Maps by C#
An attempt to build the Isopotential Maps from the tutorial below:
Tutorial Link: http://www.grasshopper3d.com/profiles/blogs/generating-isopotential-maps
Definition:

Perspective:
Tutorial Link: http://www.grasshopper3d.com/profiles/blogs/generating-isopotential-maps
Definition:
Perspective:
Monday, July 26, 2010
Run RhinoScript in C# component in Grasshopper
To run a Rhinoscript in C# component in Grasshopper:
for example:
RMA.Rhino.RhUtil.RhinoApp().RunScript("-_Render");
for example:
RMA.Rhino.RhUtil.RhinoApp().RunScript("-_Render");
Subscribe to:
Posts (Atom)