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

Force to ReRead the 3Dm document

$
0
0

@Markus_Erhardt wrote:

Hello,
probably because in two hours it is holiday, I don't find a method to re read a document.
In fact I have a 3dm file contained serialized object. And I would like to be able to read the document 3dm every where in my code.
To be mo precise :
the overriden Read function become

protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options)
{
   list.Clear();
    //read the user data and push it into the singleton instance
    if (list.Read(archive))    {} //where archive is BinaryArchiveReader type
}

The Read() function works if the plugin has been loaded and then the user ask to open some 3dm file.

Now if we take an another order :
1.Read the 3dm document
2.Load the plugin
I need to call the ReadDocument functions to deserialize the objects contained in the 3dm.file. so I need to get the archive.
How to get the BinaryArchiveReader archive ?

Posts: 2

Participants: 2

Read full topic


Python script called as a process (RedirectStandardOutput = true): Progress bar printed on multiple lines

$
0
0

@samuelduchesne wrote:

The Rhino Plugin I'm developing calls up a python script using system.Diagnostics.process(). I'm catching standard outputs and writing them to the rhino command using RhicoApp.WriteLine(event.Data). Everything worked fine until I decided to add a progress bar inside one of the script's iterative loops (it is a good feedback for users). Obviously, since I'm redirecting outputs with WriteLine(), at each iteration, the progress bar's status gets printed on a new line, which is really not ideal!

What would be the best approach to call that script and have it's outputs printed as it would in the console?

Thanks!

P.S.: I'm calling the python script inside a packaged python interpreter that contains libraries needed for the script to work. This is for portability and distribution; I am not using the native python scripting tools of Rhino.

Posts: 3

Participants: 3

Read full topic

Rhinoceros Jewelry

(c++)How to get the current plug-in path

$
0
0

@suc_kiet wrote:

Hi:
I want to load some file in the plug-in path, but I am new in c++, how cant ia get the current plug-in path?

Posts: 5

Participants: 2

Read full topic

Extracting Mesh Geometry From Imported WRL, Texture Mapping Lost

$
0
0

@samlochner wrote:

When I import a WRL file via script, the texture mapping with the corresponding jpg works fine. But if I extract the mesh geometry and then add that mesh back to the doc, only vertex colors remain, no mesh texture. Is there a way to include the texture mapping when I extract the mesh geometry?

Thanks,
Sam

Posts: 4

Participants: 2

Read full topic

VS2017 Extension

$
0
0

@ChristopherBotha wrote:

I edited the extension.vsixmanifest file in the RCPackage Extension to change v14 to v15 and got the installer to install the extension just fine, it did however pop up a warning that it might make VS2017 unstable. Is that just generic or is there some reason I should not be used that extension in VS2017?

(fwiw its working fine for last few days)

Posts: 1

Participants: 1

Read full topic

C#, How to stop Command from executing by checking the conditions in Command.BeginCommand?

$
0
0

@Arif_Hatim wrote:

Hello!

I'm currently having a requirement that require me to check the current condition before executing new Command. So what I'm trying to do now is to have the condition checks in "Command.BeginCommand" event and if it does not meet the condition, do not execute the Command.

However the problem is, in "Command.BeginCommand" does not have any return values to indicate if the command is to be canceled. Are there any other ways to achieve this without needing to implement the checks in every commands class?

Posts: 3

Participants: 2

Read full topic

How to know the installation folder of rhinoceros?

$
0
0

@Ignacio wrote:

Hi!, Is there any registry to know the installation folder of rhinoceros? or how can i know where is rhino installed?. I need execute the rhiexec.exe just for install a rhi plugin, and sometimes the .rhi extension is not associate to the rhino software.
Thanks :slight_smile:

Posts: 4

Participants: 3

Read full topic


Macros and pre-selection

$
0
0

@Diego_Noriega wrote:

I'm having a issue with the commands in my custom plugin when trying to use them in a macro: when I run a macro like this:

! _CreateSplashes _Distance 15 _Height 4

it works great if I don't have any pre-selection. If I do have a pre-selection, I get a bunch of "Unknown command" messages for each one of the options I'm trying to set. My understanding is that, because of the pre-selection, my GetObject.Get is returning GetResult.Object right away, without setting the options first. What's the best way around this (if there is any)? I'd like my commands' options to be settable in a macro, just like the native commands are.

Posts: 4

Participants: 2

Read full topic

Select Curve with longest length in a list with c#

$
0
0

@joel_putnam wrote:

Is there a Linq method for selecting a curve with the longest length from a list?
At the moment I am looping and wondering if this is the best method for this.

thanks,

Joel

Posts: 4

Participants: 2

Read full topic

Bug Report: RenderContent_ContentChanged not being called

$
0
0

@pkinnane wrote:

Hi - if you change the case of a character in a material name, RenderContent_ContentChanged is not called. For example, changing "Octane" to "Octane2" fires a RenderContent_ContentChanged event, but changing "Octane" to "octane" does not.

Thanks

Paul

Posts: 1

Participants: 1

Read full topic

Python - changing display mode of all views

$
0
0

@Jack_Perry wrote:

Hi,

I've recently found a snippet of code online here: https://discourse.mcneel.com/t/change-all-detail-view-display-modes/36399

And I've attempted to copy the final version into my code.

I would like to be able to change the following:

To a rendered view:

Here is my (copied) function for doing so:

def SetDetailsToRendered(debug):
modes = rs.ViewDisplayModes()
setmode = rs.ListBox(modes, "Select mode")
# Find the wireframe display mode
display_mode = Rhino.Display.DisplayModeDescription.FindByName(setmode)
if display_mode:
MessageBox.Show("display mode")
DebugPrint(display_mode, debug)
# Get all of the document's page views
page_views = scriptcontext.doc.Views.GetPageViews()
if page_views:
MessageBox.Show("Page views")
# Process each page view
for page_view in page_views:
MessageBox.Show("Page view")
DebugPrint(page_view, debug)
# Get all of the page view's details
details = page_view.GetDetailViews()
if details:
MessageBox.Show("details")
# Process each page view detail
for detail in details:
MessageBox.Show("detail")
DebugPrint(detail, debug)
# If the detail's display mode is not wireframe...
if detail.Viewport.DisplayMode.Id != display_mode.Id:
MessageBox.Show("if id = id")
# ...set it to wireframe.
detail.Viewport.DisplayMode = display_mode
detail.CommitViewportChanges()
# Redraw the page
page_view.Redraw()

def DebugPrint(object, debug):
if object and debug:
print object

I have attempted a few MessageBoxes to see if it's going through all the if statements and loops. I've noticed it doesn't get past the "display mode" message box. So it doesn't go into "if page_views" statement.

I'm trying to understand what a page view exactly is and why I'm not getting one. Any help would be greatly appreciated.

This is implemented using Rhino 6 WIP. I hope it still works the same as 5.

Thanks,

Jack.

Posts: 1

Participants: 1

Read full topic

How to define working plane by object?

$
0
0

@Vaker wrote:

Hi,

How to define working plane by object?
There is a command "CPlaneObject" to do this.
I want to do this by calling function.
How can I do?

Vaker

Posts: 1

Participants: 1

Read full topic

Selection and working on More than thousand objects

$
0
0

@Markus_Erhardt wrote:

Hi All,
I am working on more than 1000 rhino objects. For all of them I need put sometimes the same user Datas, change the color and so on.
Is there a way to not use a simple loop ? Because every time I get the id of every objects, I then have to select the object, this is...... very very slow

Posts: 4

Participants: 2

Read full topic

C#: Create a polyline and copy it to different location

$
0
0

@Theofanis wrote:

Hello.

I am trying to create a polyline (line with 2 or more segments) and copy it (translate it) to a different location.

This is what I have so far:

        Point3d p1;
        Point3d p2;

        p1 =new Point3d(0,0,0);
        p2 = new Point3d(0,0,10);
        Line line1 = new Line(p1, p2);

        p1 = p2;
        p2[2] *= 2;
        Line line2 = new Line(p1, p2);

        List<Line> polyline1 = new List<Line>(5);
        polyline1.Add(line1);
        polyline1.Add(line2);

        for (int i = 0; i < polyline1.Count; i++)
        {
            doc.Objects.AddLine(polyline1[i]);
        }

So far so good. The lines are drawn in Rhino. Now I would like to take polyline1 and copy it to a different location, for example at x=20, x=30, etc.

Thank you very much :slight_smile:

Posts: 1

Participants: 1

Read full topic


Convert OpenNURBS OnMesh to rhinocommon mesh object

$
0
0

@sghosh wrote:

Hello,

I am trying to convert a rhino.NET mesh object to rhinocommon mesh object and I always get the value to be undefined. Could any one suggest how I should go about it?
Rhino::Geometry::Mesh^ ConvertToCommonMesh(RMA::OpenNURBS::OnMesh^ mesh)
{
Rhino::Geometry::Mesh^ meshCommon = Rhino::Runtime::Interop::FromOnMesh(mesh);
return meshCommon;
}

Posts: 2

Participants: 2

Read full topic

Unroller class a reference

$
0
0

@Petras_Vestartas wrote:

Hi,

Is there any reference (paper) regarding the method that unroller class use? I just want to know where it was originated from.

Thanks,
Petras

Posts: 2

Participants: 2

Read full topic

LayerTable max depth

Moving mesh vertices without creating gaps in mesh

$
0
0

@samlochner wrote:

I'm moving mesh vertices to create a slightly distorted mesh (I'm trying to simulate an object scanning error distribution). The vertices move just fine, but the problem is that gaps are left in some areas; the mesh seems to split apart.

I've noticed that the TopologyEdges and TopologyVertices counts change when I move mesh vertices, perhaps this has something to do with it?

Is there a way to move mesh vertices while still maintaining the same connectivity?

Thanks,
Sam

Posts: 5

Participants: 3

Read full topic

Delete Duplicate Curve

$
0
0

@feibih wrote:

I need help with how to exclude duplicate curves, which are exactly one on top of the other. I am programming in C #.
Thanks

Posts: 1

Participants: 1

Read full topic

Viewing all 8550 articles
Browse latest View live