If I put that function on a new thread I couldnt find a way to update the component later correctly.
What is the bast and probably simple way to run just one function that updates a variable (or it can return one, but I thought that a global one is a bit better) in the background without blocking?
Thanks
T
private static String results = String.Empty;
private static Boolean tDone = false;
protected override void SolveInstance(IGH_DataAccess DA)
{
List<Line> lines = new List<Line>();
if (!DA.GetDataList(0, lines)) { return; }
// can take a lot of time to finish!!
// this updates the global "results" string
DoSomeHardWork(lines);
DA.SetDataList(0, results);
string bb = Convert.ToString(tDone);
DA.SetData(1, bb);
}…
Bit Platforms
OOo 3.0,built by Sun, is built for a 32 bit Windows but also runs on 64 bit. To run cli applications on 64 bit one needs to have the 32bit .Net Framework installed (version 3.5 as of OOo 3.0). The application must be built for the x86 platform (see platform switch of csc.exe), otherwise it will not run. If it uses anycpu or x64 then the application will be loaded in a 64 bit process. In order to connect to OOo and creating the bridge, the process must load a couple of dlls from OOo, which are 32 bit dlls. This does not work and a System.BadImageFormatException is thrown.
So, to use the spreadsheet components that use OpenOffice I think you will need Rhino 4.0 or the 32-bit version of Rhino 5.
Did this help?
- Giulio
______________
giulio@mcneel.com
McNeel Europe, Barcelona…
your surface in order to do it with more control points, these new points will be attracted by curves and moved on z by a factor depending on distance from curve, changed by graph mapper and by a constant thickness. This will give you 2 surfaces, one unchanged an another on the top. These surfaces will be closed by lofting their edges and joined.
The closed surface will be meshed and send to bowerbird waffle.
…
pper, it appears that half of the surfaces are now flipped (normals now pointing to the inside of the polysurface). I've tried to use a guide surface, I tried offsetting points along the normal to test for inclusion and then flip. I've even tried to flip normals manually by mutliplying the normal by -1.0...no matter what I try, can't seem to get all surfaces to be in the same orientation. Any insight would be appreciated...
Using:
Rhino SR6 on win xp
Grasshopper version 0.6.0019
Thanks!
~BB~
here's an image of what i get when i do the dir command in rhino:
here's what i see when i display normal vectors in grasshopper:
…
f my list.I don't understand why, but I guess I must be too young user ^^In the original list, i have a path {0;0;0;4} with two index and after the random node, {0;0;0;4} has 88 index.Items are not correct?I would have a comparable structure has the right list on my jpg (photomontage...)How I can do that?Thank you in advance
…
erencing it back into our main .gh file works normally (with full functionality) as long as all the files are on my local hard drive (e.g. "C:"). But as soon as I try to reference a .ghcluster or even open one saved on an external drive (our company's network drive) Rhino and Grasshopper instantly freeze und crash. Every time. No matter the file size.
We have already checked, if maybe whitespaces or dots in the file's path could have caused the crashes. But even eliminating them by renaming the folders doesn't fix the problem.
So obviously GH's clusters does not support referencing files from external network locations. Does anyone have an idea why? Were stuck here, because we want to severely increase the complexity of our project's main gh. file and enable more team members to contribute to the main file via external referenced cluster files.
Thanks for your help.
BB…
fear that it would be too hard, but I was pleasantly surprised. Not that bad, even for a C# novice. I am attaching the *.cs files for three components:
SerialCreate component creates the serial port instance. This component controls port parameters and opens/closes the port. (It won't close the port, however.) SerialWrite and Read try to interact with the port created by SerialCreate. I can verify that the port opens because it's unavailable to other terminal applications, but if I try to close the port, it won't...it stays open until I restart Rhino. SerialWrite works, because I can see the rx light on my device light up when I enter text in grasshopper. SerialRead does not work. I blue screen with a DPC WATCHDOG VIOLATION.
All in all, not too bad for a day's work. I'll forget the user objects and go for custom components. The question that still remains is that I don't think I'm correctly or efficiently sharing the serial port instance with the other classes. Again, this is just a hack, but I'm happy I'm closer to solving the problem (or so it seems). If anyone has any ideas about how to better go about this, I'd appreciate any suggestions.
Thanks again,
~BB~…
ey eventually recover and you can continue to working normally. This however is not very practical...
(Additional information: We have a virtualized Windows SPS environment, might this be the problem? Locally - on my hard drive - it works fine.)
Futhermore we've discovered the following bug/feature:
We export a cluster and reference it back into our .gh file, then copy the .ghcluster file to a different location and rename the copy (without opening or changing it), then also reference the copied version back into the .gh file. Now Grasshopper shows two clusters with two different file paths, but claims that they both are the same ("this cluster occurs twice in this document"). If I double click one of them, make a change and save, both clusters get changed, even though they are separate .ghcluster files.
This would follow the logic that David laid out in this entry (http://www.grasshopper3d.com/page/clusters09), that GH identifies a cluster not by its file name or location but by its internal ID.
An addition we would very much appreciate for the next GH update, would be the option to right click a referenced cluster and then not only be able to "update" it but to also to "relink" it to a new or different source.
Right now you have to rename or delete the .ghcluster file in order to relink a cluster via the update option. You can also overwrite the old cluster und update. However, sometimes we want to keep the old version or disentangle one of a clusters many instances and relink just one, with out loosing its various inputs and outputs by referencing the new version and reconnecting it.
Thanks, BB.…
even (0, 2, 4) then that means the point either never hit it, or went in and out again, meaning it's outside. If it hits an odd number of times, then it must have come from within originally.
The method implements this approach using the mesh bounding box, and then striking a polyline from your test point along a vector that is defined by the upper right corner of the bounding box + a vector of (100,100,100). In the case of your failing points, this is a result of their striking an edge very precisely, which gets counted as 2 hits instead of 1 (as it should be getting captured) and passing false:
Your best bet is probably to roll your own implementation, that tests for multiple vectors:
private void RunScript(List<Point3d> P, Mesh M, ref object A, ref object B, ref object C) {
BoundingBox bb = M.GetBoundingBox(false);
List<bool> inside = new List<bool>();
for (int i = 0; i < P.Count; i++) {
Polyline a = new Polyline(); Polyline b = new Polyline();
a.Add(P[i]); b.Add(P[i]);
a.Add(bb.Max + new Vector3d(100, 100, 100)); b.Add(bb.Max + new Vector3d(100, 150, 150));
int[] fa; int[] fb;
Point3d[] xa = Rhino.Geometry.Intersect.Intersection.MeshPolyline(M, new PolylineCurve(a), out fa); Point3d[] xb = Rhino.Geometry.Intersect.Intersection.MeshPolyline(M, new PolylineCurve(b), out fb);
inside.Add(xa.Length % 2 == 1 || xb.Length % 2 == 1);
checkA.AddRange(xa, new GH_Path(i)); checkB.AddRange(xb, new GH_Path(i));
}
A = inside;
}
…
Added by David Stasiuk at 10:20am on October 10, 2017
a pain to use sometimes. I recently found this great post:
http://www.grasshopper3d.com/forum/topics/formatting-numbers-in-grasshopper
which points to the msdn .net framework standard numeric format strings:
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx
and the custom ones too:
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
Sooo... today I was trying to make a 2D array generator for RGB values to use with a RGB LED and an Arduino. For instance, declaring a 2D array in Arduino:
int color[3][3]={{255,0,0},{0,255,0},{0,0,255}};
I'm using the blend color component to spit out transitions between two colors. I want the list in the panel to be in the format above, so I used both the expression component and the string format component (are they the same under the hood?). In any case, if I have R, G and B values coming into the component, I want to format them so the come out looking like {R,G,B}, so I can just copy the output in a panel and paste it into the Arduino IDE. But what about {curly braces}. If the expression/format component uses them in it's syntax, for instance:
Format ("{R:0},{G:0},{B:0}",R,G,B)
how do I get them into the formatting string? I tried escaping them like:
Format ("\{{R:0},{G:0},{B:0}\}",R,G,B)
but that just makes the component angry
Escaping characters is explained in the formatting references above. Is it implemented in this component? Should I be looking at a different approach?
I've included a sample file below.
Thanks!
~BB~
…