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

Plugin version in R5 vs R6

$
0
0

@axa wrote:

We develop an in-house plug-in in Python that is compiled into an RHI with the Script Compiler.

The plug-in properties would show a version such as 1.0.6710.28824. This is in R5

In R6, the version is shown as 1.0.0.0. This is inconsistent, and causes issues with our update check that we run when Rhino launches.

Posts: 1

Participants: 1

Read full topic


[Need HELP] Getting in touch with C++ and trying out a Sample code

$
0
0

@chibinobi wrote:

Hello everyone,

I have a question, coming from a complete beginner in codes and scripting.
I just found a useful tool online, for exporting a curve from the draft angle analysis.
As the kind person even provided a sample code, I at least wanted to try it out, so I was looking for a way to use the code in rhino but I’ve been trying and trying all day for now but I can’t seem to find a way to implement it/use it.
That’s why I’m hoping there to be someone to maybe help me out!
(the tutorial: http://developer.rhino3d.com/guides/cpp/draft-angle-contouring/)

I also don’t know if that’s the right direction already, but I started out with downloading the RhinoSDK and Visual Studio but even after following the instructions from the “first plugin creation” tutorial (http://developer.rhino3d.com/guides/cpp/your-first-plugin-windows/), I start to struggle as it tells me there would be new folders, files and classes generated after executing the Rhino 6 Plug In wizard but I’m left with none as it seems…

I hope someone can help me out as I would really like to try out the code and understand the coding and scripting…

Thanks in advance!!

Posts: 2

Participants: 2

Read full topic

How to access CRhinoOptionsDialogPage with C++?

$
0
0

@NathanM1994 wrote:

Hi,

I know how to create and add my own CRhinoOptionsDialogPage page, but not the way to access it from within any method in my code. There must be a public stack of the form ON_SimpleArray<CRhinoOptionsDialogPage*>& pages from which I retrieve it…

Thanks in advance,
Nathan

Posts: 1

Participants: 1

Read full topic

RhinoVR - a sample plug-in for rendering Rhino viewports in virtual reality

$
0
0

@DavidEranen wrote:

Hello!

I decided to also post here in Rhino Developer, since this plug-in is very much intended to be for developers.

For the last couple of months I’ve been working on a virtual reality sample plug-in for Rhino which showcases how to render Rhino viewports in VR. This plug-in is intended to be a helpful example for developers of Rhino plug-ins with VR functionality.

It is now available from here: https://github.com/mcneel/RhinoVR

The first version of RhinoVR can be downloaded as an RHI from here: https://github.com/mcneel/RhinoVR/releases

System requirements :

  • HTC Vive or Oculus Rift
  • Steam with the SteamVR app installed.
  • Rhino 6 (Service Release 6, currently only available as a service release candidate) or Rhino WIP.

Installation :
Make sure you have at least Rhino 6 version 6.6.18156.11421 or Rhino WIP version 7.0.18156.04035. Rhino 6 SR 6 is currently available as a service release candidate. To enable the downloading of service release candidates, go to Tools -> Options… -> Updates and Statistics -> Update frequency: Service Release Candidate. Then click “Check Now…”.

Technical information
There have been some SDK additions to make VR rendering easier. The main new function is the following method on CRhinoDisplayPipeline_OGL:

  //Description:
  //  Draws the viewport as seen from the left and the right eye viewports
  //  and returns the result as OpenGL texture handles.
  //
  //  dpa: The display pipeline attributes to use for drawing.
  //  vp_eye_left: The viewport representing the left eye location and look direction.
  //  vp_eye_right: The viewport representing the right eye location and look direction.
  //
  //Returns:
  //  handle_eye_left:  Will contain the OpenGL texture handle which references the left output color buffer.
  //  handle_eye_right: Will contain the OpenGL texture handle which references the right output color buffer.
  //
  //  true:  Drawing succeeded - 'handle_eye_left' and 'handle_eye_right' contain valid handles.
  //  false: Drawing failed    - 'handle_eye_left' and 'handle_eye_right' are both set to 0.
  bool DrawStereoFrameBuffer(
    CDisplayPipelineAttributes& dpa,
    const ON_Viewport& vp_eye_left,
    const ON_Viewport& vp_eye_right,
    unsigned long long& handle_eye_left,
    unsigned long long& handle_eye_right);

There is also a new enum StereoRenderContext which can be queried from CDisplayPipelineAttributes:

  enum class StereoRenderContext : unsigned int
  {
    NotApplicable = 0,
    RenderingLeftEye = 1,
    RenderingRightEye = 2,
    RenderingBothEyes = RenderingLeftEye | RenderingRightEye
  };

  StereoRenderContext GetStereoRenderContext() const;
  void SetStereoRenderContext(StereoRenderContext stereo_render_context);

The source code of RhinoVR itself should be pretty self-documenting. If you find any bugs or have any questions about the code then feel free to ask here, or to create an Issue or a Pull Request through github.

Usage :
Start Rhino and load the file you want to view in VR. Make sure a perspective viewport is selected and that it is set to the display mode you want to use. Type RhinoVR into the command line. This should automatically start Steam and SteamVR. If you’re using the Rift, it will also start the Oculus client. Rhino tells you when it is ready and asks you to put the VR headset on.

  • It is possible to navigate around in the Rhino scene using the VR controllers (Vive and Rift). Vive uses the touchpads for navigation and the Rift uses the analog sticks. The left controller controls translation (forward, backward, left, right) and the right controller controls horizontal rotation (turning left/right) and up/down movement.
  • Objects can be selected by pressing the touchpad button (Vive) or pressing the analog stick (Rift).
  • The Rhino Move-command can be initiated by pressing the Application Menu button (Vive) or the B-button (Rift). Remember, the move command works in steps: Select objects. Enter. Pick reference point. Pick new point.
  • A Rhino Enter key press can be mimicked using the VR controller by pressing the trigger button (Vive) or the A-button (Rift).
  • A Rhino Esc key press can be mimicked by squeezing the grip buttons (Vive) or by pressing the primary trigger button (Rift).

Type RhinoVR into the command line again to close down RhinoVR.

Finally, you can download a rather amateurish screen recording of me testing it out: https://drive.google.com/file/d/1v4c1WQN9c2iQ3MXWLQ9ZZsi-RKlm--yv/view?usp=sharing

Posts: 1

Participants: 1

Read full topic

Using Gumball from MouseCallback?

$
0
0

@Max_Eskin wrote:

I’m trying to show a gumball to manipulate a custom object which is not a Rhino object and is rendered via a DisplayConduit. I found the gumball sample, where a subclass of GetTransform is used to control the gumball from a command.

However I want to show the gumball on screen, and allow the user to interact with it like with the real gumball, not in a one-shot command. As far as I can tell, to do this I have to use a MouseCallback to detect MouseDown, and then start the gumball drag. However by the time I’ve gotten the MouseDown in the MouseCallback, it’s too late to start the Get() on the GetTransform object. Is there any way to tell the GetTransform object that it should not wait for a MouseDown and start dragging immediately?

Alternatively, I could not use GetTransform at all and just do everything from MouseCallback. But then I need a way to convert from ViewportPoint to 3d point which GetTransform does automatically.

Posts: 1

Participants: 1

Read full topic

RhPicture extension not working in V6

$
0
0

@Jarek wrote:

Hi @DavidRutten,

We can’t get the RhPicture to work in Rhino 6.
Is there any reason for it not to work as it used to?
The RhPicture.rhp plugin installs with no problem (reports passing compatibility test) but then we are unable to assign the plugin object to a variable, getting this error:

Option Explicit
Call Main()
Sub Main()
	Dim RhPicture
	Set RhPicture = Rhino.GetPluginObject("RhPicture")
End Sub

image

The same works fine in earlier Rhino versions (V4, V5).
A lot of our tools and workflow depends on its functionality. Hope we can keep using it in Rhino6 !

thanks,

–jarek

RhPicture.rhp (88 KB)

Posts: 1

Participants: 1

Read full topic

Lofting and Network Surf via Script / Rhino.Common

$
0
0

@brodiej wrote:

I’m at a point where I have 90% of a fan blade part automated with Rhino Python Script. I’m wondering what it would take to automate creating the geometry that bridges between the blade and the root. It looks like I need to delve into Rhino.Common, which looks like it might take a while to learn. Any ideas on how to solve this one?

I’d like to match tangency where possible between the two parts. When I do this manually, I split the main blade part so that I’ve got edges that are compatible between the two sections that I’m trying to blend between. I then use a combination of loft and network surfs. (Ideas on improving basic modeling also appreciated).

Ideas? I’m wondering if it’s possible to put points on edges and then select edges near the points? (Edge selection is needed to use tangency matching features).

without_seamwith_seam

with_seam

sample_part_with seam.3dm (796.8 KB)
sample_part_to_automate.3dm (808.2 KB)

Posts: 1

Participants: 1

Read full topic

File3dmObjectTable Item missing

$
0
0

@jimwau wrote:

The following compiler error happens, when trying to use the Item property of File3dmObjectTable. In the documentation
Item property returns a array object, type File3dmObject. What am I missing?

Jim

using Rhino;
using Rhino.Geometry;
using Rhino.FileIO;
using Rhino.DocObjects;
using Rhino.DocObjects.Tables;

        path = String.Format("{0}BullFallsPlugin\\BullFallsProfiles\\Ring\\{1}3dm", BullFallsPlugIn.localRhinoDirectory, currentRingProfile);
        Rhino.FileIO.File3dm file3Dm = new Rhino.FileIO.File3dm();
        file3Dm = Rhino.FileIO.File3dm.Read( path );
        File3dmObjectTable table = file3Dm.Objects;
        var count = table.Count;
        var obj = table.Item[0];

Severity Code Description Project File Line Suppression State
Error CS1061 ‘File3dmObjectTable’ does not contain a definition for ‘Item’ and no extension method ‘Item’ accepting a first argument of type ‘File3dmObjectTable’ could be found (are you missing a using directive or an assembly reference?) BullFalls C:\Users\jim\Documents\RhinoPlugin\C#\BullFalls\BullFalls\Operations.cs 357 Active

Posts: 1

Participants: 1

Read full topic


Deep Space 8k and Rhino presentation

$
0
0

@s.priglinger wrote:

I am cooperating with the ARS ELECTRONICA CENTER (AEC) in Linz / Austria concerning their Brain Lab. They have a so called Deep Space 8k presentation room and hardware , where I want to present my medical simulations and other kind of simulations , implemented in rhino+grasshopper.

The technical conditions are very special:

(1) The rhino program (== window) should run on a computer with special graphics processors. We can test this directly running rhino at this computer. Could be, that we need some support because of problems. AEC will officially download a test version of Rhino 6.

(2) I control the Rhino by Grasshopper in my presentations as usual. But Grasshopper should not run at the same computer as Rhino. Because the window of Grasshopper should not be visible to the audience which should see the Rhino Window only.

My Question is: how can we redefine (config file etc) and influence the communication between Rhino and Grasshopper? Is each of them an own Exe which are communicating with each other? etc.

Thank you and Best regards

Siegmund

Posts: 1

Participants: 1

Read full topic

Code conversion rhinocommon 4 to rhinocommon 6 c++

$
0
0

@tsiddikee wrote:

@dale
I have just compiled an old code, it does not show any error in the code but showing huge difference about override. 73 errors. Syntax looks still the same. I forgot Rhino sdk c++ as most of the time I am writing c#. But I have few important algorithms from the past must need to be upgraded. They were working versions.
Can I send you the the project file, so you can see what are the differences and send me back with correction ?

class CMCubeDisplay : public CRhinoDisplayConduit
{
CMCubeDisplay();
public:
CMCubeDisplay(ON_PointCloud& grid_cloud, ON_PointCloud& ball_cloud)
: CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX |
CSupportChannels::SC_DRAWFOREGROUND)
, m_grid_cloud(grid_cloud)
, m_ball_cloud(ball_cloud)
{
};

bool   ExecConduit(CRhinoDisplayPipeline&, // pipeline executing this conduit
	UINT,                   // current channel within the pipeline
	bool&                   // channel termination flag
);

public:
ON_PointCloud & m_grid_cloud; // Something else has to keep this up to date.
ON_PointCloud& m_ball_cloud; // This just draws it
};

Posts: 1

Participants: 1

Read full topic

Get sub object ID when selecting a surface of a polysrf Rhino 6 C#

$
0
0

@Riccardo_Di_Lorenzo wrote:

Hi everyone, I’m having an issue with subobject selection in Rhino 6 SR5 (the latest at the time of writing).
I have a (1) valid, closed solid polysurface with 6 surfaces. My plugin allows the user to select all of its surfaces by dragging the mouse, do some processing that generates some user data relative to each single surface individually, which is then visualized after clicking on the specific surface.
My problem is that if I select one or more surface in the first step, I get an ObjRef with a GeometryComponentIndex that is valid (from 0 to 5, since I have 6 surfaces, a BrepFace type), but if I do it after the processing, no matter the (single) surface I select, I get ID -1 and an invalid type as GeometryComponent.
This means I have no way of finding out which of the many surfaces available the user has selected. Please note that the surfaces share the same ObjectId, since they belong to the same polysurface.
Does anyone know if I’m doing something wrong? Does the User data get attached only to the top level object? maybe that’s the reason why I cannot get the “bottom” object?
I’m using the C# API.

Here the code:


Dictionary<ObjRef, Panel> panels = new Dictionary<ObjRef, Panel>();

GetObject go = new GetObject();
go.SetCommandPrompt(“Select surface to visualize.”);
go.AcceptNothing(false);
go.GeometryFilter = ObjectType.Surface | ObjectType.Brep;
go.OneByOnePostSelect = true;
go.BottomObjectPreference = true;
go.SubObjectSelect = true;
go.EnableClearObjectsOnEntry(false);
go.EnableUnselectObjectsOnExit(false);
go.DeselectAllBeforePostSelect = false;
go.ReferenceObjectSelect = false;
go.EnablePreSelect(false, true);
go.AlreadySelectedObjectSelect = true;

        while (go.Get() == GetResult.Object)
        {                    
            ObjRef selObject = go.Object(0);                
            var subObj = selObject.Object().GetSelectedSubObjects();               
            var panel = panels.Where(x => x.Key.ObjectId == selObject.ObjectId &&                  
               x.Key.GeometryComponentIndex.Index == selObject.GeometryComponentIndex.Index).Single();                
            //Here the GeometryComponentIndexes don't match      
            MouldDisplayConduit pdc = new MouldDisplayConduit(doc, mould, panel.Value);
        }                  

Posts: 2

Participants: 1

Read full topic

Struggling with creating meshes from CRhinoBrepObject

$
0
0

@gccdragoonkain wrote:

Two questions.

One, when I run the code below for a simple cube polysurface, why do I get 6 meshes returned in the resultant meshes array???

Two, how do I set ON_MeshParameters to mirror the rhino “fewest polygons” slider settings when converting a polysurface to a mesh.

  else if(const auto brepObj = CRhinoBrepObject::Cast(rhObj))
  {
    auto brep = brepObj->Brep();

    ON_MeshParameters mp = ON_MeshParameters::DefaultMesh;
    ON_SimpleArray<ON_Mesh *> createdMeshes;
    ON_SimpleArray<const ON_Mesh *> meshes;

    mp.SetCustomSettings(true);
    mp.SetCustomSettingsEnabled(true);
    mp.SetFaceType(2);

    brep->CreateMesh(mp, createdMeshes);
    if(createdMeshes.SizeOfArray() >= 1)
    {
      meshes.Append(createdMeshes[0]);
    }

    result = runAlgorithm(meshes, false, context) ? CRhinoCommand::success : CRhinoCommand::failure;
    createdMeshes.Destroy();
  }

Posts: 5

Participants: 2

Read full topic

Can C++ install an event handler for CRhinoMeshObject on object changed?

$
0
0

@gccdragoonkain wrote:

This is a long shot, but I’d like to be able to land in a callback whenever the user manipulates a previously selected CRhinoBrepObject (i.e. by pulling one of its points, faces, edges, etc)?

Is that possible?

Posts: 2

Participants: 1

Read full topic

How to compile RH6 c++ dll

$
0
0

@tsiddikee wrote:

The c++ plugin compiled perfectly but it is also giving .rhp
How to get .dll ?

and can I use c++ plugin dll as reference to my c# dotnet plugin?

How can I get .dll compiled. Is it a different process?

Do I need to write a CLI in c++ to use it in c#?
I do not work in c++, so please do not mind if I ask any meaningless question.
Thanks in advance for the help.

Posts: 4

Participants: 3

Read full topic

Rhino API still reports different materials with different IDs

$
0
0

@Micha wrote:

(@nathanletwory)

Hi,

since a long time I have the problem that Enscape doesn’t create the right material ID. It seems to be that there is a bug in Rhino. Since the Enscape team don’t get it fixed I want to ask here - could there something done at the Rhino side since “Rhino API still reports different materials with different IDs”?

Attached an example where several different Rhino materials are handled like the same material.

-Micha

No separate Mat ID bug 2.3dm (161.9 KB)

Posts: 4

Participants: 2

Read full topic


Creatin menu in rhino 6

$
0
0

@bartek wrote:

Hi. I want to add Menu to Rhino Menu Bar. Previously I was using RMA.Rhino.MRhinoUtilityPlugIn but now it is deprecated, and it is not working… So I’m trying to use new Rhino.PlugIns.PlugIn. But in new PlugIn ther is no method InsertPlugInMenuToRhinoMenu(). What should I use?

Posts: 1

Participants: 1

Read full topic

Use old RMA code from new RhinoCommon

$
0
0

@bartek wrote:

Hi. I have a working export plugin written in old Rhino_DotNet library. This plugin is not loader by Rhino 6. I have rewritten the MRhinoFileExportPlugIn class using the new one. Is it possible to obtain old RMA.Rhino.MRhinoDoc in Rhino.Plugins.FileExportPlugin to pass to the old code?

Posts: 1

Participants: 1

Read full topic

Object attributes user dictionary keyval pair not saving in Rhino 6?

$
0
0

@Jon wrote:

Hi all,

I have a user dictionary keyval pair attached to a doc object’s attributes. The keyval pair persists through a File->Save operation, and for as long as the Rhino doc is open, but is gone after re-opening the doc. This issue occurs in Rhino 6, but not 5. The doc object is an instance definition, in case that matters.

I can see that doc objects in Rhino 6 now have their own user dictionary (meaning one needn’t go through the attributes)… but I’d like to use the same code base if possible.

Lmk if anyone can reproduce this issue. Thanks!

Jon

Posts: 1

Participants: 1

Read full topic

Simple real-time geometry link example

$
0
0

@mike13 wrote:

Hi, I was wondering - is there any example code for a plugin which listens to changes in the Rhino editor, and allows real time access to tessellated geometry and light positions? I looked at the samples, but could not see anything like this. The eventual use case is to link Rhino to a VR system, enabling real-time visualization of objects created in a Rhino editing session - just looking for a starting point however. C++ preferred.

Posts: 1

Participants: 1

Read full topic

Plugin set an individual object to wireframe

$
0
0

@gccdragoonkain wrote:

Is it possible for a plugin to set a rhino object to be wireframe while other objects remain shaded?

I’m using C++ SDK

Posts: 4

Participants: 3

Read full topic

Viewing all 8532 articles
Browse latest View live