) membrFP.Faces[0], // start/quide surface: going from DC to NY via LA uSpans, // obvious vSpans, // obvious true, // trim outer loop. Fails in most of cases. NOTE: inner loops ARE NOT treated false, // tangency 1.0, // point spacing patchFlexibility, // flexibility: use a generous value around 50 surfPullFactor, // surface pull factor (this needs some investigation) fixedges, // get 4 false values you stupid method, like that? 0.2); // tolerance - be generous: we are talking about tissues here not NASA sourced things
Do you know of a generic container in Rhincommon I can store geometry form meshes, breps and curves to points? That's what I seem to need to get around the IEnumerable error.
I have to figure out how to format the Boolean array in Python. Ah, parenthesis worked!
P = Rhino.Geometry.Brep.CreatePatch(CURVES_CONTAINER, Starting_Surface[0], 10, 10, True, False, 10, 30, 0, (False, False, False, False), 1)
At long last, only to find out it won't work right, as in no setting of flexibility will affect it at all?!
Tolerance has a sudden crazy effect if I turn it way up, like a piece of paper bending up opposite corners and it no long is trimmed, but flexibility is dead. I used your same values and same curves for everything. Yes, all the curves are participating, if I bake them and move them around.
My Patch is broken. Weird. Is there magic with the starting surface? I made a naive assumption just a plane would do. Yet you seem to be using your simple CreatePatch results for this?
Ah, the second CreatePatch command type that takes only a surface gives the same thing, nearly. You need a starting surface at all?! They said you could now leave that out as of Rhino SR10 by using Null, but Null or Nothing gives an error. How do I make a null? In Python it's None, as in just entering None into the Rhinocommon command or assigning a variable to None.
Now I have a patch!
But your's is more expressive, more crazy, like your starting surface is greatly influencing it to have extremely extended feet, whereas mine works like a normal patch, as if you were trying to smooth over things. And indeed your surface pull slider makes it more obvious you chose a specific starting surface attached to one of the curves. My starting planes had no such effect, earlier.
With such a starting surface to bias the results I get the same thing finally, indeed, good to know what that does, I never knew from using the command in Rhino.
Why did my use of a plane shut this down so badly though?! Crazy command.
I've enclose a working script for the record.…
Added by Nik Willmore at 12:47am on February 26, 2016
using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types;
using System; using System.IO; using System.Xml; using System.Xml.Linq; using System.Linq; using System.Data; using System.Drawing; using System.Reflection; using System.Collections; using System.Windows.Forms; using System.Collections.Generic; using System.Runtime.InteropServices;
/// <summary> /// This class will be instantiated on demand by the Script component. /// </summary> public class Script_Instance : GH_ScriptInstance { #region Utility functions /// <summary>Print a String to the [Out] Parameter of the Script component.</summary> /// <param name="text">String to print.</param> private void Print(string text) { /* Implementation hidden. */ } /// <summary>Print a formatted String to the [Out] Parameter of the Script component.</summary> /// <param name="format">String format.</param> /// <param name="args">Formatting parameters.</param> private void Print(string format, params object[] args) { /* Implementation hidden. */ } /// <summary>Print useful information about an object instance to the [Out] Parameter of the Script component. </summary> /// <param name="obj">Object instance to parse.</param> private void Reflect(object obj) { /* Implementation hidden. */ } /// <summary>Print the signatures of all the overloads of a specific method to the [Out] Parameter of the Script component. </summary> /// <param name="obj">Object instance to parse.</param> private void Reflect(object obj, string method_name) { /* Implementation hidden. */ } #endregion
#region Members /// <summary>Gets the current Rhino document.</summary> private readonly RhinoDoc RhinoDocument; /// <summary>Gets the Grasshopper document that owns this script.</summary> private readonly GH_Document GrasshopperDocument; /// <summary>Gets the Grasshopper script component that owns this script.</summary> private readonly IGH_Component Component; /// <summary> /// Gets the current iteration count. The first call to RunScript() is associated with Iteration==0. /// Any subsequent call within the same solution will increment the Iteration count. /// </summary> private readonly int Iteration; #endregion
/// <summary> /// This procedure contains the user code. Input parameters are provided as regular arguments, /// Output parameters as ref arguments. You don't have to assign output parameters, /// they will have a default value. /// </summary> private void RunScript(bool bake, List<GeometryBase> G, Point3d L, Color C) { COL = C; LOCATION = L; NAME = ""; pnts.Clear(); crvs.Clear(); breps.Clear();
foreach(GeometryBase geom in G){ switch(geom.GetType().Name){ case "Point": pnts.Add(((Rhino.Geometry.Point) geom).Location); break; case "Curve": //create a new geometry list for display break; case "PolyCurve": crvs.Add((PolyCurve) geom); break; case "Brep": breps.Add((Brep) geom); break; default: Print("Add a new case for this type: " + geom.GetType().Name); break; } }
if(bake){ Rhino.DocObjects.InstanceDefinition I = doc.InstanceDefinitions.Find(NAME, false);
if(I != null) doc.InstanceDefinitions.Delete(I.Index, true, true);
int index = doc.InstanceDefinitions.Add(NAME, "description", Point3d.Origin, G); doc.Objects.AddInstanceObject(index, Transform.Scale(L, 1)); } }
// <Custom additional code> //GEOMETRY Lists to display
List<Point3d> pnts = new List<Point3d>(); List<PolyCurve> crvs = new List<PolyCurve>(); List<Brep> breps = new List<Brep>();
string NAME; Point3d LOCATION; int THICKNESS = 2; Color COL;
//Return a BoundingBox that contains all the geometry you are about to draw. public override BoundingBox ClippingBox { get { return BoundingBox.Empty; } } //Draw all meshes in this method. public override void DrawViewportMeshes(IGH_PreviewArgs args) {
}
//Draw all wires and points in this method. public override void DrawViewportWires(IGH_PreviewArgs args) { foreach(Point3d p in pnts) args.Display.DrawPoint(p, Rhino.Display.PointStyle.ControlPoint, THICKNESS, COL);
foreach(PolyCurve c in crvs) args.Display.DrawCurve(c, COL, THICKNESS);
foreach(Brep b in breps) args.Display.DrawBrepShaded(b, new Rhino.Display.DisplayMaterial(COL));
args.Display.DrawPoint(LOCATION, Rhino.Display.PointStyle.ActivePoint, 3, Color.Black); args.Display.Draw3dText(NAME, Color.Gray, new Plane(LOCATION, Vector3d.ZAxis), THICKNESS / 3, "Arial"); }
// </Custom additional code> }…
inner As Curve() = section.ToNurbsCurve().Offset(normal, pc, -plate, 1e-3, 1e-4, Rhino.Geometry.CurveOffsetCornerStyle.Sharp)
the error message is:
"
{0}0. Error: Het oplossen van de overbelasting is mislukt omdat dit aantal argumenten door geen enkele toegankelijke Offset wordt geaccepteerd. (line 104)
"
this is the VBA script:
"Option Strict OffOption Explicit On'Import SDK and Framework namespacesImports RhinoImports Rhino.GeometryImports Rhino.CollectionsImports GrasshopperImports Grasshopper.KernelImports Grasshopper.Kernel.DataImports Grasshopper.Kernel.TypesImports GH_IOImports GH_IO.SerializationImports SystemImports System.IOImports System.XmlImports System.DataImports System.DrawingImports System.ReflectionImports System.CollectionsImports System.Windows.FormsImports Microsoft.VisualBasicImports System.Collections.GenericImports System.Runtime.InteropServices'Code generated by Grasshopper(R) (except for RunScript() content and Additional content)'Copyright (C) 2011 - Robert McNeel & Associates<System.Runtime.CompilerServices.CompilerGenerated()> _Public Class Script_Instance Implements IGH_ScriptInstance#Region "Members" ''' <summary>List of error messages. Do not modify this list directly.</summary> Private __err As New List(Of String) ''' <summary>List of print messages. Do not modify this list directly, use the Print() and Reflect() functions instead.</summary> Private __out As New List(Of String) ''' <summary>Represents the current Rhino document.</summary> Private doc As RhinoDoc = RhinoDoc.ActiveDoc ''' <summary>Represents the Script component which maintains this script.</summary> Public owner As Grasshopper.Kernel.IGH_ActiveObject#End Region#Region "Utility functions" ''' <summary>Print a String to the [Out] Parameter of the Script component.</summary> ''' <param name="text">String to print.</param> Private Sub Print(ByVal text As String) __out.Add(text) End Sub ''' <summary>Print a formatted String to the [Out] Parameter of the Script component.</summary> ''' <param name="format">String format.</param> ''' <param name="args">Formatting parameters.</param> Private Sub Print(ByVal format As String, ByVal ParamArray args As Object()) __out.Add(String.Format(format, args)) End Sub ''' <summary>Print useful information about an object instance to the [Out] Parameter of the Script component. </summary> ''' <param name="obj">Object instance to parse.</param> Private Sub Reflect(ByVal obj As Object) __out.Add(GH_ScriptComponentUtilities.ReflectType_VB(obj)) End Sub ''' <summary>Print the signatures of all the overloads of a specific method to the [Out] Parameter of the Script component. </summary> ''' <param name="obj">Object instance to parse.</param> Private Sub Reflect(ByVal obj As Object, ByVal method_name As String) __out.Add(GH_ScriptComponentUtilities.ReflectType_VB(obj, method_name)) End Sub#End Region ''' <summary> ''' This procedure contains the user code. Input parameters are provided as ByVal arguments, ''' Output parameter are ByRef arguments. You don't have to assign output parameters, ''' they will be null by default. ''' </summary> Private Sub RunScript(ByVal p0 As Point3d, ByVal p1 As Point3d, ByVal p2 As Point3d, ByVal pc As Point3d, ByVal plate As Double, ByVal itt As Integer, ByVal dev As Double, ByRef crvout As Object, ByRef crvin As Object, ByRef sec As Object, ByRef opp As Object, ByRef div As Object, ByRef pt4 As Object) 'your code goes here… opp = "test01" Dim section As New Polyline(5) section.Add(p0) section.Add(p1) section.Add(p2) section.Add(pc) section.Add(p0) Dim normal As Vector3d = vector3d.CrossProduct((p1 - p0), (p2 - p0)) Dim area As Double Dim chicken_int As Int32 = 0 Dim XX As Double Dim YY As Double Do chicken_int += 1 If (chicken_int > itt) Then Exit Do 'Compute the section offset Dim inner As Curve() = section.ToNurbsCurve().Offset(normal, pc, -plate, 1e-3, 1e-4, Rhino.Geometry.CurveOffsetCornerStyle.Sharp) Dim edges As New CurveList(inner) edges.Add(section.ToNurbsCurve()) crvin = edges Dim sections As Brep() = Brep.CreatePlanarBreps(edges) If (sections Is Nothing) Then Exit Do opp = "test02" 'Compute the centroid of the current section Dim am As AreaMassProperties = AreaMassProperties.Compute(sections(0)) Dim ct As Point3d = am.Centroid XX = am.CentroidCoordinatesMomentsOfInertia.X YY = am.CentroidCoordinatesMomentsOfInertia.Y area = am.Area Dim dx As Vector3d = pc - ct 'Compute the error of the current centroid Dim dl As Double = dx.Length div = dl 'Update output values crvout = section crvin = inner sec = sections(0) opp = area If (dl < dev) Then Exit Do 'Adjust outline with a boosting factor. section(3) += dx * 4 Loop pt4 = section(3) crvout = section End Sub '<Custom additional code> '</Custom additional code> End Class
"…
s. (Go to RCE Tabs)
Normaly a compoment is disable.
Fill the 3 parameters: name, e-mail and company.
Enable the component with the right mouse button on the component and enable.
A file is created here:
C:\RhinoDeveloppements\RhinoCivilEngineering\license\licence_a_envoyer.txt
Send it to this address:
rhinodeveloppements@gmail.com
You will receive your license within 24 hours
----------------------------------------------------------------------
Pour procéder à la requête de licence, merci de suivre ces étapes.
1. Installer RhinoCivil Engineering
2.Charger Rhinoceros et Grasshoper
3.Glisser Déposer le composant RCE Protection sur le canevas de Grasshopper.(Sur le panneau RCE)
Normalement le composant est désactiver.
4. Remplir les 3 paramètres: Nom, Adresse mail et société.
Activer le composant avec un clic droit sur le composant et "enable"
Un fichier est alors créer ici:
C:\RhinoDeveloppements\RhinoCivilEngineering\license\licence_a_envoyer.txt
Envoyer le à cette adresse:
rhinodeveloppements@gmail.com
Vous recevrez votre licence dans les 24 heures.…
he picture (4).
Previously, I had a problem with generating intersections between the two directions of the beams, but a colleague helped me by extending beams, so there was no problem with lines of intersection. But this solution has generated curl (5) at the highest vertex geometry, which I ignored in order to repair it before printing, perhaps this mean my problem with my beam spread properly. Only when the beams is 19, does not jump no problem, but I still can not distribute them properly.
(1)
(2)
(3)
(4)
(5)
I tried to show as simply as possible by removing or signing my code in GHX file.
Thank you in advance for your help
…
rameters, which forces the user to connect all three curve input parameters (even if only 2 are required) to avoid the message 'Input parameter ... failed to collect data'. How can I set up the curve inputs so that null values are valid? I'm currently registering these as curve parameters as below, and suspect the answer lies in using a different method for parameter registration.
protected override void RegisterInputParams(GH_Component.GH_InputParamManagerpManager)
{
pManager.Register_SurfaceParam(
"Reference Surface", "S", "Surface on which laths are to be generated", GH_ParamAccess.item);
pManager.Register_CurveParam(
"Surface curves 1", "Curves 1", "Set of curves across surface in first direction", GH_ParamAccess.list);
pManager.Register_CurveParam(
"Surface curves 2", "Curves 2", "Set of curves across surface in second direction", GH_ParamAccess.list);
pManager.Register_CurveParam(
"Surface Curves 3", "Curves 3", "Set of curves across surface in third direction", GH_ParamAccess.list);
pManager.Register_DoubleParam(
"Lath Offsets 1", "LO1", "Offset from surface to centreline of first layer", 0.0, GH_ParamAccess.item);
pManager.Register_DoubleParam(
"Lath Offsets 2", "LO2", "Offset from surface to centreline of second layer", 0.0, GH_ParamAccess.item);
pManager.Register_DoubleParam(
"Lath Offsets 3", "LO3", "Offset from surface to centreline of third layer", 0.0, GH_ParamAccess.item);
pManager.Register_IntegerParam(
"Seed Value (0, 1, 2)", "Seed", "Seed value for weave offsets (0 for no weave, 1 or 2 for weave)",0, GH_ParamAccess.item);
}
Thanks!
Alex
…
Added by Alex Baalham at 9:48am on October 1, 2012
ails.
Some word about the mesh... (see Image_01)
I took a flat 4 points NURBS surface as imput (very easy, it defines the total area of my pavilion) and some points (that defines the contact with the ground).
Then I extracted a grid of points from the NURBS (Surface_Util_Divide surface) and compared 'em with the contol points, in order to associate to each grid's point its own attractor (Vector_Point_Closest Point).
Than I moved the points down. I used the distance from each point to its attractor (inverted) as amplitude for the vector of the movement, in order to say: the nearer you are to the control point, the more intense your movement will be. During this operation I've passed the distances' data list into a graph mapper (Params_Special_Graph Mapper), in order to regulate in a very intuitive and interactive way the shaping of my canopy.
At the end of the process I asked GH for a simple Delaunay mesh (Mesh_Triangulation_Delaunay Mesh). It's a very cool command, I believe!!!
Ok, now some word about the component, it's design and it's repetition/adaptation to the mesh...
(see Image_02)
I took the mesh and extracted components on first and faces's information on second. Then I selected and separated the vertexes (1°, 2°, 3°) of each triangular face into threee well defined list.
Then I re-created the triangles' edges. Please pay attention because it's not the same if you use output information from Delaunay components, because here we need a justapposition of edges where triangles touches each others.
After this work I joined the edges and found their centroid. At the same time I found the mid point of each edge.
Now the component... (see Image_03)
It' a little bit longer to describe: I'll try to be synthetic.
Substantially it is a loft from a curve to a point, repeated three times for each triangle (Surface_Freeform_Extrude Point). The point is an elevation of the centroid of the triangle (you can choose if the exstrusion has a single height or it's related to an attractor. In my case it was fixed). The curve is combination of things. There's an arch, which starts on the edge (there's an offset from the corner) end terminates on the same edge (on the other side, obviously). While it's generation the arch passes through a third point which belong to another segment. This last connects the mid point of the original edge (base triangle) with the centroid. The result is a kind of polyline, with two segments and an arch. If you go back to the image of the component that I posted probably you'll understand what I'm saying better than with the definition.
The posit…
sophy though, I have a rudimentary grasp of the Ancient Greeks and modern schools of thought such as Existentialism and Pragmatism, but there is certainly no depth in my understanding. However here the same rule applies. You can quote philosophy all you want, but unless you understand that which you're channelling you can be -at best- accidentally correct.
According to you, these are all vital characteristics:
Aesthetic judgement
Intuition about spatial effectiveness
Knowledge of construction materials & assembly systems
Consideration of performance-driven design properties
Mad synthesizing skillz
[1] and [2] are pretty much worthless, especially when we're dealing with students. Aesthetic judgement is not something that can be wrong or right. You can hone your aesthetic skills but you cannot cultivate better tastes. Intuition is also problematic. It's basically a stand-in for argumentation. Instead of saying "these buildings have to have 20 meters apart because of wind/sound/human perception/human psychology/light/shadow/etc. etc" is a far stronger statement than "these buildings have to have 20 meters apart because of my feelings". Who are you to be trusted? If you have a long and distinguished career backing you up, maybe your opinions carry some weight, but until that point you'd better be prepared to justify your decisions with cold hard logic and data.
[3] is certainly important for certain jobs in construction, but it can be argued that implementation details are not necessarily central to a design. One can design a good computer interface without having to be able to program, and certainly without being familiar with all the idiosyncrasies of a particular programming language. Conversely, one can design an excellent space without knowing exactly how strong certain atomic bonds are. If what you design is physically impossible, then obviously something has to change, but it doesn't mean that the design as an abstract idea was bad. Of course on the other hand one can argue that designing impossible things is not doing anyone any favours. I'm not exactly certain where I stand on this issue, probably comfortably in the middle; YES, students need to learn about what can be build in the physical world, but NO that is not part of design training.
I'm not quite sure what [4] means.
[5] is true for a lot of professions, not just Architects. I would concede that architects probably have more to take into account than most designers and that it is indeed an important skill to have.
I would say that -especially for students, who have little experience- an incredibly important skill to be able to ask yourself "why am I doing this?" about pretty much every decision you make. Basically you need to get very comfortable applying the Socratic method to everything you do.
--
David Rutten
david@mcneel.com
Tirol, Austria…
Added by David Rutten at 11:03am on August 14, 2013
ctor. I do not dispose of any IGH_Goo instances, mostly because I have no idea when an instance is truly no longer needed. If any of your fields need to be disposed, you may have to implement a destructor, but I have no experience with this.
2) should I pass those classes to other parameters by DA(0, MotherClass.Duplicate?) or it is already there by GH_Goo ?
IGH_Goo is not duplicated by default. If you use DA.GetData() and ask for IGH_Goo types, you'll get a reference to the same instance as exists. Thus, if you take in an instance of your type, modify and output it, you should duplicate it yourself. But you only need to do this if you change the state of an instance.
MyGooType data = null;
if (!DA.GetData(0, ref data)) return;
data = data.Duplicate() as MyGooType;
data.Property = newValue;
DA.SetData(0, data);
3) should I create ChildClass and MotherClass in SolveInstance, or create it once as a component's field and then change theirs properties and pass it to DA (as duplicate ?)....
It's almost always better to use variables with the lowest possible scope. So method variables are preferred to class variables, class variables are preferred to static variables.
4) if I create those classes in SolveInstance, is it necessary to Dispose them there ?
NO! Do not dispose of instances that are passed on to output parameters. Disposing objects typically makes them invalid, so if you share instances with anyone else, you should not dispose them or the other code may well crash. However I don't think your types need to be disposable so this is a moot point now.
In general, if you're dealing with disposable types, and the instances aren't shared, then you dispose them as quickly as possible. But if they are shared it's a lot more complicated.
5) finally - maybe it would be better if MotherClass inherits the ChildClass ?
Maybe. Not necessarily. Depends on the classes. …
Added by David Rutten at 12:08pm on December 31, 2014