Wednesday, September 29, 2010

Backe an object with an assigned name

Bake an object with the assigned name from Grasshopper : Backe an object with an assigned name

file fro m Grasshopper3D: AddNameToObj.ghx, 31 KB



if (BakeNow)
{
Rhino.DocObjects.ObjectAttributes att = new Rhino.DocObjects.ObjectAttributes();

att.Name = NewName;

//If it's a brep, a polysurface or a surface
if (Obj is Brep)
{
doc.Objects.AddBrep((Brep) Obj, att);
A = "Brep baked";
}

//If it's a mesh
else if (Obj is Mesh)
{
doc.Objects.AddMesh((Mesh) Obj, att);
A = "Mesh baked";
}

//If it's a line (not a curve)
else if (Obj is Line)
{
doc.Objects.AddLine((Line) Obj, att);
A = "Line baked";
}

//If it's an arc (not a curve)
else if (Obj is Arc)
{
doc.Objects.AddArc((Arc) Obj, att);
A = "Arc baked";
}

//If it's a circle (not a curve)
else if (Obj is Circle)
{
doc.Objects.AddCircle((Circle) Obj, att);
A = "Circle baked";
}

//If it's a curve)
else if (Obj is Curve)
{
doc.Objects.AddCurve((Curve) Obj, att);
A = "Curve baked";
}

//If it's a Point3D)
else if (Obj is Point3d)
{
doc.Objects.AddPoint((Point3d) Obj, att);
A = "Point baked";
}

else
{
A = "Don't Know how to handle this geometry.";
}

}

Tuesday, September 28, 2010

From "Geometry and New and Future Spatial Patterns" by Pottman, H. (2009). Architectural Design. M. Garcia, Wiley. 79: 60–65.

The architects/designers do not always have the right tools at their disposal to realize such structures.

The realization of complex architecture freeform shapes and generation of panel patterns continues to be especially challenging, limited by material and manufacturing constraints.

Friday, September 24, 2010

Create a Parametric Helix in Revit


Two Steps:

1. Create a line family, which has parameters for the vertical offset, the length of the line segment and rotation angle.





2. insert number of this line objects into another mass template for the creation of the helix.





Wednesday, September 8, 2010

About Optimization from David


Original link: forum/topics/learning-vbnet-and-rhinocommon

optimization comes in multiple flavours. Macro-Optimization is difficult but generally yields good results, especially if you're implementing proven algorithms (binary search vs. linear search for example). Micro-Optimization rarely makes a big difference, especially when you're using 'smart' compilers like modern C++ or .NET ones. In fact, it's not that rare that an attempt at micro-optimization is actually detrimental, as the compiler suddenly no longer 'understands' what it is you're doing and can no longer help out.

Two things I've learned over the years about optimization:

1. You will not be able to guess/deduce which parts of your code are bottlenecks. Don't start blindly optimizing code.

Always always always profile your code first

. You can either build in custom profilers (the .NET framework supplies some useful classes for this) or use an external profiler (I use RedGate Ants).

2. Debugging code is twice as hard as writing code. Therefore, writing complicated optimizations that stretch your skills to the limit is pointless and frustrating. You will not be able to debug your optimized code and end up worse off than when you started.

Saturday, September 4, 2010

Thursday, September 2, 2010

Backing Objects with colors

Link: http://www.grasshopper3d.com/forum/topics/error-in-old-vb-code


If blnBake Then

 'Bake Object

 Dim mObj As New MRhinoBrepObject

 mObj = doc.AddBrepObject(obj)


 'Find obj attributes to change color

 Dim att As New MRhinoObjectAttributes(mObj.Attributes())

 att.SetColorSource(1) 'set color source to From Object

 Dim rColor As New OnColor (color) 'make OnColor

 att.m_color = rColor 'Set Object Color



 'Modify the attributes

 Dim objref As New MRhinoObjRef(mObj.Attributes.m_uuid)

 doc.ModifyObjectAttributes(objref, att)


End If

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 call

GH_Lexer.PerformLexicalReplace()

to map a data tree.

link:http://www.grasshopper3d.com/forum/topics/hi-everyone-help-me-please-on