serveral questions:the first thing is in c++ i have to implement more methods than in my c# test project.
they are:
int MyGhComponent::MasterParameterIndex::get(){ return 0;}void MyGhComponent::MasterParameterIndex::set(int index){ }bool MyGhComponent::IsValidMasterParameterIndex::get(){ return 1;}
i found no hint for the implementation of that interfaces. could someone tell me that is correct ?OK, it works, but is it well writen ? What is the MasterParameterIndex?
the second "bigger" problem is, i want to have an output of an pointlist.X y Z 1.2 1.3 1.12.1 5.2 9.2...
my first approch was to use a
void MyGhComponent::RegisterOutputParams(GH_Component::GH_OutputParamManager^ pManager){pManager->Register_PointParam("Coordinate", "XYZ", "Node-Coordinate");}
and
void MyGhComponent::SolveInstance(IGH_DataAccess^ DA){Collections::Generic::List<GH_IO::Types::GH_Point3D>^ pnt = gcnew Collections::Generic::List<GH_IO::Types::GH_Point3D>(); for (int i = 0; i < 10; i++) { GH_IO::Types::GH_Point3D^ point = gcnew GH_IO::Types::GH_Point3D(i, i, i); pnt->Add(i); } DA->SetDataList(3, pnt);}
but this exampel doesn't work...i wirte a small workaround and use the following
pManager->Register_DoubleParam("X-Koordinate", "X", "X"); pManager->Register_DoubleParam("Y-Koordinate", "Y", "Y"); pManager->Register_DoubleParam("Z-Koordinate", "Z", "Z"); Collections::Generic::List<double>^ pntx= gcnew Collections::Generic::List<double>(); Collections::Generic::List<double>^ pnty= gcnew Collections::Generic::List<double>(); Collections::Generic::List<double>^ pntz= gcnew Collections::Generic::List<double>(); ... add .. ect.
this workaround do the job, but i want a better soulution. and i know somewhere out there sould be a better solution. i want to use 3D Points directly in GH without list conversation.
so somebody a familiar with c++ / cli ? and could give me some tipps or a soulution ?
the first thing is: what is the right RegisterOutputParams ?
and witch data type is the right ? Point3d doesn't work. so i try GH_IO::Types::GH_Point3D and Rhino::Geometry::Point3d ...
br Friedrich…
plug-ins can be found at this website:
http://www.food4rhino.com/?ufh
Th plug-in we were going to focus on yesterday was Kangaroo - a form finding mesh editing software. The instructions for downloading it can be found here, although all computers in the lab should already have it loaded.
http://www.food4rhino.com/project/kangaroo?ufh
Your assignment for next week is found below.
Assignment #6
1. You are to model a membrane shading structure for the WAAC outdoor courtyard adjacent to 1001 Prince Street (seen below).
This is an abstract model - no measurements are required. A basic model would be the walls of the the various building and the ground. Spend a few minutes in the space and get a feeling for what a shading membrane would look like in the space.
2. Use the Kangaroo plug-in to make the mesh. I would look at the tutorials below (do part 2 of the design Analyze as a minimum).
http://www.designalyze.com/tutorial/columbia-meshing-spring-2013-class-04
https://www.youtube.com/watch?v=9i8dGtcQxMk
https://www.youtube.com/watch?v=yY5WU_8L4S8
There is also a manual that comes with the download. It should be on the share file at the WAAC; if not just download it for free at the Food 4Rhino website.
3. It does not matter what your membrane structure looks like, but try to use your eye as a designer. Think about things such as sun angle, experience from both in the courtyard and also from the windows above, support location in the wall etc...
Take a screenshot of the completed image. Do not save to dropbox, but bring to class next week - March 23rd.
Post here if you have any questions. See you all next week!
…
20%3ATopic%3A1241658&page=2#comments), I have some questions regarding the work mechanism of the lighting control in HB/Daysim.
1) Which specific sensor point (out of many) in the "lightingControlGroup" should fulfill the requirement of "lightingSetpoint" (300lux)?
in other words:
Does it mean that the average illuminance calculated from all the "sensorPoints" in the "lightingControlGroup" (insteady of any single sensorPoint) should fulfill the "lightingSetpoint" requirement?
if this is the case:
Why the lighting schedule obtained from DSElectricalLightingUse is different from the lighting schedule obtained by post-processing/checking all the hourly illuminance results at all the sensorPoints? (please see the attach gh file edited from Mostapha's version)
2) What's the difference, if I hook up "lightingControlGroups_" or not, as shown in the RED arrowhead in the attached file? (Because the results are different as well)
3) If I have a large space (like a 40m*70m sports hall) and want to know its annual lightingControlProfiles, do I need a "lightingControl" component to be hooked on to the "readAnnualResultsI" (in order to calculate its annual lightingControlProfiles)?
If needed, how many "testPoints" I should choose to be used as "sensorPoints_" in the "lightingControl" component?
Thank you in advance for your kind help!
Best,
Ding…
uld help me to optimize the script, so it works reliable.
At the end the script should work only by the input of the following informations:
- Top-Curve
- Bottom-Curve
- accuracy ( like poly-count)
- is the bowl an open or closed structure?
This is an example of a good result:
From here its probably the best if you open both attached files, so you understand the problems.
1. Bug:
Offset direction of the bottomcurve needs to be set up by hand sometimes.
The script uses "loft" on a bunch of 3pt Arcs to create transitions. Arc 3pts" needs a "Point B" on the offset of the bottom line. Sometimes the offset is inverted, so i need to change it by hand.
The rule to make it work correct is: "The offset of the bottom line goes into the same direction as the top line, but on the same hight as the bottom line."
How can i implement this in GH?
2. Bug:
The floor generation needs a lot of guessing the right index numbers of lists.
The script uses 2x "Deconstruct Brep" to find the actual bottom curve of the created transition Brep. "Patch" is used to create a floor from this curve.
If the bowl is an open structure, the script creates a line between the endpoints of the bottom curve to close it, in order to create a trimmed "Patch". But again, you have to set up the right Index Numbers by hand...
3. Bug:
If the bowl is an open structure and the endpoints of the top-line and the bottom-line are the same the lofting is not working. At the moment I use a script that finds double points in the list and deletes it.
But the the result is, that the loft is not starting at the beginning or the end. Here is an Image.
I have only a little experience in gh, but i really want to learn more.
Thank you all for your help!…
g by a given diameter and some shapes.
What I've done: 1. diameter definition: to find the final object diameter
2. rails definitions: from a initial rails and diameter definition I've find a scaling factor in order to create the final rails with the same form of initial rails but with the wanted distance from the center.
I find the scaling factor using the ray and the distance of a projected point of initial rail to the plane XZ
3. shapes definitions: like the rails definition. I used more than one shape because sometimes I need particular forms along the path.
The sweep 2 rail component gives me a no good result
I tried the options inside the components in order to manipolate the data, but I don't found the solution.
If I bake the final rails and shapes, the sweep 2 rail in RH (selected object) works well, but in GH no (red object).
I attach the RH and GH files for all who can help me Thanks
Filippo…
pproach that will hopefully work. There's still the last part of putting it all together, but I figured I'd post my progress so you could play around with it if you wanted. This is kind of a lucky situation since its only single face breps and simple trims that are being worked with.
I've attached 3 definitions to this post. The first is my reorganization of your original definition, which creates the surfaces from the point grid and culls out any surfaces that are not "on" the surface so that we don't have to deal with them later down the line. This is done through a small VB component which determines whether any of the corner points lie on the surface. If it does it keeps the surface, if not, then it doesn't. The only issue with this is that in your example file, there are some surfaces which the corner points do not lie on the surface, yet the surface that they create spans the underlying surface. At this point I'm not worrying about those. You mentioned that you only want the surfaces that lie at the edge...this can be done by testing whether all 4 corner points lie on the trimmed surface or not.
The second definition is a coded version of the project function. In the example it will project to all the breps supplied, yet in the final version this probably won't be desired. Also, the direction (z axis) is hard code...this could be swapped out if desired.
The third definition is an shot at trimming a surface with an input curve (that curve happens to be projected). I tried this many ways, but found that the function RhinoCutUpSurface seamed to work alright. The other attempts at doing this directly with through functions available for OnBrep were unsuccessful and very complex. Luckily because the underlying brep is an single, untrimmed surface this function works well for us, but in situations where we have a trimmed or multiface brep we'd be up a creek with out a paddle. The function creates an array of breps, but in our case it will create essentially the same surface split by our curve and joined together as a single brep with two (possibly more) faces. All we have to do is find out which face we want to keep and duplicate that into a separate brep and pass it out of the component. In the example file I'm determining which on to keep based off of the distance from a test point to the centroid of each face.
The other option here, which would trump the need for projection or trimming, would be to extrude the edge curves through the surface in question, and use the BrepSplit function which requires two breps. There would still be the need to sort out what to keep, but if this approach were used, all the split pieces would be separate breps.
So, all the pieces are pretty much working separately, all that I have left to do is put them all together in the base definition. The only thing that is really the hump with that is determining exactly which face to keep. My idea at the moment is to find out which corner of the surface does not like on the base surface and use that to determine which face will be thrown out. This might be one of the easier ways, but will not be rock solid. The other option is to pull a test point that's on one of the faces to the base surface and the other face, then use the distance from test point to the point on the base surface and the distance to the pulled point on the other face to the base surface to figure out which one to keep.
As to sectioning off parts of the solution, you could do this in a number of ways, but here's two simple ones. In a scripting component just add a boolean value to the inputs and put the whole script inside of an if statement that looks at that boolean value. With components just add a boolean gate or a null pattern componet anywhere you want in the stream. Again, hook in a boolean toggle value, and that will stop the info from going to components that are downstream.…
.
as you can see I devided it into 3 parts.
part1: when I try to connect the new shape to the rest of your definition,the plan z,which gives the panels individually when baked(so I can work them individually)doesn't work,apparently there is something missing when I want to explode it.
that is why I connected it to the definition that I already had(part2)( the only cool part about that one is the attractor point)well it kind works,but not really(if you zoom in you can see that there are some parts overlapped and really not looking good).however I much rather your definition because of the option it gives me to work with individual panels when baked(planz).
however it's around 4 am. and I have decided to make some major changes in design (to prepare some closed and open space,I'm talking about part3 that works with the fibonacci like shape,I know it doesnt look really good,but seriously 4am.!).the major problem is that I tried to make a form like that with kangaroo so the shape would be smoother but I wasnt really able to make it with kangaroo,that's why I made it manually in rhino.I was wondering if you can help me make something like this ( not exacly like this) with kangaroo or (if impossible to be made with kangaroo)even helping me optimizing it so it doesnt look as bad,as you can see when I try to work the grasshopper definition on this shape,it gives me different panel sizes for each surface and all of them are to small compared with the overall size of the so-called pavillion(give it 200-500 sq feet (20-50 sq.m).and any suggestions about the shape would be appreciated,please forgive my basic knowledge of rhino and grasshopper,and let's say I wanted to make a shape like these(don't laugh please!)
u promised not to laugh!!!
please help me find the right way!
…
a reply.
Q1. I run two generations in my generation 0 I can distinguish 3 lines...what do they refer to? I got my Fitness as 5 values Heating, Cooling etc and thought there will be 5 lines
Q2. What are values on X/Y/Z axis and color legend? What colors means I got black 409.87 and red 33.63 amd tis dot 99.2:5 and green 2.27:4?
Q3. I can see that in every generation my values are condensed ...of course I shall run this for many more generations... but as result of my simulation which is minimize energy will be the last one that head down?
Q4. I was reading this forum and there is no current way of savings all results for each run ?
Q5. If there are some any general advice how I shall tackle my problem this would be great!
Ps. I will try to run this example over the weekend to see what is the result.
…
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> }…