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

Questions about adding functionality to this curve growth script

$
0
0

@jaymezd wrote:

I’ve been using GH for a number of years but I’m a beginner to C#. I recently went through the Long Nguyen C# video course on youtube. I was able to take what I learned about RTrees in the last section and apply it to the curve growth script and speed it up. Now I am trying to add some additional functionality to it:

  1. Add in a curve boundary (usually a rectangle) that the curve would be contained within
  2. Using multiple curves so that they don’t overlap eachother, themselves, or pass through the boundary.

For now I just would like some help with item 1, but if anyone has some advice about 2 I am all ears.

What I have tried so far is to divide the boundary curve into points, then I’ve added those points to the RTree that I later use to search for collisions. But I am a little stuck on how to actually make the boundary points repel the curve points in the way that the curve points repel eachother. This is my script: DifferentialLineGrowth RTree edition_forForum.gh (11.5 KB)


I want it to stay within the boundary. Any suggestions?

I found on page 6 of this thread in the old forum a comment by Vicente Soler showing his curve growth script staying within a boundary, but couldn’t find if he ever uploaded that anywhere.

Thanks.
EDIT: if anyone has any suggestions for resources that would be good for me to learn more continuing off from the level that the Long Nguyen course leaves me I would appreciate it. Preferably geared towards GH/Rhino.

Posts: 2

Participants: 2

Read full topic


Creating a truss system underneath a curved surface (roof)

$
0
0

@mfrrfm960 wrote:

I am a civil engineering student and currently trying to create a parametric model for a truss system for my intended curved roof structure. However, I could not figure out how to make the truss to follow the shape of the roof. I am new to Grasshopper, and hopefully, someone could help me to solve this problem. The grasshopper script and the roof model in Rhino are attached. Thank you!


Arena Truss.gh (16.1 KB)
Arena Truss.3dm.zip (13.4 MB)

Posts: 7

Participants: 2

Read full topic

C# newbie having problem with arrays in a function

$
0
0

@lars.renklint wrote:

I have created an array of numbers successfully:

double[] wSeries = new double[wFingersPlusNotchesPlusOne];
for (int i = 0; i < wFingersPlusNotchesPlusOne; i++)
{
  wSeries[i] = i * wActualFingerWidth;
}

This would be very useful in my component as a method.
But I cannot get it to work. I have a suspicion that it has something to do with the fact that I don’t specify how many elements my array contain.

double[ ] wSeries(int nr, double fingerWidth)
{
for (int i = 0; i < nr; i++)
{
wSeries[i] = i * fingerWidth;
}
return wSeries;
}

Posts: 5

Participants: 3

Read full topic

`MeshParameter` or `MeshFaceParameter` classes?

$
0
0

@garciadelcastillo wrote:

Hi there!

I noticed the “Mesh Closets Point (MeshCP)” component outputs a “MeshParameter” type object:

image

Is this type publicly exposed in RhinoCommon? I noticed there are MeshParameter and MeshFaceParameter registrations for components in the GH SDK, but cannot find a mirroring type in RC (or the GH SDK for the same matter)…

Thanks!

JL

Posts: 8

Participants: 3

Read full topic

GH_Polyline class would be nice to have

$
0
0

@melbardis wrote:

hi

There is a GH_xxxx class for all the Rhino geometry that can be output from a component, except Polyline.

I was working on a c# method that used reflection to iterate through all the fields of a class used to hold construction type geometry and create a list that can be used as an argument to DA.SetDataList. This can be solved by handling Polyline as a special case, but its not very elegant.

regards

eric

Posts: 3

Participants: 2

Read full topic

Extruding mesh?

Plugin Top Menu Item

Grasshopper Component and RhinoDoc - C#

$
0
0

@dimcic wrote:

Hi,

we are used to the Rhino Plug-in Development where we get the RhinoDoc passed to us in the RunCommand function. But what is the best way to use the document (and access Units, Tolerances, etc…) in a GH Component development?

My first guess would have been

RhinoDoc doc = RhinoDoc.ActiveDoc;

But that comes with a very nice “WARNING! Do not use ActiveDoc if you don`t have to…”

So…do I have to?

Thanks!

Posts: 2

Participants: 2

Read full topic


Cannot set "TextLocation" property on Linear Dimension

$
0
0

@gruedisueli wrote:

Hi,
I’m trying to set the “TextLocation” property for a Linear Dimension I’m creating via a Grasshopper component. I can modify many of the parameters without issue, but this one in particular is giving me trouble. My code snippet shows how I’m creating the dimension. The last line is having no effect on the text location.

        LinearDimension linearDimension = new LinearDimension(dimensionPlane, start2dPlanar, end2dPlanar, dimensionCenter2dPlanar);;

        linearDimension.TextHeight = textHeight; //all these properties can be modified without issue.
        linearDimension.ArrowSize = arrowSize;
        linearDimension.ArrowheadType1 = Rhino.DocObjects.DimensionStyle.ArrowType.Tick;
        linearDimension.ArrowheadType2 = Rhino.DocObjects.DimensionStyle.ArrowType.Tick;
        linearDimension.ForceTextPosition = Dimension.ForceText.Inside;
        linearDimension.ForceArrowPosition = Dimension.ForceArrow.Inside;
        linearDimension.ExtensionLineOffset = 0.1;
        linearDimension.ExtensionLineExtension = 0.1;

        linearDimension.TextLocation = Rhino.DocObjects.DimensionStyle.TextLocation.InDimLine; //here's where the problem is.

Posts: 1

Participants: 1

Read full topic

Pleated Surface

$
0
0

@new wrote:

Hello ,

Laurent DELRIEU has created a post in grasshopper site (previous forum)making the surface of the pavilion which was really great! Can anyone advise how to create these pleated creases on the surface with grasshopper ? Thank you very much in advance.

Kind Regards

Posts: 2

Participants: 2

Read full topic

Ping/Start new computation of the next component (c#)

$
0
0

@sven.schiller100 wrote:

Hey,

I created a component, that needs to do some heavy computations. If the computation is done in the solve instance function the whole UI freeze and waits for it. That’s why I make the computation in an extra thread. That works fine for me, but the problem is after the computation finished and the new result is set to the output, the next component does not start a recomputation. Is there any command to start a new computation for the following components or do I need to all totally different. Below you can see my code.

Best Regards

public class SampleComponent : GH_Component
{
  public SampleComponent()
    : base("SampleComponent", "Nickname", "Description", "Category", "Subcategory")
  {  }

  protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
  {
    pManager.AddIntegerParameter("Number", "Number", "Number", GH_ParamAccess.item);
  }

  protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
  {
    pManager.AddIntegerParameter("Result", "Result", "Result", GH_ParamAccess.item);
  }

  protected override void SolveInstance(IGH_DataAccess DA)
  {
    int number = 0;
    if (!DA.GetData(0, ref number)) { return; }
    int res = 1;
    Task computingTask = new Task(() =>
    {
      for (int i = 0; i < number; i++)
      {
        res = res + res;
      }
      Params.Output[0].ClearData();
      DA.SetData(0, res);
      //Ping/Start new computation of the next component
    });
    computingTask.Start();
    DA.SetData(0, null);
  }

  protected override System.Drawing.Bitmap Icon
  { get { return null; } }

  public override Guid ComponentGuid
  {
    get { return new Guid("9a4e60bb-c6fc-47d7-acbe-698723e162a0"); }
  }
}

Posts: 2

Participants: 2

Read full topic

Extract text from data box name

Prevent GH 7 library from loading in Rhino 6

$
0
0

@trygve wrote:

Hi! I’m building a GH library intended for Rhino 7. Of course, when I open Rhino 6, it complains that the library was built against a newer version. Is there a way to prevent Rhino 6 from loading a library intended for Rhino 7? I’ve tried:

  • Add a .no6 file next to the gha: Not loaded in either 6 or 7.
  • Put the gha in 7/Libraries: Not loaded in either 6 or 7.

Thanks!

Posts: 2

Participants: 2

Read full topic

C# Find the Lowest value in an Array

$
0
0

@youssef.eskandar wrote:

Primitve question sorry how to find the Lowest value in an Array in C#
tried the code below didnt work

int intArray = new int[5]{1, 2, 3, 4, 5};
int MinValuen = intArray.Min();

Posts: 3

Participants: 2

Read full topic

Problems with Python code

$
0
0

@craboitiz wrote:

Hi everyone, please see attached files
im working on the development of a program that tells you the maximum area that can be constructed on a terrain according to the city laws. The problem is that im not good at programing on gh python and haven’t been able to get the code to work as it should.

The datta that i have the maximum of squared meters that can be built (some specific number given by the city) and the addition of the area of the several building floors (wich may or may not have the same geometry).

What i need to do is:
if the addition (of the areas of all the floors) without the top floor is bigger than the number that the city laws gives me, delete the top floor and iterate for the new building (the same as before but without the top floor),
else leave the building as it is.

Once the addition off all the remaining floors without the last one of these is smaller than the maximum area given by the city laws i will scale the last floor to reach exactly the maximum constructible area.

i would really appreciate if you could help me with this, thank you
C.
Archivo comprimido.zip (34.7 KB)

Posts: 2

Participants: 2

Read full topic


[Wish] Load external ghuser files by ghlink

$
0
0

@mingo1214 wrote:

Hi All,

As far as I know, ghuser files won’t be loaded from outside of “%appdata%\Grasshopper\UserObjects”.
Is it possible to do it like gha file linked by ghlink?

Thanks,
Mingbo

Posts: 1

Participants: 1

Read full topic

Check RhinoCommon version in GH?

$
0
0

@garciadelcastillo wrote:

Hi there!

I am writing a GH component that tries to use the NurbsSurface.CreateCurveOnSurface method, which the documentation specifies is available in version 6.20. However, the method seems not to be available in my C# script components or when loading RhinoCommon in VS.

I can check the assembly version by:

Version v = typeof(Curve).Assembly.GetName().Version;

Which gives me 6.20.19322.20361, so I am not sure what I’m missing. Is my GH using a different assembly version? Or is it just this method that wasn’t opened in 6.20.

As opposed to this, I can for example see the MeshThicknessMeasurement struct which apparently was also available as of 6.20

Thanks!

JL

Posts: 6

Participants: 2

Read full topic

Project curve points (vertex) onto mesh C#

$
0
0

@new wrote:

Hello,

I ve been trying to copy and align the vertex points of the curves on the mesh but it doesn’t seem to work. I am kind of new with C# … can anyone show me how to correct it or direct me close to the solution?

I would really appreciate any help. :slight_smile:

Regards,

Margi

formfinding .gh (19.5 KB)

P01.3dm (30.7 KB)

Posts: 1

Participants: 1

Read full topic

Control Point as Output parameter

$
0
0

@Moonpick wrote:

Hello,
I am trying to get control points out of a Grasshopper custom component that takes nurbs geometry as input. So similar to the curve “Control Points” or the “Surface Points” features.
Problem is, having registered a Point parameter using AddPointParameter in the RegisterOutputParams methode, I can only output objects of type GH_Point or if I am right objects that can be casted into a GH_Point like Point3ds. No control points.
Converting ControlPoints into GH_Point using GH_Convert doesn’t work, but if it would, I guess I would loose the controlPoint properties anyway.
I tried registering GeometryParameter resp. GenericParameter, but it doesn’t lead to the objectiv either.

So, is there a way to output control points? Any help appreciated, thank you!

Posts: 4

Participants: 3

Read full topic

Mesh vertex normals list

Viewing all 3629 articles
Browse latest View live


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