g from a list of 12 items I would find all the combinations taking just 4 at time.
I'd use a Stream gate that takes the indexes of the items and pass them to a list item in order to select just the items of the combination. Doing so I can choose a single combination of index at time to pass to the list item.
In this moment all the data come out from the first gate, all the others are empty.
If I pass these index to the list item it gives me an error (probably because of the data structure).
*long version*
I start from a list of 12 segments, all of them with the starting point in common and the ending point distributed regularly in the space. It's a quite simple starting point.
What I'm trying to achieve is to find all the possible spatial configurations made of 2, 3, 4 segments. I started with 2 segments so I've 12^2=144 possible configurations but just 4 different configurations that can intuitivelly be recognized (60°, 90°, 120°, 180°).
Doing the same with 3 segments generates 12^3=1728 configurations and I don't know how many different ones. With 4 segments I've got 12^4=20736 possible configurations.
As you can imagine many configurations are identical but just with a different orientation so at the end I'll have to parse geometrically the output to delete duplicates (I'll address this later on).
Please could you help me to figure out how to mix these segments in different configurations?
Thank you in advance.…
per bake commands to bake the connected geometry with the corresponding materials.
mxDiff is a simple diffuse material. Only reflectance color for 0° and 90° are exposed.
mxEmit is a basic emitter material. You can set light color, power and efficiacy of the emitter.
mxBasic is the most complex material for now. You can set all the properties of a single layer material including. Use this for transparent materials.
mList is your way if you don't want to create your own materials. This component returns a list of all the materials on the Maxwell scene manager. Make sure this is evaluated after you add your own materials if you want to see them in the list.…
complicated than it seems as I have an event and a subscriber method receiving data from a serial port.
In the code below, the strings received within myReceivedLines appear when connecting with the serial port (when connecttodevice is true). However they disapear when I launch another command (when homeallis true).
As you recommended in your reply, I have added the field called myReceivedLineswithin the class so that I could use the method String.Add() to all the feedback received and commands sent.
Why does the feedback dispear when a command is sent? Is the string going to myReceivedLine disappearing because they happen within a subscriber method or is it related to the DA.SetDataList() method used to assign myReceivedLinesto the output?
Many thanks!
public class SendToPrintComponent : GH_Component { //Fields List<string> myReceivedLines = new List<string>(); SerialPort port; //subscriber method for the port.DataReceived Event private void DataReceivedHandler(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; while (sp.BytesToRead > 0) { try { myReceivedLines.Add(sp.ReadLine()); } catch (TimeoutException) { break; } } } protected override void SolveInstance(IGH_DataAccess DA) { //Opening the port if (port == null) { string selectedportname = default(string); DA.GetData(1, ref selectedportname); int selectedbaudrate = default(int); DA.GetData(2, ref selectedbaudrate); //Assigning an object to the field within the SolveInstance method() port = new SerialPort(selectedportname, selectedbaudrate, Parity.None, 8, StopBits.One); //Enables the data terminal ready (dtr) signal during serial communication (handshaking) port.DtrEnable = true; port.WriteTimeout = 500; port.ReadTimeout = 500; } //Event Handling Method bool connecttodevice = default(bool); DA.GetData(3, ref connecttodevice); if (connecttodevice == true) { if (!port.IsOpen) { port.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); DA.SetDataList(0, myReceivedLines); port.Open(); } } else if (port.IsOpen) { port.DataReceived -= new SerialDataReceivedEventHandler(DataReceivedHandler); port.Close(); } if (port.IsOpen) { DA.SetData(1, "Port Open"); } //If the port is open do all the rest if (port.IsOpen) { bool homeall = default(bool); DA.GetData(5, ref homeall); //Home all sends all the axis to the origin if (homeall == true) { port.Write("G28" + "\n"); myReceivedLines.Add("G28" + "\n"); DA.SetDataList(2, myReceivedLines); } } else { DA.SetData(1, "Port Closed"); } }}…
te some implications and questions so I will go one by one:
"Now I would like to use a single VRay material as a template for creating multiple identical materials"I hope this will work, but as VRay does not expose any SDK, I would not guarantee any specific result.
"Now I need to add them to the document material table"This is done with a reference to a document instance, such as the one you get with the code doc.Materials (both in C# and Vb.Net).
"I'm not going to learn C# to modify his script"That's a pity, it would be nice to pass on this troublemaker to somebody else! :)Btw, C# and Vb.Net are very very similar. This script could be written in Vb.Net too.
"Reference to a non-shared member requires an object reference. (line 96)"This only means that you need to access the Materials property on an instance, not on the type (class) name. Change that line using what is written at point 2.
"Do I understand that the material has to be assigned to a particular object in order to enter the Material Table?"No it does not. But if you call the _Purge command it will be removed if it does not have an object that references it.
"Can I assign it to a Layer instead?"You do not need to. But this would be achieved with doc.Layers[whichLayer].RenderMaterialIndex = materialIndex; in C# or doc.Layers(whichLayer).RenderMaterialIndex = materialIndex in Vb.Net.
"Any ideas? A better way to do this?"If you found a way to bypass the VRay SDK not being there, this should work.
"Giulio's component has a type hint defined as a Material"It does not any longer. The hint was there in earlier versions of Grasshopper, but now the hint has disappeared. This is not so bad, and it is also the only way you would be able to use either a Material instance already or a string for a material name.
"How was that done?"Probably it was done in an older version of Grasshopper. But which version are you using?
"I can't figure out how to cast the input as a Rhino.DocObjects.Material, so you can see that I have cast it as a compatible type in the first 2 lines... is there a cleaner way?"That sounds like a good way actually. Be sure your component responds properly when something wrong is inputted, though.Dim mTemp As Rhino.DocObjects.Material = CType(M, Rhino.DocObjects.Material)in one line might also work. See msdn for more conversion operators and functions.
I hope this helps,
- Giulio_______________giulio@mcneel.com…
years ago of a custom board I made with an ATMega Tiny44 microcontroller and a light sensor (really simple board): https://vimeo.com/16596268. But, it worked quite well.
There's a couple of things to remember. First, when sending data from your board to Grasshopper, you need to make sure that you add a carriage return and new line feed characters to the end of your print statement. Normally, when using the Arduino IDE, this is handled by simply using a Serial.println(); function... which automatically adds those two characters onto the end of the line. You need these two characters, because Grasshopper needs some way to determine where the 'end of the line' that you're sending is. If you add those two characters onto your string, then you can read that data in to Grasshopper using the Generic Serial Read component. You can parse up the string (depending on how you format it) using the built in Grasshopper string components (or write your own script if you prefer).
Sending data from Grasshopper to your board is pretty simple (actually, it's already done if you use the Generic Serial Write) assuming your device shows up as a COM port on your computer (and you open that port before writing the data). However, you'll likely need some code to translate the incoming string into some meaningful information to send to whatever pins on your microcontroller. This is basically what the Firefly Firmata is for. But, this is built specifically for the Arduino pin configuration... so it likely wouldn't work here. But, you may be able to translate some of the same functionality from the firmata into your code.
Hopefully this helps get you started.
Best,
Andy…
if you can't resolve the details ... well ... they do that as well. For Europe contact my good friend Peter Stevens. (BirdAir).
In general: PRIOR designing ANYTHING (at all) you must formulate some kind of collaboration with a specialized manufacturer. Problem is that ... er ... if they don't know you they don't give much attention (this is a rather "closed" AEC sector).
On the other hand if your membrane is bespoke designing the components (anchor plates, masts, tensioners etc etc) and/or using bespoke ones available in the market (not many around. mind)... well ... this IS the core of the matter. Rhino is NOT suitable for that kind of stuff by any means.
Kangaroo 1/2 is the way to go when inside GH. Other apps especially the "pro" ones are very expensive. BirdAir has the best software for that matter but is mostly an internal product available as well only for few "strategic" partners as they call Architects who can design that kind of stuff.
Other than that have some fun:
Tensile Membranes test3 - Grasshopper
And this ... well ...is about NOT doing it:
Need help about using Kangaroo for form finding
…
t Houdini is fantastic for, more stability, faster processing. Yay for Houdini! It's a great product. You may be surprised to find that many people - some here - actually use both products. For different things.
Your posts turn into bizarre quests...your recent ravings have you careening from Rhino to Revit to Maya to ZBrush to Houdini, all the while bitterly lambasting McNeel for not implementing everything perfectly. You insult everyone along the way, and to top it off, launch into self-aggrandizing, astonishingly delusional claims..."the most beautiful images!" "the greatest breakthrough for Rhino!" This last claim refers to what is more or less a Pythonic macro that saves Rhino files, spins up a COM instance of ZBrush, calls some commands, then brings it back. That can be useful to people who have ZBrush...but really? So very very great, as you insist? As you shout at the top of your lungs how wonderful you are, and how like peasants everyone else is? It's a macro, dude.
I can only guess that your most recent, exaggeratedly unhinged and increasingly personal attacks on pretty much everyone else here are you now actually trying to get banned, just so that you can feel even better about yourself (if it's possible), and as some form of justification for your self-righteousness. But your act is both so very loud, and so very tired; and more importantly, you'll never see how you miss the point on so many levels...really, if it's so terrible here, you could preserve some modicum of dignity and bring your gaudily baroque, self-important roadshow to the next software package that you inevitably be disappointed by, either because the community there also doesn't somehow see your "genius," or because it breaks on occasion.
Really, just go.…
Added by David Stasiuk at 2:10pm on October 24, 2017
o sensor Shield V5.0 - 2 standard servos (plugged into pins 9 and 10 in the sensor shield) - 7.5V wall power supply - USB cable to computer
I'm running Rhino SR 8 on a 32 bit Windows Vista machine I have Version 0.9.0014 of grasshopper (the latest) and Firefly_Build_1.0067 I have flashed my Arduino board with the latest firefly firmata (updated September 10th, 2012)
I have checked that I am using the "MEGA write" box I have got the right bits going to the right pins and I have checked that they all have "servo" ticked instead of "digital" or "pwm"
My servos and board work perfectly well with the normal Arduino software, but just not any longer with firefly since my computer was switched off.
The port shows correctly as COM 4 and opens fine.
When I move the slider to control the servos, the TX light is on and the RX light flashes, but no servos move... (everything works with the sweep example in arduino though, so I have eliminated power and wiring issues)...
Any ideas what might be the problem?
I've tried re-installing, switching off and on many times, changing cables, trying a different board (also doesn't work any more with the duemilanove), trying all pins on the shield, trying one servo without the shield, trying one servo with the shield, lots of googling, lots of searching forums, unblocking the firefly installation files in explorer, lots of things... I'm all out of ideas... And very confused as it was working just a few days ago... Am I just missing something really obvious or could there be an issue with the software at my end?…
edefining the axis variables, logarithmic scales, display thresholds, better marking management - or at least add contrast!
Hey Fred,
thanks for the feedback! This is a basic version, and personally I used a custom component to read and parse the history files from the canvas to be able to e.g. scroll through generations and solutions or display more solutions at once (via pathes, mostly requires modification of the initial setup) ...
but you are right. I would love to bring the solution's navigation directly into the rhino viewport but I think that would be a major hack .. unless you can give me a hint how to do that. the displaying and user-preference-handling are besides a re-entrant history, some more algorithms and parallelization the next things to tackle, but display is definitely one of the easiest, so ... soon! work will begin in january i guess, since the project then starts i hope - but it will start for sure.
best
r
…