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

Why OnDeleteObject event watch transformed objects?

$
0
0

@Filip wrote:

Hi
I’m using OnDeleteObject() event overridden from CRhinoEventWatcher class. My goal is to detect when some objects are deleted from the scene. But the event is triggered for every transformation done on that objects, even if they are moved. How to prevent this? How is possible OnDeleteObject event to catch transformed objects? Is there are any another event watcher ONLY for deleted objects from the scene, or is it possible to add something else with this event?
– Filip

Posts: 4

Participants: 3

Read full topic


RhinoCommon Split curve by two parameters

Migrating Plug-ins from Rhino 5 to Rhino 6 C++

$
0
0

@dimcic wrote:

Hi,

I tried migrating some of my Rhino 5 Plug-ins to Rhino 6…used the migrator.exe - it worked fine…but the builds give me hundreds of errors. So without going into specifics for now, I would have a general question…is it possible that so many classes and functions have changed in Rhino 6 SDK? If yes that is it…have to find new solutions for every method that changed…and it will probably take me at least a week per plug-in to migrate them :slight_smile: But I would just like to know (somehow) if that is it…because maybe all of those methods and classes still exist in the same form but the problem is somewhere else…I will just give you couple of examples to start the conversation…

CRhinoUiEdit - not a recognized class anymore

Problems with Annotations…
error C2065: ‘CRhinoAngularDimension’: undeclared identifier (this is the case with most Dimension classes)
error C2065: ‘CRhinoRadialDimension’: undeclared identifier
CRhinoAnnotationLeader not recognized

Some problems with the meshes - I guess some members became private…:

error C2248: ‘ON_MeshParameters::m_mesher’: cannot access private member declared in class 'ON_MeshParameters’
error C2248: ‘ON_MeshParameters::m_grid_amplification’: cannot access private member declared in class 'ON_MeshParameters’
error C2248: ‘ON_MeshParameters::m_grid_max_count’: cannot access private member declared in class ‘ON_MeshParameters’

Some functions have changed?
error C2664: ‘ON_Brep *RhinoCreateEdgeSrf(int,const ON_Curve **)’: cannot convert argument 2 from ‘ON_NurbsCurve [3]’ to ‘const ON_Curve **’

I guess this was deprecated and now removed:
error C2039: ‘FindLayer’: is not a member of 'CRhinoLayerTable’
error C2039: ‘m_layer_id’: is not a member of 'CRhinoLayer’
error C2039: ‘m_parent_layer_id’: is not a member of ‘ON_Layer’

And a huge bulk of the problems comes from the Conduit…and rhinosdkdisplayconduit.h

CRhinoDisplayConduit

error C2039: ‘IsEnabled’: is not a member of ‘CConduitPreview’

1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(161): error C2011: ‘CRhinoDisplayConduit’: ‘class’ type redefinition

1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(65): error C2011: ‘CSupportChannels’: ‘struct’ type redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(55): note: see declaration of 'CSupportChannels’
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(113): warning C4005: ‘CHANNELS_SUPPORTED’: macro redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(100): note: see previous definition of 'CHANNELS_SUPPORTED’
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(139): error C2011: ‘EConduitNotifiers’: ‘enum’ type redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(118): note: see declaration of 'EConduitNotifiers’
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(161): error C2011: ‘CRhinoDisplayConduit’: ‘class’ type redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(142): note: see declaration of 'CRhinoDisplayConduit’
1>x:\triangle\proarch\develop\rhino\plug-ins\free\eve_explode\eve_explode_r6\ConduitPreview.h(5): error C2504: ‘CRhinoDisplayConduit’: base class undefined
1>ConduitPreview.cpp
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(65): error C2011: ‘CSupportChannels’: ‘struct’ type redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(55): note: see declaration of 'CSupportChannels’
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(113): warning C4005: ‘CHANNELS_SUPPORTED’: macro redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(100): note: see previous definition of 'CHANNELS_SUPPORTED’
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(139): error C2011: ‘EConduitNotifiers’: ‘enum’ type redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(118): note: see declaration of 'EConduitNotifiers’
1>c:\program files (x86)\rhino 5.0 x64 sdk\inc\rhinosdkdisplayconduit.h(161): error C2011: ‘CRhinoDisplayConduit’: ‘class’ type redefinition
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(142): note: see declaration of 'CRhinoDisplayConduit’
1>x:\triangle\proarch\develop\rhino\plug-ins\free\eve_explode\eve_explode_r6\ConduitPreview.h(5): error C2504: ‘CRhinoDisplayConduit’: base class undefined
1>ConduitPreview.cpp(6): error C2027: use of undefined type 'CSupportChannels’
1>c:\program files\rhino 6 sdk\inc\RhinoSdkDisplayConduit.h(55): note: see declaration of 'CSupportChannels’
1>ConduitPreview.cpp(6): error C2065: ‘SC_PREDRAWOBJECTS’: undeclared identifier
1>ConduitPreview.cpp(6): error C2065: ‘SC_CALCBOUNDINGBOX’: undeclared identifier
1>ConduitPreview.cpp(6): error C2614: ‘CConduitPreview’: illegal member initialization: ‘CRhinoDisplayConduit’ is not a base or member
1>ConduitPreview.cpp(27): error C2027: use of undefined type ‘CSupportChannels’

I am also getting some errors from opennurbs…but I am not sure what that is about…and it does not appear in the Output:

And I realize that there is a problem with the Dialogs…I am not seeing the CDialog…which I assume comes from removing the dependence from MFC?

Posts: 1

Participants: 1

Read full topic

Can't run Command from custom Python Command in Rhino 6

$
0
0

@LasseK wrote:

I have previously made some custom Python commands in Rhino 5, but when trying them out in Rhino 6, commands that calls commands in the Rhino Commandline doesn’t work anymore. Calling rhino commands from a python script directly in the Python editor works fine. I have tried with both rhinoscriptsyntax and RhinoCommon. Example of python command not working:

import rhinoscriptsyntax as rs

__commandname__ = "Test"

def RunCommand( is_interactive ):
    rs.Command("Line ")
    return 0

However calling this from the python editor works:

import rhinoscriptsyntax as rs

__commandname__ = "Test"

def RunCommand( is_interactive ):
    rs.Command("Line ")
    return 0
RunCommand(True)

And all other custom python commands without rs.Command("rhinocommand") works fine

Posts: 1

Participants: 1

Read full topic

Using an object as argument in RunScript

$
0
0

@arne1 wrote:

Hi,
I 'm using this function to find all controlpoints within a closed curve on a mesh surface.
It works ok, but the command asks the user to select the closing curve. I already have the curve as a RhinoObject “region”. Is there a way to pass this in the RunScript so that the user do not have to click it?

Thanks

    private ArrayList getMeshGripsWithinRegion(RhinoObject mesh, RhinoObject region)
    {
        RhinoApp.RunScript("_-CullControlPolygon Cull=Yes", false);
        RhinoApp.RunScript("_-SelBoundary", false);

        var grips = mesh.GetGrips();
        var selectedGrips = new ArrayList();
        foreach (var g in grips)
        {
            if (g.IsSelected(true) > 0)
            {
                selectedGrips.Add(g);
            }
        }

        return selectedGrips;
    }

Posts: 2

Participants: 2

Read full topic

How to do relative file paths in a plugin folder

$
0
0

@rcmcdougle wrote:

I’m new to this so please be patient. I am creating a custom toolbar for a client that will be distributed out to multiple users across the enterprise. Some of these buttons contain Python code and others >Open / Import 3dm files and load .gh scripts. The desire is to have the lot of these files and scripts in the rhino/plugins/rcmsub folder. I would then bundle everything into a .rhi for distribution.

What is the path to call these files / scripts from a tool button?

When I release a new .rhi will it overwrite previous files with the same name?

Is there a way to automatically clean out the /rcmsub folder before loading in the new files?

Many thanks for all input.
Robb

Posts: 1

Participants: 1

Read full topic

Script files to load when Rhino starts on Rhino 6

$
0
0

@Jordi_Llonch wrote:

Hi,

I need to add a couple of scripts to load when Rhino starts using my installer.
With Rhinoceros 5 I modify the windows registry more or less this way:
WriteRegStr “HKCU” “Software\McNeel\Rhinoceros\5.0x64\Scheme: Rhinojewel\Plug-ins\1c7a3523-9a8f-4cec-a8e0-310f580536a7\Settings\StartupFileList” “File0” "$INSTDIR\Scripts\init.rvb"
WriteRegStr “HKCU” “Software\McNeel\Rhinoceros\5.0x64\Scheme: Rhinojewel\Plug-ins\1c7a3523-9a8f-4cec-a8e0-310f580536a7\Settings” “StartupFileListCount” “1”

But it seems that Rhinoceros 6 is using other mechanism to save the list of script files to load when Rhino starts.

Is there a way to configure scripts files to load outside of Rhinoceros?

Thanks!

Posts: 2

Participants: 2

Read full topic

Eto form with multiple tabs

$
0
0

@Mostapha wrote:

Following @dale sample scripts I was able to create a form using Eto library and IronPython in Rhino 6.

Now I want to add one more tab to this form. Does anyone have a sample code for a multi-tab form created using Eto?

Posts: 3

Participants: 2

Read full topic


Brep offset C#

$
0
0

@Petras_Vestartas wrote:

Hi,

I would like to ask if it is a bug for Brep.Offset method or I am doing something wrong?
I am running Brep.Offset method from C# custom component in grasshopper and I get this type of offset for some of values.

` Brep[] offset = Brep.CreateOffsetBrep(x, y, true, true, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, out blends, out walls);

Shape is quite simple:




BrepOffset.gh (13.2 KB)

Posts: 1

Participants: 1

Read full topic

Convert Brep face to mesh C#

$
0
0

@Petras_Vestartas wrote:

Hi,

What would be the method to convert brep faces to meshes?
(I know that I could do Mesh.CreateFromBrep(brep, MeshingParameters.Default)[0]; but I need to convert individual trimmed brep faces )

When I try to convert each brep face I got untrimmed brep mesh conversion:

  private void RunScript(Brep B, ref object A)
  {

    List<Mesh> meshes = new List<Mesh>();

    foreach(BrepFace f in B.Faces){
      Mesh mesh = Mesh.CreateFromBrep(f.ToBrep(), MeshingParameters.Default)[0];
      meshes.Add(mesh);
    }

    A = meshes;

  }

Posts: 1

Participants: 1

Read full topic

Python guid error

$
0
0

@onrender wrote:

Hi, I need some help,

I have a Python for loop and got the "Message: Parameter must be a Guid or string representing a Guid"
I am looping a list but not sure what is the right format of the Guid.

in-between single quotes
’<System.Guid object at 0x0000000000000039 [09c04700-f879-4e06-8432-f1a381f781f7]>'
without single quotes
<System.Guid object at 0x0000000000000039 [09c04700-f879-4e06-8432-f1a381f781f7]>
or simple ID
[09c04700-f879-4e06-8432-f1a381f781f7]

Posts: 3

Participants: 2

Read full topic

Zoo - ProductKeyTextMask

$
0
0

@mpcarlos87 wrote:

Hi,

I’m using the new Zoo version (6.0.18009.02391) and there is a new method public string ProductKeyTextMask() that’s giving me some problems:

  • I don’t want a text mask but if I set this method to return string.Empty or null, it makes Zoo server crash before the window to write the license shows up. Can I avoid the use of a text mask?
  • I don’t find any documentation about the “mask”. “A” means a position _ at the license that’s the only thing I know.

Also I noticed there is a new method public int ValidateProductKeyUI(string productKey, out string validatedKey, out List clusterSerialNumbers) and it’s being called instead of the method public int ValidateProductKeyUI(string productKey, out string validatedKey). ¿When do you call the second one?

Regards,

Posts: 1

Participants: 1

Read full topic

[RhinoCommon] Projecting a Curve onto three Planes

$
0
0

@lungenstrudel wrote:

Hi,

I am searching for an elegant way of projecting a curve (cyan) onto three intersecting PLANES (gray) in order to achieve a projected curve (red).

At the moment, all that comes to my mind is extruding the curve, splitting it with one plane after the other, and somehow extracting the boundary curve of the remaining object, but this seems to be rather slow, complicated and error-prone.

Is there a simpler way?

Also, as a second step, i need a Brep consisting of three planar surfaces instead of the red curve. How can that be done?

Best regards, Heinz

Posts: 1

Participants: 1

Read full topic

Best Way to Make Graph Editor GUI

$
0
0

@dks5254 wrote:

I am trying to decide on the best way to go about making a GUI for a plug-in, specifically like the one linked below:

I have experimented with the python api, including the ETO forms, I am having trouble finding a way to do something like this. I would think that since this is a rather complex scale-able gui compenent that it would require a C++ plugin with a custom OpenGL panel for this graph section. In the interest of time, I would like to be able to use python, but I am doubting the capabilities of this api. Does anyone have any advice?

Posts: 2

Participants: 2

Read full topic

Plugin installer

$
0
0

@gianfranco74 wrote:

Hi all. I would like to install my plugin this way. Probably it is a very bad idea, but i would like to know why it does not work
class run_rhp
{
public static void run(string PROGRAMFILES_path)
{
string my_rhp_folder_path = Path.Combine(PROGRAMFILES_path, “my_rhp_folder”);
string my_rhp_path = Path.Combine(my_rhp_folder_path, “my_rhp.rhp”);
string rhino_6_exe_path = Path.Combine(PROGRAMFILES_path, @“Rhino 6\System\Rhino.exe”);

        Process.Start(rhino_6_exe_path, my_rhp_path);
    }
}

If in my_rhp_path there are spaces(“Program File” has a space)it doesn’t work.
I tried to put my_rhp_folder_directly in “C:” and it works fine. I tried passing @"…" with no result.
i would like to understand.Thanks

Posts: 2

Participants: 1

Read full topic


Dll dependency failed in RH6

Graphics performance port from V5 OpenGL Display Lists to V6 ExecConduit/CRhinoDisplayPipeline

$
0
0

@StephanSchmaelzle wrote:

We have a Rhino plugin displaying large amounts of facets/vertices/lines etc.
In V5 we could use OpenGL display lists, update them only when needed and call them
in drawmiddleground() drawforeground(). Worked perfectly.
In V6 using ExecConduit/CRhinoDisplayPipeline I can not achieve the same graphics performance, e.g. too many primitive operations like DrawShadedMesh, DrawPolygin DrawNurbsCurve etc are called over and over again.

Can someone shed some light on how we can get the performance back?
KR
Steafn

Posts: 4

Participants: 2

Read full topic

Rhino 6 C++ Creating a Library

$
0
0

@dimcic wrote:

Hi,

I am in the process of transitioning to Rhino 6 and one of the things is transferring some libraries. Following the Moose example (https://github.com/dalefugier/Moose) I was able before to create a C++ Library that could be used in other projects (C++ and C# projects)…Trying to do the same now doesn’t work. The plug-in that calls some function from the library cannot get loaded…it always gives the same message: Unable to load test.rhp plug-in: Dependent DLL is out of date. I tried this twice, on two separate computers…

I uploaded an example with both the library project and the plug-in project here:

https://drive.google.com/file/d/1BWydB1AUvVI8NSSuV3vKf2vp7Vb2zLB1/view?usp=sharing

I am hoping for a short fix and that I am probably missing something obvious - but for the long run I guess it would be the best to update the Moose example…?

Thanks!

Posts: 4

Participants: 2

Read full topic

Project point to mesh returns wrong and multiple intersections

$
0
0

@Holo wrote:

Hi, I made a tool that project points onto meshes but the results are wrong if the point is close to an edge, both interal and external.

Here all results that give more than one intersected is higlighted in red. The big problem here is that either one of them or both of then are NOT on the mesh.

As you can see there are points on the outer edges that are plain wrong too, and that only returns one answer, so these are not red.

The mesh is good, I have exploded and welded and unwelded to see if that could help, but to no avail. The problem is both in V5 and a V6.

points to mesh error script.py (815 Bytes)

points to mesh error file.3dm (89.4 KB)

Any workarounds are welocome too, as I need this to work prior to any fixes :slight_smile:

Posts: 2

Participants: 1

Read full topic

Using Grasshopper Component picker geometry from rhino, the geometry could not persist User Dictionary

$
0
0

@cughudson wrote:

When I Seting User Dictionary to the geometry (for example Brep) using plugin write by myself (the plugin work perfect). But when I picker the geometry from rhino, I could not view the geometry’s User Dictionary Data. That is to say, the User Dictionary Data could not persist, From Rhino Geometry to Grasshopper Geometry.
I think it is a problerm.

Posts: 1

Participants: 1

Read full topic

Viewing all 8546 articles
Browse latest View live