Quantcast
Channel: Grasshopper Developer - McNeel Forum
Viewing all 3642 articles
Browse latest View live

How build a super computer for Grasshopper?

$
0
0

@tomclinetomcline wrote:

I’ve been doing a lot of 3d patterning designs in my artwork using Grasshopper, Rhino join and boolean tools. Is it better to build a super computer for one part or build three good computers and farm out as 3 small broken up pieces? Than afterwords after join the 3 parts back together.

Posts: 2

Participants: 2

Read full topic


GHPY: compile via external tool

$
0
0

@jws wrote:

Hi,

I’d like to compile my python scripts to a .ghpy component, very similar to what is described in this awesome tutorial. It works fine, except I have two issues:

  1. Can I run the Main.py file (as in the linked tutorial) from a standalone IronPython console? (If I do so, then Grasshopper complains about not finding the module with the same name of my component.)

  2. I cannot recompile the .ghpy while it is loaded in Grasshopper: Aparently, Rhino locks the file so it cannot be overwritten. This happens no matter if I compile with my external IronPython or Rhino’s Python Editor. Is there any way around this? (it is noted here that it should work.)

Any help for either those two issues is greatly appreciated.

PS:
I’m running IronPython 2.7.9 (latest version as of now) and Rino Version 6 SR22 (6.22.20028.13281, 01/28/2020).

Posts: 1

Participants: 1

Read full topic

Sculptural Patterns Rhino + Grasshopper Help

$
0
0

@spsimmons.design wrote:

Hello! Very new to Grasshopper. Talk to me like I know absolutely nothing because that’s the truth. I’m trying to take a vector pattern from Illustrator, import it into Rhino, loft that pattern, and then control the direction of the lofts via 2 attractor curves. See reference image attached of a piece of sculpture that is very similar to what I’m trying to do. I was able to do this with an extrude to point, but I do not want the shapes to come to a point like in the reference image, but rather to a flat as if they were extruded with draft. Can anybody help me understand how to do this? Thank you for your time!

Sean

Reference|690x460

Posts: 1

Participants: 1

Read full topic

DataTree problem creating component solid difference

$
0
0

@AlexWer wrote:

Hello Guys

I understand and study with the creation of nodes on
I’m trying to create a node that makes the Boolean difference of solids (I know that it is in the grasshopper). For educational purposes, I do it.

Can you please tell me how to fix it, such an error occurs

pManager.AddBrepParameter(“Solid”, “S”, “Solid”, GH_ParamAccess.tree);
pManager.AddBrepParameter(“Difference”, “D”, “Difference”, GH_ParamAccess.tree);

DataTree Solid = new DataTree();
DataTree Difference = new DataTree();

if (!DA.GetDataTree(0, Solid)) return;
if (!DA.GetDataTree(1, Difference)) return;

Posts: 10

Participants: 3

Read full topic

SetData in RespondToMouseDoubleClick and Component opening Form

$
0
0

@szilveszter.matt wrote:

Dear Experts!
I work on a project and we use Rhino/Grasshopper API.
I have the following issues:

  1. I want to change the output of a Component by doubleclicking on the Component, but I don’t know how to access the (SetData) or similar methods for this. Is there any way to solve this problem?

  2. I have a component which opens a Windows.Forms form in the SolveInstance method. When I pick the component from the top toolbar, it runs perfectly, but when I doubleclick on the canvas and use search and select the component the form closes automatically.

Thanks for your help!

Posts: 3

Participants: 2

Read full topic

Grasshopper component signature through Visual Studio (for dummies)

$
0
0

@AlexWer wrote:

Hello Guys

please tell me how to sign a component of a grasshopper written through a visual studio?
How do I sign a component C# Script Component connected through a node I know, but how through a visual studio?

I looked at the examples on the forum, but nowhere is there an example of detailed how to do this?


maybe someone has a piece of code on hand?

like this does not work
this.Message =“your message”;

Posts: 1

Participants: 1

Read full topic

How to solve "Linear programming" in C#script?

$
0
0

@niyuxiangken wrote:

Hello guys!
I want to a linear programming solver in grasshopper (Linear Programming -https://en.wikipedia.org/wiki/Linear_programming).
image
I attempt to use FuncLib.dll via C# to finish it.( the site where I find FuncLib.dll is"https://www.grasshopper3d.com/forum/topics/linear-optimization-solver?id=2985220%3ATopic%3A786397&page=1#comments")The problem confused me is using the functions of FuncLib.dll in C#.Because no SDK or API found,I failded to sort out linear programming.Is there anybody have a SDK or api of FuncLib.dll?
Thanks.

Posts: 3

Participants: 3

Read full topic

ScheduleSolution callback not being invoked after switching documents

$
0
0

@camnewnham wrote:

Hi @DavidRutten et al,
I’m building a set of grasshopper components that update frequently from a background thread(s) and I am having some issues with ScheduleSolution(int interval) in some scenarios.

In this reproduction I have a timer ticking at a given interval, which calls ScheduleSolution and should expire the component and update the document in the near future. The component message displays the number of times we call ScheduleSolution versus the number of times the delegate gets called, and the data record and panel show the total number of actual component updates (which should be less than the number of delegates called, since multiple may be called for one schedule).

Please see here for the test component code as a minimal reproducible example.

This also reproduces with a C# component (.gh) (5.2 KB)

This is the expected behaviour, where the number of callbacks is equal (or one or two ticks behind) the number of timer ticks:

Fig 1:
expected_behaviour

However, when I switch documents (or create new) and return the solutions still get scheduled but the callbacks are never executed (Fig 2).

Fig 2:
error_behaviour

When the document is manually updated, the scheduled delegates do get updated (Fig 3) - so it seems like they are getting correctly added to the queue, but the document isn’t getting a new solution called on schedule.

Fig 3:
error_behaviour_2

Lastly, It seems like certain combinations (or perhaps timings?) of scheduling the solutions (Fig 4) can also cause this behavior, though less permanently and it is less reproducible than in the new document scenario (Fig 2).

Fig 4:
error_behaviour_3

My first thoughts were to do with concurrency - but using a lock on the scheduling does not appear to make any difference, and I would have expected this to be handled via the BeginInvoke regardless. Inspecting the variables in VS shows that m_scheduleDelegates does add the delegates to the list, it simply never recomputes the document. Recomputing the document manually (i.e. updating a slider, clicking a button, enabling a component) will execute the scheduled delegates.

Do you know why this may be the case? I don’t get any unexpected diagnostics from VS.

The same code does produce expected behavior with ExpireSolution(true) instead of ScheduleSolution but of course this more or less freezes the UI indefinitely when the intervals are tight. This is the code.

Cheers
Cam

image

Note: The goal here isn’t to replicate a timer component or complete a regularly scheduled execution (in which case scheduling a solution from the SolveInstance might apply, but is instead to respond to events fired quickly from multiple external sources on separate threads.

Posts: 3

Participants: 1

Read full topic


Refine/subdivide mesh based on Curves

SoftEditCurve method doesn't behave as described in API

$
0
0

@Moonpick wrote:

Hello,
using the Curve.SoftEditCurve methode in one oy my projects I am surprised to see it does not deliver the result I was expecting looking at the Rhino 6 Documentation (
http://docs.mcneel.com/rhino/6/help/en-us/commands/softeditcrv.htm) or the methode description in the API docu.

Attached a model showing the methode behavior. It looks there is a complete different algorithm working in the background as in the online documentation/examples.

What is wrong here? Am I mistaking something?

SoftEditCurve.gh (14.7 KB)

Posts: 1

Participants: 1

Read full topic

Grasshopper def. works on Windows, not on Mac

$
0
0

@sdotjo wrote:

I’m having an issue where my grasshopper definition works on the Windows side of my bootcamp, but not the Mac side. It’s using the grasshopper plugin Silkworm. Both Windows and Mac are using the same Silkworm download, both sides show Silkworm is installed in grasshopper, but on mac this error pops up (see screenshot). Both sides are using Rhino 6.

The grasshopper definition was written on Windows Rhino 6. Any reason a definition written on Windows wouldn’t run on Mac Rhino 6?

Posts: 3

Participants: 3

Read full topic

Connect component automatically

$
0
0

@christopher.ho wrote:

I am currently creating a custom component and want to automatically connect it to another one of my custom components (CompB) if that component exists on the canvas.
CompB is unique on the canvas and will not have a duplicate of itself.


I understand I need to get the GH_Component, but I can’t quite find the correct method.

Posts: 2

Participants: 2

Read full topic

Recursion based on pathnumber C#

$
0
0

@Baris wrote:

Hi everyone,

I am working on a pathnumber based subdivision these days.
The idea is the following:

A tree of meshFaces :
{0} = no subdivison
{1} = 1 time subdivide
{2} = 2 times subdivide

I got it mostly working when I use a meshplane,just some rectanlges do not subdivide all of the 4:
grafik

But the strange thing is that the same code on a meshsphere throws an index out of array exception
Or propably its not strange and my attempt is just really poor

My main code is this:

for (int k = 0; k < meshTree.BranchCount; k++)
    {
      for (int i = 0; i < meshTree.BranchCount; i++)
      {
        //get PathNumber
        char[] charsToTrim = { '{','}'};
        string path = meshTree.Path(i).ToString();
        string pathNumber = path.Trim(charsToTrim);
        int pth = int.Parse(pathNumber);
        //subdivide
        if (pth > 0)
        {
          for (int j = 0;  j < meshTree.Branch(i).Count;  j++)
          {
            meshTree.AddRange(MakeSubD(meshTree.Branch(i)[j]), new GH_Path(pth - 1));
            meshTree.Branch(i).RemoveAt(j);
          }
        }
      }
    }

    A = meshTree;

Maybe someone has the patience to help me with that one.


Thanks everyone and have a nice weekend!

20200208_SubdivideMeshPathForum.gh (10.7 KB)

Posts: 3

Participants: 2

Read full topic

Golden Ratio Curve not nice

$
0
0

@RIL wrote:

I tried put together some scrap code for drawing a Golden Ratio curve but when using Interpolate Curve component to draw the final curve the CurvatureGraph doesn’t look nice (well, I could see without the graph that the curvature wasn’t very smooth at all).

Is the bumpy curvature below to be expected or have I done something terribly wrong? The curve is Degree 3.

Golden Ratio.gh (11.9 KB)

// Rolf

Posts: 6

Participants: 4

Read full topic

How to achieve N different number of loops in C#?


Regular hexagon inscribed in a circle

Finding the Branch of an Item

$
0
0

@duanemclemore wrote:

Hi All, I have a component into which I have fed a 3 dimensional DataTree with a single item at each branch.

How do I find the branch of an item in C#? I need this to find the adjacent branch in each dimension.

In other words, if I have an item - in this case a Point3d at branch {nX; nY; nZ}, how do I find the branch it’s on? Then, with that, my intent is to find {nX+1; nY; nZ} and so forth.

Thank you in advance for your help.

Duane

( p.s. Note that I am not implementing GH_Structure. If this is the solution because it allows access to other properties or methods, does anyone have a good resource to understand how to implement this - or good code examples? I have been trying to understand the concepts here and how to implement them for months, and I just can’t get my head around it. This might be a good example for which to show specific code, how to convert my data that’s in DataTrees to the corresponding GH_Structure type, etc… your help in this area would be appreciated. -d )

Posts: 2

Participants: 2

Read full topic

Tasked componet generates different (inconsistent) results

$
0
0

@ankere wrote:

Hello,

This is my first post to the forum so might sound a bit not so professional in regards programming terms and concepts.
I’m developing a system for managing real tree branches and one of the components has to split a mesh in parts. It creates a bounding box of the branch, a dozen of surfaces along a line and then after converting the surfaces to meshes I use the Mesh.Split() command. The thing is I made this component multi-threaded and when using tasks as by the official example on the Mcneel site the results are always different and less accurate than the single threaded solution. The code I use is the same for both. Anyone has and idea as to why this is happening? Also it is not very clear what is happening when all threads finish? When is the final data assigned to the output parameters? It seems as if the next components do not get all data and recomputing the solutions sometimes fixes the problem. Is there something code wise I should be doing? Expiring does not work.

BranchSlicerComponent.cs (20.1 KB)

Tasked run #1:

Tasked run #2:

Single thread - shows normal behaviour:

Posts: 4

Participants: 2

Read full topic

Grasshopper Split Brep order of returned surfaces

$
0
0

@hessel40 wrote:

I have a question about the order GH returns splitted Breps.

I would like to subtract (dispatch) the splitted Surfaces which are inside the solid.
The (green) solid is the cutter and three planar Surfaces are being splitted.

I hoped that the order of splitted Surfaces was the same so i could use List Item or Cull Patern to subtract the Surfaces inside the solid, but this is not the case.

The vertical Surfaces show that the 1st item is within the solid and the horizontal Surfaces shows that the 2nd item is within solid.

I do not fully understand this order of numbering. Can someone explain this to me?

How can i determine which surface is within the solid? and what if the surface has no cutting edges with the solid? is there a function i’m missing?

Thank you in advance!

Posts: 1

Participants: 1

Read full topic

Poplulate 2D points?

Viewing all 3642 articles
Browse latest View live


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