Quantcast
Viewing all 3646 articles
Browse latest View live

DA.GetDataList() Why not offer IEnumerable as argument?

@rawitscher-torres wrote:

Hi Guys,

I am curious to know why DA.GetDataList() does ton provide an IEnumerable<T> so the user is not only limited to a List<T>? Note that converting an array using ToList() will not work as it will create a new memory alloc for the data and DA.GetDataList() will not operate on the original collection producing a good old null.

Posts: 1

Participants: 1

Read full topic


Add additional folders to Grasshopper Folders.UserObjectFolders

@Mostapha wrote:

Following up from this thread: [Wish] Load external ghuser files by ghlink

We are developing a new folder structure for installation of Ladybug Tools new plugins and as part of that we want to move the UserObjects out of the default UserObject folder. It looks like Grasshopper currently looks into two main folders for UserObjectFolders:

  1. C:\Users\%USERNAME%\AppData\Roaming\Grasshopper\UserObjects
  2. Sub-folders under C:\Users\%USERNAME%\AppData\Roaming\McNeel\Rhinoceros\packages\6.0

There is an Add method under Grasshopper.Folders.UserObjectFolders but it doesn’t seem to work. Also we need to add the folders before loading the Grasshopper itself.

Is it even possible? and if yes how should we do it?

Posts: 1

Participants: 1

Read full topic

Different computer,different issue?

@ncdecor1 wrote:

hi,
yesterday I tested a definition on 5 different computers (with same rhino) and one of them returned a different result (first pic) and I don’t understand what the hell is going on?

other strange thing when i had a new panel component (for investigate), it was pink and not yellow??

thanks,
Julien (France).

2020 02 23 text2color.gh (28.6 KB)

Posts: 1

Participants: 1

Read full topic

C#-How to judge brep equals to another?

Components not updating

@rvdven wrote:

while developing(C#) a plugin I will often change the components input, output and or behaviour.
It seems that Grasshopper is not always updating existing components ?
see screenshot:
Image may be NSFW.
Clik here to view.
image

Posts: 2

Participants: 2

Read full topic

How to switch into SDK mode in ghpython (old plugin)

@ivelin.peychev wrote:

I’m talking about this one here:

Posts: 1

Participants: 1

Read full topic

Cannot access Surface.InterpolatedCurveOnSurface or Surface.InterpolatedCurveOnSurfaceUV

Code example for component with custom UI?


User draw polyline on grasshopper Mesh in Rhino Viewport

@blind wrote:

Hi everyone, I need users to draw Polylines on a GH-Mesh Preview in the Rhino-Viewport which are then used as Input for the rest of the Script.
I’m not sure how to even approach this problem.

So far I used HumanUI to set up a button to trigger a c# Component that:

  • bakes a mesh to Rhino,
  • runs the “_Polyline persistentonmesh” Command via RhinoApp.RunScript,
  • gets the Polyline outcome and adds it to a List of drawn Polylines,
  • purges the mesh and Polyline from Rhino,
  • outputs the updated List of Polylines.

This is pretty hacky though because:

  • The preview of the mesh in the viewport is pretty different from the Grasshopper “Custom Preview” that I use to show the results of the Script
  • Grasshopper freezes during the Command
  • Script-results (Meshes) stop showing because GH is frozen
  • Polylines stop outputting during the command

Is there a better way to do this?

Posts: 1

Participants: 1

Read full topic

Remapping / Reordering Lists in Grasshopper

@oliverbaldock wrote:

Hi all,

I have two lists of data (which for ease of understanding I have entwined) from which I am looking to create a third list of data which uses the value of one as the index and the value of the other as the value in this new list. Please see the screenshot below.

For example, at index 292, List A has value 37 and List B has value 119.7, I would like the new list to have at Index 37 the value 119.7.

Is this possible? Seems like it should be somehow, but maybe I need to take a few steps back.

Posts: 2

Participants: 2

Read full topic

Virus Spread Simulation translation to Python

Failed import of sys library in ghpython

Update self-defined python modules

@raylee14 wrote:

Hi everyone,

I have created some python modules to call in python components in Grasshopper
However, I found that i need to restart rhino to make the changes of the python files effective.

Is there any simple ways like sourcing the files?

Posts: 3

Participants: 2

Read full topic

C#: How to update all sliders and run the simulation once

@farzad.ghaznavi wrote:

Hello,

I am working on a c# application that uses RhinoWIP to run a model after setting a number of inputs through number sliders. I followed recommendation from this thread on how to set all number sliders first, run the model once, and finally collect result from a number of output. However, VolatileData.PathCount seems to always be zero. As an experiment, I also tried below. In the below case the result of CastTo is false due to volatile data being unstable.

foreach (var item in source.VolatileData.AllData(true))
{
if (item.CastTo(out double value))
{

}
}

I greatly appreciate your help.

Thanks,
Farzad

Posts: 1

Participants: 1

Read full topic

Texturing problem in Grasshopper

@mathieu1 wrote:

I am trying to preview textured geometry in Grasshopper, and I am having trouble displaying objects with pixel perfect texture previews for some reason.

I used the custom preview components from several plugins (ShapeDiver and Human), and they both produce the same issue. Below you can see what I mean with the image I am using (top) and the textured result (bottom) after I display it on a planar surface with dimensions matching exactly the image:

I wrote a version of this preview to try and see if I could solve the issue myself. Here is what the C# component looks like:

private void RunScript(string path, Plane plane, ref object A, ref object outBrep)
{
  material = new Material();
  material.SetBitmapTexture(path);
  material.DiffuseColor = Color.White;
  System.Drawing.Bitmap img = new Bitmap(path);
  brep = Brep.CreateFromSurface(new PlaneSurface(plane, new Interval(0, img.Width), new Interval(0, img.Height)));
  tm = Rhino.Render.TextureMapping.CreatePlaneMapping(plane, new Interval(0, img.Width), new Interval(0, img.Height), new Interval(0, 1));
}

// <Custom additional code> 
Material material;
Brep brep;
Rhino.Render.TextureMapping tm;

//Draw all meshes in this method.
public override void DrawViewportMeshes(IGH_PreviewArgs args)
{
  Mesh[] mesh = Mesh.CreateFromBrep(brep, MeshingParameters.Default);
  mesh[0].SetTextureCoordinates(tm, Transform.Identity, true);
  args.Display.DrawMeshShaded(mesh[0], new Rhino.Display.DisplayMaterial(material));
}

It seems to work fine, except that it has the exact same discrepancy than the two plugins mentioned above. This led me to two possible guesses:

  1. Obviously, resizing an image will tamper with the pixels since the resizing algorithm will interpolate the original colors to the new dimensions. I thought that maybe my surfaces were not exactly the right dimensions. However, if I bake the surface from Grasshopper and use the image as a texture directly in Rhino, I get exactly the result I want (see top image above).
  2. Somehow, the display pipeline in Grasshopper automatically does some sort of resizing and/or compression which I have no control over. In my script above, I tried playing with all the texture parameters without success.

I appreciate any help regarding this issue.

Posts: 3

Participants: 2

Read full topic


Longest distances between curves

@florent.ponnoussamy wrote:

Hello everyone,

I’m working on a script where I need to find the longuest distances between two separate curves.
I succeeded to find the longuest one. But what I also want is to find the 2nd longuest distance, or the 4th one, or the 20th one etc. And i want to find it with a list of numbers that I will create with the panel tool.
Of course the longuest one will be n°1 or n°0 on that list.

So I’m requesting your help here so that we can see together if there’s a solution.

Here’s the script.

Thank you in advance and please take care of yourself during this Covid-19 crisis.

Posts: 2

Participants: 2

Read full topic

Accessing custom UV coordinates

@mau wrote:

Hi,
Is there a way to access the custom mapping UVs of a referenced geometry? I’ve been able to get the texture coordinates using Mesh.TextureCoordinate method in python, but as you can see below it references the original UVs and not the custom texture map overlay applied in Rhino. I’m a bit novice to python, so a little extra explanation would be greatly appreciated.
Thank you!

Posts: 1

Participants: 1

Read full topic

OpenCV in GHPython

@vbl wrote:

Is it possible to get OpenCV to work in the ghpython component?

Tried getting Emgu CV but I don’t know how to properly install it into the Rhino IronPython.

Any help is greatly appreciated!

Posts: 3

Participants: 2

Read full topic

Solve grasshopper geometry problems using ML

@dai_kandeel wrote:

Hello
First, Sorry if I am not asking the question in a proper way!
I am trying to discover some kind of problems/bugs- maybe related to data structure - or geometrical ones that face users in grasshopper and can be solved applying machine learning algorithms.
I know there are some plugins do clustering and so , but I mean which kind of problems can I start thinking of ?
Thanks

Posts: 7

Participants: 2

Read full topic

C# custom component SolveInstance() behavior

@robertdamian.vochesc wrote:

Hi to all,
I’m developing a custom component for Grasshopper. I use this component to create some geometry in RH/GH then created into another calculation software throught API. When this geometry is created throught API a GUID is assigned in the calculation software. This GUID is stored (in the GH component) and then when the component run again (because the inputs data in GH are changed) the component delete the old element in the calculation software and create the new one and new GUID is assigned. The GUID is then saved using Write() override and then Read() method run when the GH file is opened.

What I understand is that SolveInstance is (or can be) called many times within the same solution (refer to https://www.grasshopper3d.com/forum/topics/is-the-solveinstance-method-called-everytime-an-input-is-changed) but I don’t understand the behaviour when I open the GH file that has been saved. Debugging seems that the solution SolveInstance() run again and I’m worried that the element is created two times into the calculation software (that already containts the same element).
From my tests seems that, even if SolveInstance() run again after Grasshopper is opened seems that no new elements are created. Have Grasshopper some kind of check that the previous inputs have not changed when I open the file or I have to provide this control? This control can be to store data when the file is saved/closed, and set persistent data when the file is opened?
In few word I want to avoid or to control running a new solution when the .gh file is opened.

Then SolveInstance() can run many times within the same solution, but I don’t understand if the process is:
a.) Many loops of BeforeSolveInstance()-> SolveInstance() -> AfterSolveInstance()
or is:
b.) BeforeSolveInstance() -> many loop of SolveInstance() -> AfterSolveInstance()?

Since SolveInstance() has and iterator seems to be b.).

Additionally I have another question: Components run one at once or they run in the same time if they are not dependent on each other? I mean varius SolveInstance() can be called at the same time?

Thanks

Posts: 12

Participants: 2

Read full topic

Viewing all 3646 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>