Grasshopper

algorithmic modeling for Rhino

Hello, I would like to create a component for grasshopper.

I woud like to create a special rectangle define by :

INPUT : two points and width.

OUTPUT : rectangle output geometry, area and normal vector of the rectangle

Here is a sketch.

I found also into rhinoscript help some script however I don't see how to manage to create such a component for a use into grasshopper.

Could you possibly help me ?

Thank you.

Marc

GetRectangle

Pauses for user input of a rectangle.

Syntax

Rhino.GetRectangle ([intMode [, arrPoint [, strPrompt1 [, strPrompt2 [, strPrompt3]]]]])

Parameters

intMode

Optional.  Number.  The rectangle selection mode.  If not specified, all modes (0) are available.  The rectangle selection modes are as follows:

Value

Description

0

All modes.

1

Corner.  A rectangle is created by picking two corner points.

2

3-Point.  A rectangle is created by picking three points

3

Vertical.  A vertical rectangle is created by picking three points.

4

Center.  A rectangle is created by picking a center point and a corner point.

arrPoint

Optional.  Array.  A 3-D base point.

strPrompt1

Optional.  String.  The first prompt or message.

strPrompt2

Optional.  String.  The second prompt or message.

strPrompt3

Optional.  String.  The third prompt or message.  The third prompt used only with 3Point and Vertical modes.

Returns

Array

An array of four 3-D points that define the corners of the rectangle if successful.  Points are returned in counter-clockwise order.  See the image below for details.

Null

If not successful, or on error.

Example

Dim arrRect

arrRect = Rhino.GetRectangle

If IsArray(arrRect) Then

Rhino.AddTextDot "0", arrRect(0)

Rhino.AddTextDot "1", arrRect(1)

Rhino.AddTextDot "2", arrRect(2)

Rhino.AddTextDot "3", arrRect(3)

Views: 1323

Replies to This Discussion

Hi Marc,

here is an example how it could work. I don't know exactly how you're going to use it but this should give you an idea of how to start with it.

I've added you both C# and VB. Question: Why C++?

Hope this helps...good work

Cheers FF

Attachments:

Two points on the middle of two opposing edges and a with do not define a unique rectangle. Any rectangle which satisfies these constraints can be rotated around the axis defined by the two points and it will still satisfy the constraints.

Also, are you looking to do this in a Script component or do you want to create a GHA library using Visual Studio?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you David for your reply.

It will be great if I could create a user object with it.

I will try to work out with the Script component for now.

Best Regards

Hello,

Is there anychance, someone could add a plane component as an input ?

thank you for your help.

I've added a few lines in Florian's component. With z-Vector and cross product you get the y-Axis in order to define a plane. Then you can rotate around the x-Axis.

Hope that helps.

Best, 

Ralf

Attachments:

Thank you this is great.

However I would like to input a specific plane into the plane input of this component if possible ?

thank you.

Marc

I only did the C# one.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thank you. it works great.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service