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

CastTo

$
0
0

@menno wrote:

I have a custom parameter type that contains a list of numbers. When I try to connect it to a Construct Point component, the CastTo<Q>(ref Q target) is called, with the target equal to one GH_Number. I would, however, like to return a list of numbers.
Can this be done?

thx.

Posts: 3

Participants: 2

Read full topic


Import strm (.hgt) files into rhino

$
0
0

@dburns wrote:

My goal with Grasshopper / Elk is to be able to import SRTM files (.hgt) into rhino as a surface.

Any tutorials, advice or sample files that you could point me to it would be much appreciated.

Thank you.

Posts: 1

Participants: 1

Read full topic

Brep Edges in C#

$
0
0

@Filipe_Brandao wrote:

I'm writing a C# script to do Ice-ray latices, a classical example of a shape grammar. I have done the surface (brep) subdivision part and I'm now trying to offset the brep edges inward. After offsetting them I need to trim the Brep with the new boundary.

Brep.Curves3D is giving me the curves of the untrimmed surface. How do I get the Trimmed Surface edges?

Posts: 6

Participants: 2

Read full topic

Doc.NewSolution crashing Rhino

$
0
0

@ParamDesSing wrote:

Hello,

I have ported code for my optimization plug-in from a C# component "prototype" into a "proper" component.
However, I'm now experiencing crashes when resetting the values and recomputing. The code I'm using looks like this:

slider.SetSliderValue(val);  
doc.ExpireSolution();  
doc.NewSolution(false, GH_SolutionMode.CommandLine);

Rhino crashes when I start the NewSolution, and I also don't see the slider changing.
Any idea why that might be/possible solutions? I didn't have this problem when running the code inside a C# component.

Thank you!
Thomas

Posts: 5

Participants: 2

Read full topic

Offset Curve in C#

$
0
0

@Filipe_Brandao wrote:

Like I mentioned here Curve Offset method can sometimes produce strange results like the one shown here. I found that if I increase the document precision the offsets fails less. This only works up to a certain point, when computation time starts to increase dramatically. So my two questions are:
Is there a work around for offsetting polylines in order to avoid this problem?
Is there any way to filter offset failures in C#?

C#_IceRay3.gh (10.7 KB)

Posts: 3

Participants: 2

Read full topic

Leap motion + kangaroo

$
0
0

@alemarc wrote:

Hi all, I'm trying to move some objects in Rhino through the Leap Motion device. I connected the points identified by the fingers of my hand at the corner of a cube using the Magnet Snap command but the Solver Kangaroo seems to read only the starting points of my hand and they don't move with the passing of the time; so the cube doesn't follow my hand. It seems that there ins't a refresh of the points gived by my hand that Kangaroo or Magnet Snap introduces.
Can someone help me to solve the problem?
Have you some suggestion or other ideas to move objects with Leap Motion device?
Thanks a lot

Posts: 1

Participants: 1

Read full topic

Cache-buffer and save to disk Grasshopper state

$
0
0

@elliotwoods wrote:

Hey all!

In my Grasshopper chain I'm often encountering situations where a section might take 5 minutes to complete.
The issue is that I want to work on later stages without having to rebuild the earlier stages each session.
This is especially important when writing plugins (since app restarts are required every so often).

I could then bake this output and then reselect it in the next stage, but then i lose all my ordering (which is important).
So I could then make some code to re-order the selection to match how it would have been created in Grasshopper. But this is prone to errors and requires unique sorting logic each time.
Is there a well known method for dealing with this scenario? Ideally would love something like 'store output in savefile', i.e. the created output is serialized/deserialized to disk

Also in general, having more guards against heavy evaluation areas would be great (currently just disabling nodes in parts at a time, but maybe there's smarter ways of dealing with this problem).

p.s. wish the Rhino SDK was thread safe! could chop some of these processing times down :slight_smile:

Elliot

Posts: 2

Participants: 2

Read full topic

Some modules dropping support for Python 2.7


Can I post Grasshopper interface wish list?

$
0
0

@2DCube wrote:

I'm very new to GH (read days) but there are a couple of things that have cropped up which I think could improve functionality. When hiding wires you can only select things going backwards through the calculation, not forwards?

Take this screen grab below: I can only disconnect from left to right but I can hide wires from right to left - this means that I'd have to follow all these wires and hide each on individually. I'm sure it has something to do with limiting errors but when you're sure that all wires lead to a specific point it would be handy.

Grouping by colour:

Each time something is grouped it uses the base colour and not the last used, this becomes labour intensive if you want to work with specific groups and groups within groups.

Grouping and alignment:

The alignment tool is great, it's a shame that it doesn't work for grouped objects. When selecting two groups of objects it will treat them all as individual items.

Locking groups:

When the page becomes busy and you've been at it a few hours it's easy to be clumsy. It would be really great if groups could be locked so that the icons don't move. Rather than double clicking changing the grouping by box or meta ball there could be a lock function that displays an icon in one corner (maybe similar to the reverse, flatten or graft icon).

Applying a command to multiple objects:

As an example, when changing the colour of a group it has to be done individually... If you select several groups and change the colour it only applies it to the last selected and not all.

I've been lost in a Grasshopper bubble for the past few days - it's amazing. Can't quite believe I left it so long!

Cheers

Andy

Posts: 4

Participants: 2

Read full topic

Genetic Programming in Python using DEAP

$
0
0

@Man wrote:

I tried to use DEAP library for genetic programming and there is an error bouncing back that the array index is out of range. Is there an easy fix to this problem. It might be related to the Ironpython environment. I'm sure that the package and all dependencies are installed properly, as the associated genetic algorithm works fine.
Please give me advice on how to deal with the issue.

Posts: 1

Participants: 1

Read full topic

What is a good and simple installer to use with a Grasshopper plugin?

$
0
0

@ParamDesSing wrote:

What is a good and simple installer to use with a Grasshopper plugin?

The installer should place the*.gha in the Grasshopper components folder, make some folders, place files in them, and set a system path.

Thanks,
Thomas

Posts: 3

Participants: 3

Read full topic

How can I get the folder where my grasshopper plug-in/component is located?

$
0
0

@ParamDesSing wrote:

How can I get the folder where my grasshopper plug-in/component is located?

I tried

System.AppDomain.CurrentDomain.BaseDirectory

but that gives me location of the Rhino executable.

Thanks,
Thomas

Posts: 11

Participants: 4

Read full topic

Create at DataTree from C#

$
0
0

@GBirde wrote:

Hi,

I'm trying to create a Grasshopper plugin with C#, where I want to create a data tree with different branches. I have a List<> of Point3d[] where I want every element in the list to be a separate branch, and the array of Point3d should fill up every branch. But I can not figure out how to add a new branch to the data tree.

This is the code that I have:

List<Point3d[]> points = new List<Point3d[]>();

Grasshopper.DataTree<Point3d> points2 = new Grasshopper.DataTree<Point3d>();
Grasshopper.Kernel.Data.GH_Path tempPath = new Grasshopper.Kernel.Data.GH_Path();

// intersections if of type List<Curve>
for (int i = 0; i < intersections.Count; i++)
{
    // Here is some code to modify the curves that is removed for this exemple

    // Divide every curve and put them in temp
    Point3d[] temp = null;
    intersections[i].DivideByCount(numberOfDivisions, true, out temp);

    // How do I create a new branch?!
    points2.AddRange(temp, tempPath);

}

How do I do this? Any suggestions?

Alternatively I could partition a list that holds all of the points, but I can not figure out to do that either...

Thanks!

Posts: 2

Participants: 2

Read full topic

Issues with rs.TextExplode on Mac

$
0
0

@Mertzi wrote:

Hey,
I'm trying to understand how to script components in python for Mac usage.

Right now I'm trying to make a simple text preview and bake component using the GHpython component. It is meant to preview the text as outline curves since grasshopper has no text object available, and then bake the same text as a rhino text object so that it can be edited further as text in for example illustrator etc. What I've writtin so far works fine on my PC, but I'm having issues running the component in the Mac version of Grasshopper.

As far as I understand, I'm supposed to be able to use the RhinoScriptSyntax functions (found here: http://developer.rhino3d.com/api/RhinoScriptSyntax/win/#application) when coding in Python, but the rs.ExplodeText doesn't seem to work on Mac. It returns the text as a text object one more time and no outline curves, even though "delete" is set to "True". the rs.AddText only works within the If statement on Mac, and doesn't continuously output text as it does on my PC.

Here is the GHpython code and attached is an example file:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino as r<a class="attachment" href="/uploads/default/original/3X/0/6/06ea5eb4d68d9d4e288ae8303286483aa4e0f0c8.gh">BakeAsText.gh</a> (7.9 KB)


sc.doc = r.RhinoDoc.ActiveDoc

geoList = []

preText = rs.AddText(text, plane, height, font, font_style=fontStyle, justification=None) #justification = höger/center/vänsterställd text (int type)
textGeo = rs.ExplodeText(preText, True)

for i in textGeo:
    geoList.append(rs.coercegeometry(i))


for i in textGeo:
    rs.DeleteObject(i)

if BAKE == True:
    bakeText = rs.AddText(text, plane, height, font, font_style=0, justification=None)

Would be very grateful for any pointers on what I'm doing wrong? Is it that I cant use the RhinoscriptSyntax functions if I want to run it on Mac? Where can I find a list of Mac compatible functions to call from the GHpython component?

Thanks a bunch for any answer!!

Posts: 1

Participants: 1

Read full topic

Modify color and arrowheads of AddLineParameter in OutputParams

$
0
0

@Christoph1 wrote:

Dear all,

how can I change the way Grasshopper displays geometry in the RegisterOutputParams?

More specifically, I'd like to assign colors and add arrowheads to the lines in pManager.AddLineParameters

I don't want to use Rhino.Geometry, because I need to redraw a lot and I have the feeling, "unbaked" geometry in Grasshopper draws much faster.

Thanks a lot for any help.

Best,
Christoph

Posts: 2

Participants: 2

Read full topic


Use Recursion in grasshopper C#

Add ghPython inputs dynamically from script?

$
0
0

@Mertzi wrote:

Hey,
Im looking for a way to have a ghPython component add input parameters dynamically depending on some data received from the first input x. I've been trying to find ways to do this, but all I can find are about coding .gha plugins in C#. I've also been looking some at the ghenv.Component.CreateParameter, but not sure if it can be used in a ghPython component? Is there otherwise a way to achieve something similar?

Example pseudo-code of what I want to do with ghPython:

x = ["A", "B", "C", "D"]        # x revieves a list of strings from another component

for item in x:
    add input parameter item        # iterate over the list, add input parameters with the same name as each string item.

After script has run input parameters to the ghPython component should be x, A, B, C, D.

Many thanks

Jakob

Posts: 5

Participants: 3

Read full topic

Free Form Wall, RH to RVT

$
0
0

@nsenemaud wrote:

Hello everyone,

I'm actually pursuing a Master in BIM in Paris and I'm working on the interoperability between Rhino/GH and Revit/GH.

Basically the idea is to create a Rhino / GH freeform wall (variable depth), import it into revit so it can host doors, windows etc.
I'm conscious that it is a little tricky, but I think that once you solve this kind of problem, it opens the important door between Rhino/GH and RVT/DYN.

First operation:

I installed ggrevit plugin (developped by Jon Mirtschin) in Grasshopper and Revit
I tried to export a simple wall (made out of visualrq), through your plugin (add-in > import IFC) and it works. The ifc wall is recognized as a revit wall. I can put doors, windows on it etc.
When I try with a free form:

I used the add solid command (from visualarq). I added a solid to my wall. In Rhino I can put a door, window etc. (like on video https://www.youtube.com/watch?v=KO3SNZLip0w)
I export that wall in IFC file
I open it through your pluggin, I get this error message (XXX representation item #64 not generated! ifcpolyline) and it transforms my visualarq IFC geometry into an ugly mesh.

The other solution was to import the faces from rhino in order to use the wall by face revit command. It works as long as the imported shape is in SAT, but it just gives a curved wall instead of our variable depth wall. Moreover I dont like importing manually stuff into revit. I'd rather work with flux or mantishrimp but I'm not sure at what extend this operation can be repeatable.

Do you have an idea of what would be possible to improve this operation?

All the best,

Nick

Posts: 1

Participants: 1

Read full topic

The reason why script freeze when I use gh.RunSolver

$
0
0

@obakatsu wrote:

Hi!
I am trying to write script which can automate to change parameter in slider and export image file.
When I run the following script, it stop to work.
I guess it could go into infinite loop, but don't know how to confirm and fix it.
Can anyone tell me what is problem and how I can solve?

import rhinoscriptsyntax as rs
import Rhino
import System

gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")

rs.EnableRedraw(True)

get parameter from slider

for i in range(1,2,1):
gh.SetSliderValue("2fc274ad-b223-4412-9dfa-583846b25f69",i)
gh.SetSliderValue("8e52eafc-2b3d-49ac-9980-8f3776042ca6",i)
for j in range(1,2,1):
gh.SetSliderValue("bf6c1195-a839-460c-b891-b41b1befb20c",j)
gh.SetSliderValue("6d0830a4-fe91-4b1f-9e95-e2e784fe480a",j)
for k in range(8,10,1):
gh.SetSliderValue("62ae003c-1fa8-4254-bdde-7a2e1ad9a0c7",k)
gh.SetSliderValue("1136a5e9-202b-43e5-8c19-d1f117a924c7",k+1)

If I use gh.RunSolver, script freeze

gh.RunSolver("160816Light shelf_grid_automate.gh")

Save image file

strNum = str(i)+str(j)+str(k)
doc=Rhino.RhinoDoc.ActiveDoc
view=doc.Views.Find('Pers',False)
doc.Views.ActiveView=view
width = view.ActiveViewport.Bounds.Width
height = view.ActiveViewport.Bounds.Height
bitmap = view.CaptureToBitmap(System.Drawing.Size(width, height))
image=System.Drawing.Bitmap(bitmap)

image.Save(strNum+".jpg")

Posts: 1

Participants: 1

Read full topic

Errors in the new version of VB.NET component

$
0
0

@JulianDmojica wrote:

Hi. I'm a new user of Grasshopper.

I'm trying update a VB.NET because this code ran in a old version but in the new not.
I have two problems with the code. I don't find the correct name for the two class.
I need help with this problem.

Thanks.
CODIGO GRASS.gh (51.5 KB)

Posts: 1

Participants: 1

Read full topic

Viewing all 3626 articles
Browse latest View live


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