Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all 8543 articles
Browse latest View live

Creating a "large scale" plugIn to rhino

$
0
0

@Matti_Pirinen wrote:

Hi @dale (and everyone else),

I’m in process of creating a pretty large scale add on to rhino. I’ve started to code it using windows forms and now it has started to swell up like a bun dough. So before it becomes unbearable difficult to do a large scale changes to the program I wanted to ask some general questions:

-Would it better to change from windows forms to wpf?
-What are the benefits in registering the forms/user controls as rhino panels? To open this question a bit I’m a bit frustrated with some of the properties of the rhino forms which are:
- I cannot maximize the form to a different screen. (If i double click the form it will automatically dock into the rhino.
- When I take a focus out of the rhino (to some other program) the panel disappears, which is very frustrating when I want to some data from the panel.
So my main idea of how to use the add on is in full screen mode in a monitor next to the monitor where the rhino is running.

-Is it ok to store large amount of data with the archivable dictionary into the rhino file? I am planning of bringing FEM data to my plugin, which results a data a mouth which can be hundreds of megabytes.

With best regards
Matti

Posts: 3

Participants: 3

Read full topic


DimStyleTable CurrentDimensionStyleIndex fails

$
0
0

@clement wrote:

Hi @dale, @Alain,

the example python script in the RhinoCommon help gives an error:

Message: ‘TextEntity’ object has no attribute ‘Index’

Apart from that, I used CurrentDimensionStyleIndex in V5 but in V6 i get this error:

Message: ‘DimStyleTable’ object has no attribute ‘CurrentDimensionStyleIndex’

as a replacement i used CurrentDimensionStyle.Index in V6, but it would be preferred if there is the same method which works in V5 and V6.

_
c.

Posts: 6

Participants: 2

Read full topic

HatchPatternTable.FindName bug

$
0
0

@clement wrote:

Hi @Alain,

i am trying to find the solid hatch pattern in Rhino 6 using the new FindName method. If i open a blank new file using any template and run this:

import scriptcontext

solid_index = scriptcontext.doc.HatchPatterns.FindName("Solid")
print solid_index

it returns None. The solid hatchpattern exists in the file, once i open the _Options dialog, click on the Hatch page entry and close the _Options dialog, then run the script again, it returns:

HatchPattern: Solid (0)

I can repeat the same behavior using the now obsolete method:

scriptcontext.doc.HatchPatterns.Find("Solid", False)

which returns first an index of -1 then 0. It does not give any deprication message in V6 and works in V5.
_
c.

Posts: 1

Participants: 1

Read full topic

Curve.Split(IEnumerable) RH5-6 behavior change

$
0
0

@Dani_Abalde wrote:

Hey there,
the following code works differently in R5 than in R6, for a closed curve:

private void RunScript(Curve C, double t, ref object A)
{
   Print(C.Domain.ToString()); //returns: 0.249, 1.249
   A = C.Split(new double[]{0,t}); //returns one curve in R6, two in R5.
}

in R6 I can fix it by replacing 0 with C.Domain.T0, but it has been a change that has ruined at least one of my tools. Anyway, I just wanted to report it.

Does anyone know the reason for this change? It seems to be something underlying related to the domain of the curve but I would like to know why, because it seems to have consequences on other sides.

Thanks.

Curve.Split() issue.gh (7.3 KB)

Posts: 4

Participants: 2

Read full topic

ShowMultiListBox() bug

$
0
0

@Matthieu_from_NAVINN wrote:

Hi, there seems to be a bug with Dialogs.ShowMultiListBox() for RH6.
The dialog never pops, while if i use ShowListBox() instead with the same parameters it works.

I will use another control instead so I dont really need it right now, but you might want to fix this.

Posts: 1

Participants: 1

Read full topic

Active tab at Rhinoceros starting

$
0
0

@zer41k wrote:

Hello! :blush:
I’m developing plug-in using C++.
The feature I’m trying to implement is: If the current session of Rhinoceros is closed with active (selected) tab “Properies”


then after the start of new Rhinoceros session this tab will be also active (by default as I can see the left tab is always active after Rhinceros loading).

For this I:

  1. I save the ID’s of active tabs (gotten by CRhinoTabbedDockBarDialog::GetOpenTabIds()) in register.
  2. After Rhinoceros start (in CRhinoIsIdle) I show saved tabs (ShowDockbarTab)

The question is:
When can I save active tabs? I want to save them right before closing of Rhinoceros. But in “OnUnloadPlugIn”, “OnCloseDocument”, “OnCloseRhino” dockBar’s are already destroyed and “GetOpenTabIds” returns nothing.

For now I save them in “OnEndSaveDocument”. But it would be great to save active tabs even without document saving.
Thanks for any help you can provide!

Posts: 1

Participants: 1

Read full topic

Retun Value with Mouse Callback

$
0
0

@flecheria wrote:

Hi
Someone has an example about how to return values from Mouse Callback? For example onMouseUp return something?
I still have my problem with Delegate, handler Event and so on.
Thanks

Paolo

Posts: 3

Participants: 2

Read full topic

RhinoCommon Brep split by plane


Inconsistent Grouping of Lines

$
0
0

@eebs99 wrote:

I’m using Rhinocommon to generate surfaces, and then I convert them to lineframes and wireframes (a 2D list of ordered curves; using lines and curves, repectively). The wireframe generation is successful, however my issue comes when I try to group them. My goal is to have all the u and v curves grouped separately.

The lineframe code works as intended. All the u and v curves are grouped separately, as well as all the objects being grouped together afterwards. I then simply copied and pasted the same code to the wireframe part, yet the grouping is not the same. This code gives me two groups where both the u and v curves are grouped together, twice (meaning I have to ungroup twice to get the individual curves). Is this a programming issue or is there something I am not aware about how groups work?

Here is the code that I use:

            if (lineframes.Count != 0)
            {
                child.Name = "Lineframe";
                index = doc.Layers.Add(child);

                foreach (List<List<Polyline>> lineframe in lineframes)
                {
                    var group = new List<Guid>();

                    foreach (List<Polyline> list in lineframe)
                    {
                        var guids = new List<Guid>();

                        foreach (Polyline polyline in list)
                            guids.Add(doc.Objects.AddPolyline(polyline, new Rhino.DocObjects.ObjectAttributes { LayerIndex = index }));

                        doc.Groups.Add(guids);
                        group.AddRange(guids);
                    }

                    doc.Groups.Add(group);
                }

                doc.Views.Redraw();
                doc.Layers.FindIndex(index).IsVisible = false;
            }
            if (wireframes.Count != 0)
            {
                child.Name = "Wireframe";
                index = doc.Layers.Add(child);

                foreach (List<List<Curve>> wireframe in wireframes)
                {
                    var group = new List<Guid>();

                    foreach (List<Curve> list in wireframe)
                    {
                        var guids = new List<Guid>();

                        foreach (Curve curve in list)
                            guids.Add(doc.Objects.AddCurve(curve, new Rhino.DocObjects.ObjectAttributes { LayerIndex = index }));

                        doc.Groups.Add(guids);
                        group.AddRange(guids);
                    }

                    doc.Groups.Add(group);
                }

                doc.Views.Redraw();
                doc.Layers.FindIndex(index).IsVisible = false;
            }

EDIT: separate question, but still relating to the code above: my goal is to have both of the child layers I create here to be invisible (the parent is always visible). This does work, however when implemented in Rhino, the lightbulb that represents the layer visibility is half open half closed. This is fine, except now I have to click it twice to make the layer visible. For convenience’s sake, I simply want to click it once to unhide the layer. Is there a way to do so?

Posts: 2

Participants: 1

Read full topic

Custom User Data

$
0
0

@Matthieu_from_NAVINN wrote:

Hi,
I’ve got a bug with my custom UserData:

_DeckRooms = New List(Of String)({"This", "is", "a", "test"})
_DeckName = "This is a test"
 Dim dict = New Rhino.Collections.ArchivableDictionary(1, "MSPLayerData")
    dict.[Set]("DeckRooms", _DeckRooms)
    dict.[Set]("DeckName", _DeckName)
    archive.WriteDictionary(dict)

While I’m not closing Rhino, it works fine, I can read and write my user data (both my list(of string) and my string variable).
When I close/re-open rhino, my list(of string) Dictionary entries are lost, while my string objects are still there. I’ve got the same issue with every Custom UserData, doesn’t matter where they are stored (One is on the layers, another on the objects…)

I’m using Rhino RC 6.5

Posts: 2

Participants: 1

Read full topic

Viewport list

$
0
0

@nblisboa wrote:

Hi, I need a help, when I open a drawing, I import Viewports from another drawing with the command “NamedView Import.”
After that I need to run a plugin that reads all the names of viewports, very simple,

CRhinoDoc * doc = pApp.ActiveDoc ();

nvistas.Empty ();
doc-> GetViewList (nvistas, true, false);

The problem is that the names of viewports imported from the other drawing do not appear in the list.
How do I make all names appear in the Viewports list?

Posts: 1

Participants: 1

Read full topic

Com Interface

$
0
0

@pospis wrote:

Hello,
we try to connect our software with an open Rhino 6.4 and it doesn’t succeed.
If we connect to Rhino 6.1 it works.
We use the com-interface with VS C++.
With older versions (Rhino 4 /Rhino 5) we haven’t any problems.

Code:
OleInitialize(NULL);
IRhinoInterfacePtr m_pRhino6Interface_64;
m_pRhino6Interface_64.CreateInstance(_T(“Rhino.Interface”);

Posts: 1

Participants: 1

Read full topic

Fail to get IRhinoApplication from COM Object in Rhino 6

$
0
0

@archinate1 wrote:

Hello,
I have a tool that I am migrating from Rhino 5x64 to Rhino 6. My Rhino 5x64 tool uses IRhinoApplication as follows:

Type type = Type.GetTypeFromProgID(“Rhino5x64.Application”);
dynamic rhino = Activator.CreateInstance(type);
IRhino5x64Application RhinoApp = rhino as IRhino5x64Application;

This is the code I am using for Rhino 6 COM is:

Type type = Type.GetTypeFromProgID(“Rhino.Application.6”);
dynamic rhino = Activator.CreateInstance(type);
IRhinoApplication RhinoApp = rhino as IRhinoApplication;

Activator.CreateInstance returns a COM object. However, casting the “rhino” as IRhinoApplication (Rhino 6) returns null.

If I try to do a something like:

IRhinoApplication RhinoApp = rhino;

Then I get:

{“Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Rhino.IRhinoApplication’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{9837542C-DC30-4EBE-BA30-B6EBDF471508}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).”}

What is the recommended set up for Rhino 6?

Any help is appreciated!
-Nate

Posts: 3

Participants: 2

Read full topic

Eto Forms: Sorting GridView from column heading click?

$
0
0

@chanley wrote:

I can’t seem to find any documentation on how to sort a gridview on an eto form, by clicking on the column header? Is this possible? I can reorder the columns, but I can’t get them to sort. Here is the example I am working with, (taken from Cell color in Eto with Python)


This code is being run from a ghpython component. It’s just for testing at the moment to learn a little more about eto forms. Any suggestions on sorting the contents would be appreciated!
Eto_Grid.gh (3.4 KB)

Posts: 3

Participants: 3

Read full topic

Change Brep opacity, color, etc. in C++?

$
0
0

@NathanM1994 wrote:

Hi,

Within a custom CRhinoBrepObject I need to change its transparency inside Draw(). I’ve tried something like this:

        CDisplayPipelineMaterial material = dp.DisplayAttrs()->m_pMaterial->m_FrontMaterial;
	material.m_FrontMaterial.SetTransparency(1.0);
        dp.DrawShadedBrep(*const_cast<ON_Brep*>(Brep()), &material);

However my Brep keeps being opaque:

Though something must be well done, when I translate it looks transparent:

Seems like Rhino will always draw my object on top depth with the opaque default color? How can I manipulate it?

Thx
Nathan

Posts: 1

Participants: 1

Read full topic


Ship hull 3-D design with Rhino-python

$
0
0

@vishalg2235 wrote:

Hello!
My project is to design ship hull 3-D model using offset table and then generation of hull geometry and hyrdrostatic curves for different length, depth and breadth parameters for drawing so much geometry I decided to make program(preferably in Python) of it. My professor recommended me Sesam’s HydroD and GeniE software and Rhinoceros software. Please help me as I’am beginner in Rhino-python.
Thanks !

Posts: 9

Participants: 3

Read full topic

Command Line Events

$
0
0

@mconti wrote:

Hi All,

Is it possible to catch a Keyboard event during a GetNumber method (or something similar…)?

for example, i want to draw interactively an offset after the keyboard changing of the offset value that i’m writing on the command line…

like the TextChanged event on a textbox, but with the command line…

thanks

Posts: 1

Participants: 1

Read full topic

Polysurfaces

$
0
0

@f.leon.marquez95 wrote:

Hello, I would like to know if there is a way to select a polysurface and treat this as a surface using c++, I am using Rhino 5 by the way. I mean, for example if I had a polysurface and I want to get the area and centroid, how could I write a line of code to do this or which type of ON_geometry would it be.
For example for getting a surface I type these lines of code

CRhinoGetObject go;

go.SetCommandPrompt( L"Select surface" );
go.SetGeometryFilter( CRhinoGetObject::surface_object );
go.GetObjects( 1, 1 );
if( go.CommandResult() != success )
	return go.CommandResult();
// Validate selection
const CRhinoObjRef& refSurf = go.Object(0);
const CRhinoObject* objSurf = refSurf.Object();
const ON_Surface* srf = refSurf.Surface();
if( !srf )
	return failure;

but it doesnt work for polysurfaces, would there be a way to select a polysurface?

Thank you

Posts: 2

Participants: 2

Read full topic

Select item and run script

$
0
0

@onrender wrote:

Hi,

I am looking for way to combine the selection command with python script, that works with the left mouse button. So, I want to select an object and run the script.

Posts: 1

Participants: 1

Read full topic

Vector normals calculation. Headache ;)

$
0
0

@ChristopherBotha wrote:

Hi, Just pokng about with this “AR” bringing a hand into Rhino, I bring in the joints as point3d’s from the leap library, then draw the "wires between them, I am trying to bring an object from world origin to a specific finger, using a vector translate, but the “roll” (rotation around Y axis) is quite random and uncontrollable.

I tried three seperate X, Y and Z rotations based on the angles I can pull from the library about the finger XYZ_pitch,roll,yaw, but the Movepitchroll*yaw transform is a tad nuts, ring goes flying all over space.

Vector transform gets me 99% there except that damn roll, any clues on how to work around this?

My current code and some image of the issue, the little ball is Z top.

My current thing is you cant pull a "normal from a vector (i may be wrong) so create a mesh between the two point si do have and the neighbouring two points from the next finger, create a surface/mesh, then pull a normal from that, but how would I apply that normal in my vector equation?

var fingerpointto = (PointsConduit.PointList[15] + PointsConduit.PointList[14]) / 2; //ring finger
var translate = fingerpointto - Point3d.Origin;
var VectorTo = PointsConduit.PointList[15] - PointsConduit.PointList[14];
var Rotation = Transform.Rotation(Vector3d.YAxis, VectorTo, Point3d.Origin);
var Move = Transform.Translation(translate);
var TotalTransform = Move * Rotation;
e.Display.DrawObject(ring, TotalTransform);

Thanks!

Posts: 2

Participants: 2

Read full topic

Viewing all 8543 articles
Browse latest View live