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

Installing plugins without registry modification

$
0
0

@thibaultschwartz wrote:

Dear all,
After reading the rhi docs again, and any post I could find on the subject, I am still struggling to figure out how to silently install plugins in Rh5 without modifying the registry (limited user access).
Copying the plugin files in &appdata%\McNeel\Rhinoceros\5.0\Plug-ins triggers the plugin to be detected properly (well, at least it is listed in the plugins menu), but it is blocked by Rhino during the loading.

From what I understand, that's because the filename is not listed in the registry. Is there any other way to validate the loading of a plugin?

PS: I cannot use rhi, as I don't want anything in CommonFiles, and my install process has many other steps.
PS2: Code only, no drag and drop.

Posts: 2

Participants: 2

Read full topic


Create a Single View

$
0
0

@Frank_Yang wrote:

As we know that when we launch Rhino. it ususally has 4 views.
How can i have just single View as Perspective by Programming.
I can't find any sample code to do that.
Does Any one can give me a help?

I use RhinoCommon.

Posts: 3

Participants: 2

Read full topic

Simpler way to get Centroid of multiple items

$
0
0

@ChristopherBotha wrote:

Is there a simpler way to find the Centroid of a group of items?

Things that didn't work:

  1. Bounding box all items inclusive, but its not actually the centre of the group, and is quite far off visually in most cases.

  2. Getting volume centroids of all items then adding and dividing to get the average, no good as user objects might be open or planes etc.

  3. BU of the BoundingBoxes of all items then pulling a centroid. if parts are too far apart it fails.

What I have.

Bounding box each item in list and extract centre to a point. Then draw a curve between the points, then extract another point from the bounding box of that curve. Visually in most my tests this seems to "feel" right, but its clunky. Occurs to me I wont be the first guy to walk this road, so any input on optimising this appreciated.

my current code:

 #region Get Centres
            List<Guid> ObjectIDs = new List<Guid>();
            List<ObjRef> ObjList = new List<ObjRef>();
            Point3d[] points = new Point3d[GetObjects.ObjectCount];
            for (int loop = 0; loop < GetObjects.ObjectCount; loop++)
                {
                ObjList.Add(GetObjects.Object(loop));
                ObjectIDs.Add(GetObjects.Object(loop).ObjectId);
                var TempConstructor = ObjList[loop].Brep();
                BoundingBox BBox = TempConstructor.GetBoundingBox(true);
                points[loop] = BBox.Center;
                }
            Polyline poly = new Polyline(points);
            var CentreOfObjects = poly.BoundingBox.Center;

#endregion

Posts: 3

Participants: 2

Read full topic

Test if polysurface is enclosed by other polysurface? BooleanIntersection is empty

$
0
0

@jups23 wrote:

I want to detect cases as in the attached image: finding out programmatically if one given polysurface (green) is contained within another one (grey). When their edges do not overlap the boolean intersection is empty. It should work for arbitrary shapes, not only boxes, so a simple bounding box inclusion test would not suffice. Is there another way to do it with the RhinoCommon C# API?

Posts: 1

Participants: 1

Read full topic

Convert loaded model into an obj memory stream?

$
0
0

@ChristopherBotha wrote:

Hi,

Is there a function to keep a geometry stream in memory without hitting the hard drive when you export as OBJ? (ie.

Presumably the stream exists right before it gets written, is there any way to pull that stream from Rhinocommon?

the other end of my app can accept that stream happily and pass it by shared pointer to my other encrypted viewers over the network.

rhino OBJ in the plugged in viewer.

Posts: 5

Participants: 3

Read full topic

[C++] RhinoSdkBlend::SurfaceBlend gives inaccurate results

$
0
0

@menno wrote:

I'm trying to get a blend between two BRep edges. I'm using the RhinoSdkBlend::SurfaceBlend function and it gives a blend, but the blend is not G2-continuous even though I gave continuity values of 2. Even worse, the edges do not match and the result cannot be joined into a polysurface.

Now, when I use the same input in the BlendSrf command, the result is G2 continuous and is matched correctly to the edges.

How to replicate the same results from C++?

Posts: 4

Participants: 2

Read full topic

Duplicated registry key

$
0
0

@Tristan_Gobin wrote:

Hi everyone,

I am wondering why Rhino seems to automatically duplicate my app registry key. I register as specified there (http://developer.rhino3d.com/guides/rhinocommon/registering-plugins-windows/) but instead of the HKEY_CURRENT_USER I use the HKEY_LOCAL_MACHINE. When I look at the registry, I find two keys, the one I created and another that kind of reference my app but with another Guid. Someone already get this problem?

My key has two values : name and rhp path. The other key has several values that match in terms of info type with other plugin keys.

Thanks
Tristan,

Posts: 3

Participants: 2

Read full topic

Brep.Split() returns split objects in which order?

$
0
0

@jups23 wrote:

What determines the order of the objects returned by Brep.Split()? I have to programmatically find the ones on a particular side of the splitter and have been unsuccessful so far.

Posts: 3

Participants: 3

Read full topic


Unit testing plugin code

$
0
0

@Matas_Ubarevicius wrote:

So today I tried setting up unit test project for our plugin. I immediately got this exception:

System.DllNotFoundException: Unable to load DLL 'rhcommon_c': The specified module could not be found.

I know executable of rhino sort of loads rhcommon_c for runtime, but I really don't understand this limitation. Isn't Rhinocommon open sourced now? For unit tests I really don't want to start up rhino and do weird things with the project. Unit testing needs to be fast and go hand in hand with development. Is rhcommon_c proprietary somehow and thus closed down? Can someone explain what is happening and what could be a solution to this? Thanks.

Posts: 7

Participants: 4

Read full topic

Command Bar Option that Chooses a Folder

$
0
0

@eebs99 wrote:

I want to add an animation feature to my plugin using RhinoCommon, and I was able to implement screenshots in it and save them to a constant directory.

This can be made to be more convenient by allowing the user to choose which directory to save the screenshots in, but I'm not sure how to make a command bar option that allows you to do so and save the desired folder.

How would I accomplish my goal?

Also, if this is possible, is there a way to programmatically convert a list of pictures to a video file, like .avi or .mp4, using C#? That would be helpful as well.

Posts: 2

Participants: 2

Read full topic

Selecting individual surface from a brep or polysurface

$
0
0

@Darryl_Menezes wrote:

Hi all,
Is it possible to select an individual surface from a polysurface or Brep? I am trying to select an individual surface from a polysurface to split using curves. But I cannot select individual surface using ObjectType.Surface, but can select the whole Brep if I use ObjectType.Brep

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{

        var go = new GetObject();

        go.DisablePreSelect();
        go.SetCommandPrompt("Select a surface");
        go.BottomObjectPreference = true;
        go.GeometryFilter = ObjectType.Surface;
        go.Get();
        if (go.CommandResult() != Result.Success)
            return go.CommandResult();

        var surface1_obj = go.Object(0);
        Rhino.Geometry.Surface surface1 = surface1_obj.Surface();

        var brep = surface1.ToBrep();

        if (surface1 == null) return Result.Failure;


        ObjRef[] crvRefs;
        Result res = RhinoGet.GetMultipleObjects("Select splitting curves", false, ObjectType.Curve, out crvRefs);
        if (res != Result.Success)
            return res;
        Curve[] splitCurves = crvRefs.Select(r => r.Curve()).ToArray();


        foreach (BrepFace bf in brep.Faces)
        {
            Brep split = bf.Split(splitCurves, doc.ModelAbsoluteTolerance);
            doc.Objects.AddBrep(split);
        }


             return Result.Success;
         }

Posts: 1

Participants: 1

Read full topic

Nurb to mesh in Python

$
0
0

@Adrien_Lefieux wrote:

Dear All,

I am new in Rhino (Mac) and I try to generate a mesh based on a Surface or Polysurface from a Python script.

I found the function MeshToNurb I was wondering if there is a way to generate a mesh from a nurb as in the menu Mesh->From NURBS objects.

Is it somewhere out there and I miss it, if not is it an incoming feature?

Thank you very much

Posts: 3

Participants: 3

Read full topic

Blend Surface Error

$
0
0

@eebs99 wrote:

I programmatically made some surfaces and want to use BlendSurface OR lofting a pair of surface borders then joining that loft with the two surfaces used, then use BooleanUnion to combine all the polysurfaces together.

In Boolean Union Error.3dm (689.3 KB), regardless of the method I use, using RhinoCommon or not, I get these warped surfaces that have messed up volumes and don't look right.

When I explode the polysurfaces, the whole model looks right, but at that point I can't use BooleanUnion to combine everything together.

How would I solve my problem, both using Rhino and using RhinoCommon?

Posts: 1

Participants: 1

Read full topic

Help on "Command Help" of a Python Command

$
0
0

@Tugrul_Yazar wrote:

Hello,
I'm creating simple geometry commands in Rhino Python and package them as *.rhi files. So far it was easy. Now, what I'm trying to achieve is that when a user installs the plugin and runs the command, Rhino would automatically display the online help document in the Command Help Panel. As far as I study this, it seems that the "CommandContextHelpUrl" property should be overriden but I haven't find any python example on how and where to do that. I would appreciate a simple example for beginners like me.
Thank you.

Posts: 5

Participants: 2

Read full topic

Modeless Dialog & Threading

$
0
0

@Tom_Copple wrote:

Hi,
I'm working in c++ and have a modeless dialog that is responsible for communicating with a thread (ui pulls updates from it - same lifespan as ui). When I close the dialog normally, I can shut the thread down cleanly. If I leave the dialog hanging and close Rhino, my thread doesn't terminate properly. When OnDestoy() fires when closing down Rhino, it looks like it is forcing the thread to terminate and that creates leaks for me. OnDestroy() is also being called before OnUnLoadPLugin - I tried to do some handling in there, and also worked with threading calls in the ui (SwitchToThread(), Sleep(0), WaitForSingleObject), but no joy. I was wondering if there is a way to signal the dialog before it gets OnDestroy() called when Rhino shuts down? I need to be able to switch focus to the other thread so it can terminate cleanly.

Thanks,
Tom

Posts: 5

Participants: 2

Read full topic


Getting Intermediate Trimmed Surfaces

$
0
0

@Darryl_Menezes wrote:

Hi all,
In the below picture there are 3 surfaces. Surface B is derived after trimming surface A. Surface C is derived after further trimming surface B. Thus the Underlying surface for C would be surface A which can be accessed using BrepFace.UnderlyingSurface method. But is there any way to get the surfaces B from C by using any method in Rhinocommon?

Posts: 6

Participants: 4

Read full topic

Adding a string command line option

$
0
0

@samlochner wrote:

I'm writing a command that requires command line options. I'm starting from the sample at the link below. It works for me except for the fact that I need a multiple string options rather than double or integer and I can't seem to figure out how to do those.

Suggestions?
Thanks,

p.s. I was noticing that if I cut and paste the code directly, I get an error on the following line but replacing "is" with "=" solves it:
If get_rc Is Rhino.Input.GetResult.Point Then

Posts: 1

Participants: 1

Read full topic

Code signing Rhino plug-in

$
0
0

@Keith1634 wrote:

Can anyone recommend a company I can register with to code sign my Rhino plug-in. I am classed as an individual and not a company - based in the UK ?

Thanks,
Keith

Posts: 2

Participants: 2

Read full topic

A fast way to approximate a Bezier- or Nurbsspline to an array of points

$
0
0

@TomTom wrote:

Hello,

It’s one of my first posts here at this forum but I’m frequently hanging out at the grasshopper forum.
A while ago I made a plugin, called Advanced Surface Tools for Grasshopper.
My intention is to bring some very basic class-A surface functionality to Grasshopper in order to automate some surfacing tasks, which I frequently have to deal with when working with Icem Surf/Rhino -> high quality surface patterns and the ultimate goal: filleting of repetitive structures.

One of my main problems so far, besides all the hundreds of bugs :), is regarding accurate (<0.002mm) and fast approximation of splines to an array of points (or a curve). I need this for a lot of components.

Let’s see this example to get an impression of the problem:

An application example -> match a surface by projection:

I came up with 2 approaches which do have some pros and cons:

  1. Least square fitting with variable Degree:

Pro:
• quite accurate
• very fast
• constant spacing between cps
Cons:
• not stable for higher degree at some data problems start at degree 6, in this example at degree 11
• it can only approximate Beziers not Nurbs

  1. Recursive Approximation

Pro:
• Supports nurbs
• stable at higher degree
• spacing can be variable, because it tries to fit an existing spline to an reference (pts or curve)
Cons:
• not accurate enough -> problem here is measuring deviation fast enough for each iteration. So I limited measuring at the greville parameter.
• “Slower” in most cases, recursion aborts under a certain tolerance, but because of limited measuring this is not trustworthy. I limited to 2000 iterations. Now 4-12 ms at my maschine is not slow per se, but because this should be an core algorithm I think an recursive approach is last option.

Has somebody dealt with this problem?
Maybe someone has another or similar approach and is willing to share?
Is there may be a more stable least square approach with a nurbs extension?
My knowledge of advanced math is very limited, and I’m proud I made least square work with variable degree. So if
somebody can help improving this, it would be awesome.
Is there maybe a "hidden" rhinocommon method I haven’t found so far?
Any ideas in how to improve accuracy?

I have attached the code:
leastSquareVariableDegree_.gh (12.3 KB)
leastSquare.cs (3.1 KB)

Posts: 3

Participants: 3

Read full topic

CRhinoUiDockBar

$
0
0

@fthomas wrote:

Hi,

I have created a toolbar using a "CRhinoUiDockBar" and a "CRhinoUiDockBarDialog".
Every thing is OK except that we would like to prevent the resizing of this toobar in Rhino.

This toolbar contain several edit box, some check box, it would be too complicated to deal with re-arrange the controls when the toolbar is resized... So we prefer prevent the resize and keep the toolbar horizontal and with a predefined size.

How is it possible to do that ?

CRhinoUiDockBar and CRhinoUiDockBarDialog doesn't seems to have properties related to this subject...

Your advize would be helpfull !

Regards,

Fred

Posts: 2

Participants: 2

Read full topic

Viewing all 8668 articles
Browse latest View live