@ivelin.peychev wrote:
Hi,
What do you mean by serializing RhinoCommon and custom objects to files? You save each object into separate 3dm files?
Then deserialize to put them back in GH?
Thanks in advance.
BR
Ivelin
Posts: 4
Participants: 2
@ivelin.peychev wrote:
Hi,
What do you mean by serializing RhinoCommon and custom objects to files? You save each object into separate 3dm files?
Then deserialize to put them back in GH?
Thanks in advance.
BR
Ivelin
Posts: 4
Participants: 2
@pirouzaan wrote:
Hi, I am trying to get a dynamic output from a C# component to animate the iteration steps, but I can only get the final result out:
private void RunScript(bool trigger, ref object A) { A = 10; if(trigger){ for(int i = 0; i < 10;i++){ System.Threading.Thread.Sleep(200); int num = 10 - i * 1; A = num; } } }
Any hint is very much appreciated!
Pirouz
Posts: 7
Participants: 3
@aristocompasso wrote:
Hi, guys and gals,
We are all familiar with the ease of use when it comes to dragging and dropping a file into Grasshopper canvas. For the supported file types it is wonderful, but when the file type is not supported we have to point to the location of the file and this is a bit cumbersome.
I am adapting a console app to work as a GH component and this drag and drop ability would do the trick for me.
Basically, the console app parses a file, reformats and pipes all the data to make it more manageable downstream. The file is in essence a .txt file, but it requires saving with a specific extension for standards compatibility.What would be the best way to make this drag’n’drop event happen seamlessly in GH, with the creation of a component representation on the canvas, much like the Read File component?
Thank you, my friends!
Posts: 2
Participants: 2
@Nicolas_Azel wrote:
I am attempting to develop a C# grasshopper component and am having a hard time understanding how to take Grasshopper.Kernel.Types and convert or cast them to Rhino.Geometry.
My current goal is to receive
GH_Structure<GH_Curve>
inputs and access their control points. I believe that this requires casting or converting to a RhinoCommon NurbesCurve or Polyline but have struggled to find examples of this. As someone new to C# I’m having trouble working from the documentation.Am I correct in thinking that I should be working with GH_Strucuture inputs, and that these need to be turned into Rhino.Geometry so that the component can access all the great RhinoCommon Methods?
Is there any simple examples of moving from Grasshopper.Kernel.Types.GH_Curve => Rhino.Geometry.Curve?
Any advice or reference to tutorials or examples would be much appreciated.
Posts: 5
Participants: 2
@andreasshe wrote:
Hi there, i am making a waffle system and my aim is to laser cut the ribs, i made the ribs of my shape and am experiencing some problems when am trying to intersect cut the ribs in order to prepare the file for laser cut. My intersection cutting it seems to be too deep, any help would be much appreciated, thanks in advanceWaffle structure 1.gh (10.5 KB)
radial waffle system 1.3dm (4.2 MB)
Posts: 1
Participants: 1
@lionpeloux wrote:
Hi there,
I’m facing a strange issue with a project I wrote before RH6. It is the first time I am launching this project since I am using RH6.
My tool is a C# solution with several project called
TMarsupilami
:
TMarsupilami.MathLib.dll
is a C# lib with math and custom types (MPoint, MVector, MFrame) independent from RH and GH.TMarsupilami.Gh.gha
is an interface to grasshopper with several components and conversion methods (from MPoint to GH_Point, MVector to GH_Vector, MFrame to GH_Plane).When I try to use the C# scripting component with a reference to
TMarsupilami.MathLib.dll
it says it can not load the assembly (It was working 6 months ago).However, If I rename
TMarsupilami.MathLib.dll
toTMarsupilamiMathLib.dll
(removing the dot) it is now working …Can someone confirm there is a problem with loading dll with dot in their name ?
Tks
Posts: 2
Participants: 2
@lionpeloux wrote:
Hello,
I am having a hard time understanding how to position properly an automatically added control (a value list in my case) relative to its parent component.
What I would like to do is load one or many predefined value list when I put my component on the canevas for the first time.
How would you achieve a constant margin (say 30px) between the left part of a component and the right part of a value list ?
public override void AddedToDocument(GH_Document document) { if (Params.Input[3].SourceCount == 0) { // Perform Layout to get actual positionning of the component on the canevas this.Attributes.ExpireLayout(); this.Attributes.PerformLayout(); //instantiate new value list var control = new Grasshopper.Kernel.Special.GH_ValueList(); control.CreateAttributes(); control.NickName = "Load Direction"; //populate value list with our own data control.ListItems.Clear(); control.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("X", "0")); control.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("Y", "1")); control.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("Z", "2")); control.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("XX", "3")); control.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("YY", "4")); control.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueListItem("ZZ", "5")); control.ToggleItem(2); // get the correct bounds of the populated value list control.Attributes.ExpireLayout(); control.Attributes.PerformLayout(); //customise value list position var x = (float)this.Attributes.Bounds.Left - control.Attributes.Bounds.Width / 2 - 30; var y = (float)Params.Input[3].Attributes.Pivot.Y - control.Attributes.Bounds.Height / 2; // 11 is half the height of the control control.Attributes.Pivot = new PointF(x, y); // add to doc and connect document.AddObject(control, false); Params.Input[3].AddSource(control); } base.AddedToDocument(document); }
Posts: 1
Participants: 1
@youssef_aboualghar wrote:
Hello there,
I’m making this plugin. I’m stuck at making that huge component into smaller components to get more control ability over my work.
When I separate the component into multiple components it doesn’t auto update the data in the bigger component.I really need it to autoupdate so I can make my code work. can anyone help me with that ?
thanks for your time
Youssef.
SurfaceTrails4-02.rar (309.1 KB)
15-8-18-FlockingInBox.gh (128.7 KB)
SrfTrails.gha (94 KB)
Posts: 3
Participants: 2
@lionpeloux wrote:
Hi there,
I’ve came up with a component template that I would like to share.
Its working likeGH_Component
but adds the ability to define several sets of variable input and output parameters (called “configuration”) in addition to fixed ones.To switch from one configuration to another right click the component and select the configuration. The tag of the selected configuration is displayed underneath the component.
See the csharp file attached for the
GH_VarivableConfigComponent
and an example.GH_VariableConfigComponent.cs (10.3 KB)
Posts: 1
Participants: 1
@youssef_aboualghar wrote:
Hello,
I’m doing this C# code where the mesh vertex moves closer to closest attractor point.
However when move the attractor away the mesh goes back to it’s previous state.What I want is : prevent the mesh from updating back to any old position and have the mesh get more attracted to the point with everymove I make.
Can anyone help me with that ?Thanks,
Youssef.
23-10-18-MeshDeform.gh (12.5 KB)
Posts: 1
Participants: 1
@Rickson wrote:
Anyone know how to generate Barcodes? 128 in particular?
There is python lib available, but no idea how what needs to happen to make it work.
Thanks in advance.
Posts: 1
Participants: 1
@ivelin.peychev wrote:
This is maybe problem with the number slider, it has to allow more digits behind the decimal point. at least to match the capabilities of Grasshopper.
Posts: 1
Participants: 1
@schen.risd wrote:
Hi, recently I started using Ghpython for coding, however my help area appears blank the whole time when I was typing. Does anyone have any idea how I can fix this issues?
Posts: 4
Participants: 3
@abarbar wrote:
Hello.
I’ve noticed a small change in GH lately.
It used to be that when you update a GH assembly from visual studio you could drag it onto your grasshopper canvas, a window pops up warning you of ID conflicts. You click “replace all”. and your GH plugin would update instantly and replace the gha file in your components folder. This workflow was incredibly convenient as it made debugging WIP components so much faster and easier. Lately, though, this doesn’t seem to work and to replace an assembly you have to completely restart rhino and update the file in your GH Libraries folder. Is there any way around this?
Posts: 3
Participants: 3
@ken.marold wrote:
I’m in the process of porting a collection of rhinoscript (python) functions to C# in order to develop a collection of custom grasshopper components. My problem is I’m having trouble access some rhinoscript methods such as VectorUnitize(), VectorScale() and PointAdd(). I can’t seem to find any references that include these in C#. Does anyone have any experience with this kind of thing as to point me in the right direction?
Rhinoscript I’m working from:
# FIND THE ALIGNMENT VECTOR aVec = self.AlignmentVector(neighborAgents, neighborAgentsDistances) if rs.VectorLength(aVec) > 0: aVec = rs.VectorUnitize(aVec) aVec = rs.VectorScale(aVec, self.alignment) # FIND THE SEPARATION VECTOR sVec = self.SeparationVector(neighborAgents, neighborAgentsDistances) if rs.VectorLength(sVec) > 0: sVec = rs.VectorUnitize(sVec) sVec = rs.VectorScale(sVec, self.separation) # FIND THE COHESION VECTOR cVec = self.CohesionVector(neighborAgents) if rs.VectorLength(cVec) > 0: cVec = rs.VectorUnitize(cVec) cVec = rs.VectorScale(cVec, self.cohesion) # ADD ALL OF THE VECTOR TOGETHER to find the new position of the agent acc = [0, 0, 0] acc = rs.PointAdd(acc, aVec) acc = rs.PointAdd(acc, sVec) acc = rs.PointAdd(acc, cVec) # update the self vector self.vec = rs.PointAdd(self.vec, acc) self.vec = rs.VectorUnitize(self.vec)
What I’ve got so far:
// if there is more than 0 neighbors within the neighbor radius then perform the follow actions if (neighborAgents.Count > 0) { // Find the alignment Vector Vector3d aVec = AlignmentVector(neighborAgents, neighborAgentsDistances); if (aVec.Length > 0) aVec.Unitize(); aVec = aVec * Alignment; Vector3d sVec = SeparationVector(neighborAgents, neighborAgentsDistances); if (sVec.Length > 0) sVec.Unitize(); sVec = sVec * Separation; Vector3d cVec = CohesionVector(neighborAgents); if (cVec.Length > 0) sVec.Unitize(); cVec = cVec * Cohesion; }
Posts: 2
Participants: 2
@ivelin.peychev wrote:
This Frames GH component creates multiple CPlanes visible while in preview, but when baked they appear as square surfaces.
How can I (is it possible) to create multiple CPlanes, but all of them be visible at the same time?
Posts: 9
Participants: 3
@chanley wrote:
I was updating a few of our internal GH components today, and this question came to mind.
When using CreateFromCurvePipe, as the accuracy is increased, it appears that there is more division at higher points of curvature. (which makes sense, circled in Orange in screenshot below). My question is…Is there a similar method/logic that could be applied to curves? The end goal would be to essentially divide a curve with a similar “accuracy” slider, which would add more points at higher degrees of curvature.
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Mesh_CreateFromCurvePipe.htm
Posts: 3
Participants: 2
@arnaudgen wrote:
Hello everyone,
On c# component, I have in input any 3D points.
I would to calculate the two smallest vectors between my first point ( item 0 ) and the other points. I want draw a 3d face between my first point and the 2 points who are closest.
After, I want to make the same operation with the second point, and so on.
I begin in c# and i don’t know how i can write my code.
Thank you for your help.
Posts: 4
Participants: 2
@youssef_aboualghar wrote:
Hello Guys so I’m making this simple c# code that moves mesh vertex in an iterative way using a timer that I made internally in script but I can’t seem to get the desired result.
Can anyone help me figure out how to do it ?
Thanks.
Youssef.
4-11-18-IterativeMeshMove.gh (24.1 KB)
Posts: 1
Participants: 1