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

Curve.PlanarClosedCurveRelationship returns wrong result

$
0
0

@tahirhanyildizoglu3 wrote:

Hi, i am trying to get relationship between two closed curves. As you can see in drawing, one curve contains the other, but "PlanarClosedCurveRelationship " returns mutualIntersection. Am I missing something? Thanks for help.

                    RegionContainment containment = RegionContainment.AInsideB;
                Curve newCurve = obj.Geometry as Curve;

                Plane plane = new Plane();
                bool planeOp = newCurve.TryGetPlane(out plane);
                if (obj.Id != cutoutObj.Id)
                {
                    containment = Curve.PlanarClosedCurveRelationship(curve, newCurve, plane, 0);
                    switch (containment)
                    {
                        case RegionContainment.AInsideB:
                            allGood = true;
                            break;
                        case RegionContainment.BInsideA:
                            allGood = false;
                            break;
                        case RegionContainment.Disjoint:
                            allGood = false;
                            break;
                        case RegionContainment.MutualIntersection:
                            allGood = false;
                            break;
                    }
                    if (allGood)
                        break;
                }

StructureCurvesOne.3dm (6.6 MB)

Posts: 3

Participants: 3

Read full topic


Clipping plane in display conduit, visualization problem (C++)

$
0
0

@Pablo_Garcia-Amorena wrote:

Hi,

In a display conduit I need to draw a mesh being clipped by a plane (that is also drawn).

It’s important to highlight the intersection between the mesh and the clipping plane, like Rhino command ClippingPlane does. Though, I don’t manage to get this.

Here’s an example of input mesh and clipping plane:

My conduit properly clips the mesh but fails to draw the intersection mesh-clipping plane:

Rhino command ClippingPlane properly emphasizes the intersection curve: how can I get that through the conduit?
Here I attach the sample command I made to have the results above (it also contains the input mesh and plane):

cmdClippingPlaneConduit.cpp (6.1 KB)

Thanks,
Pablo

Posts: 1

Participants: 1

Read full topic

Sort points along curve

$
0
0

@dai_kandeel wrote:

Hello
I am trying to sort a set of points along a set of curves in Grasshopper python but I cant find this function.it works with grasshopper component but I need to find a corresponding python function for it.

Posts: 3

Participants: 3

Read full topic

Task.Run () multithreaded problem

Getting into InstanceDefinitions of currently read file

$
0
0

@D-W wrote:

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Posts: 1

Participants: 1

Read full topic

Rhinocommon.dll couldn't find in Rhino6 Mac

$
0
0

@oguzhankoral wrote:

Hi everyone,

I was working a plugin project on the Windows system, and when I try to clone and open repository in Visual Studio on my Mac system. Expected outcome happened, .dll directories changed.
Screen Shot 2020-02-19 at 10.02.31

When I try to browse and add .dll files, I couldn’t find .dlls in the Rhino6 package as well as Windows version.


How can I add .dll files to my project that created before Windows OS?
What is the mistake of mine?

Thanks
-Oğuzhan

Posts: 1

Participants: 1

Read full topic

SetValue with python

Capture view to file in Pen style mode

$
0
0

@dsw wrote:

Hi

i’m capturing a viewport to an image like in the example here

No i’m trying to set the style of the display to Pen style, but i’m struggling with that. The resulting image is always only a simple wireframe.

Do you have any clue?

Posts: 1

Participants: 1

Read full topic


Is it possible to write a non destructive mesh modifier plugin?

$
0
0

@adel.albloushi wrote:

Hello,
As the title suggests, i want to look into the possibility of developing a non-destructive mesh modifier system that takes as an input a mesh, has a few options and parameters, and allows for the initial mesh to be modified arbitrarily by the user (since it’s a non-destructive modifier).
Most mainstream 3d packages have that - 3ds, c4d and blender come to mind.

Now i want this to be a hobby project, also a good excuse to better myself in c++.

The question i want to ask is simple enough. In principle, is it possible?

Posts: 2

Participants: 2

Read full topic

RhinoCommon

$
0
0

@dzintarswagners wrote:

Good evening everyone,

I’m new here. Please help me.
I have (Error) in C# - The name does not exist in the current context.

for (i = 0; i < 10; i = i + 2)
{
an algorithm of actions at the end of which I get - Brep or Brep
}

How to access a local variable (Brep or Brep) outside of a for loop in c#?

Thanks in advance for your help.
Dzintars

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
int i;
var gc = new GetObject();

        gc.SetCommandPrompt("Select some breps");
        gc.EnablePreSelect(false, true);
        gc.GeometryFilter = ObjectType.Brep;
        gc.GetMultiple(1, 0);

        if (gc.CommandResult() != Result.Success)
            return gc.CommandResult();

        RhinoList <Brep> breps = new RhinoList<Brep>();

        for (i = 0; i < 10; i = i + 2)
            
        {
            Brep brep = gc.Object(i).Brep();
            if (null != brep)
            breps.Add(brep);

            Curve[] DuplicateEdgeCurves = brep.DuplicateEdgeCurves();
     
            Curve DuplicateEdgeCurve0 = DuplicateEdgeCurves[0];
            Curve DuplicateEdgeCurve1 = DuplicateEdgeCurves[1];
            Curve DuplicateEdgeCurve2 = DuplicateEdgeCurves[2];
            doc.Objects.AddCurve(DuplicateEdgeCurve0);
            doc.Objects.AddCurve(DuplicateEdgeCurve1);
            doc.Objects.AddCurve(DuplicateEdgeCurve2);

}

DuplicateEdgeCurve1 (not visible outside the loop).

Thanks in advance for your help.
Dzintars

Posts: 2

Participants: 1

Read full topic

[BUG] Curve.Fit failure

$
0
0

@menno wrote:

fit_curve_fail.3dm (32.5 KB)
When I run the code below on the curve in the document attached, the resulting curve has 1 control point on the origin, resulting in a very bad curve shape locally.

var res = RhinoGet.GetOneObject("Curve to fit", false, ObjectType.Curve, out var cRef);
if (res != Result.Success)
  return res;

Curve toFit = cRef.Curve();
double fitTolerance = 1e-8;
var smoothed = toFit.Fit(3, fitTolerance, 0.0);

doc.Objects.AddCurve(smoothed);

Posts: 5

Participants: 3

Read full topic

Odbc Connection with C#

Registering plugin problem

$
0
0

@cp1 wrote:

Dear all,

I am trying to automatically register a Rhino plug-in under Windows 10 via a registry entry like described here.

On first startup of Rhino6 after installing the plug-in, I get the following error: 'Unable to load …rhp plug-in: no class derived from CRhinoPlugIn in plug-in file. After hitting ‘OK’ Rhino starts normally and the plug-in works correctly. Checking Tools/Options/Plug-ins shows that the plug-in was loaded three times.
When I close and open Rhino again no error message shows up and everything works.

The problem seems to be connected with the automatic loading procedure: When I load the plug-in via drag and drop it works with no error message showing up.

The plug-in was compiled using MSVC 2019 Version 16.4.1, the Rhino version is RH6 SR22 (6.22.20028.13281), the SDK version is 6.22.20028.13281.

Has anyone an idea what might cause the error message?

Best,
Clemens

Posts: 1

Participants: 1

Read full topic

Default Print Colour to By Display, All Objects

$
0
0

@Jonathan_Hutchinson1 wrote:

Output Colour, at the printing stage, By Display is obviously really handy.

What I often need is Print Widths + Display Colours at the same time - this is what changing all the Print:: By Display helps with.

Is there a way to script it? In rhinoscriptsyntax I don’t see a By Display option :frowning: https://developer.rhino3d.com/api/RhinoScriptSyntax/#object-ObjectPrintColorSource Maybe it’s possibe in Rhinocommon?

But I guess for all new objects the default will still be ByLayer printing?


Controlling ByDisplay , by layer, would be cool maybe?

Posts: 1

Participants: 1

Read full topic

Using Brep.CreateBoolean.... operations

$
0
0

@frezap wrote:

Hello everyone,

i got issues using the boolean operations of the Brep class.
Even though I know that two breps do intersect the CreateBooleanSplit method returns an empty array. If I understand correctly this means that the split was successfull, but why do I get no results then?

This is the code i wrote: (all Breps are solid and manifold in this example)

//Extrude shape along line.
Plane linePlane = new Plane(line.From, Vector3d.CrossProduct(line.Direction, plane.ZAxis), plane.ZAxis);
Curve orientedShape = shape.DuplicateCurve();
orientedShape.Transform(Transform.PlaneToPlane(Plane.WorldXY, linePlane));

Brep brep = Brep.CreateFromSweep(line.ToNurbsCurve(), orientedShape, true, tolerance)[0];
brep.Faces.SplitKinkyFaces(); //fix 4-sided surface for boolean.
brep = brep.CapPlanarHoles(tolerance); //sweep doesn't do it!

//Move brep for boolean opperations.
brep.Transform(Transform.Translation(intersectionVector));
brep = brep.DuplicateBrep(); //fix brep transform for boolean.
                
for (int i = 0; i < placedBreps.Count; i++)
{
    Curve[] intersectionCurves;
    Point3d[] intersectionPoints;
    if(Intersection.BrepBrep(brep, placedBreps[i], tolerance, out intersectionCurves, out intersectionPoints))
    {
         Brep[] splitResults = Brep.CreateBooleanSplit(brep, placedBreps[i], tolerance);
         brep = splitResults[0];
         placedBreps[i] = splitResults[1];
    }
}

Hopefully someone knows how to use these methods!
Best regards,
Frezap

Posts: 2

Participants: 2

Read full topic


Reading app.config file c#

$
0
0

@nevin.mathew wrote:

Hello All,

can anybody help me on the below .

I am trying to read config value from the user control on button click .
I can read a xml file instead by getting the rhp path like
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase and read the file .

But I am bit curious to know is there anything else I need to do or it wont work in the Rhino solutions

public partial class DetailsDock : UserControl

private  void  BUttontInfo_Click(object sender, EventArgs e)
    {

var url = ConfigurationManager.AppSettings[“url”];

thanks

Posts: 1

Participants: 1

Read full topic

Bug? RenderTexture - SetProjectionMode

$
0
0

@marton.parlagh wrote:

When I set texture projection mode for my texture:
SetProjectionMode(TextureProjectionMode.MappingChannel, ChangeContexts.Ignore);
SetMappingChannel(1, ChangeContexts.Ignore);

The result looks like if it was set to TextureProjectionMode.EnvironmentMap

And this one results in the correct mappingChannel mode
SetProjectionMode(TextureProjectionMode.View, ChangeContexts.Ignore);

Am I doing something wrong? (Or the enums are maybe mixed?)

Márton

Posts: 1

Participants: 1

Read full topic

OpenGL in Rhino 6.0 C++

$
0
0

@ming73963 wrote:

Hi, All
Does anyone know if it is possible to use OPENGL’s commands in RHINO 6.0 ? E.g. glNewList , glCallList() , glBegin(GL_LINE_STRIP).
I would like to draw graphics on Rhino’s viewport.
If it is usable, is there any C++ example that can be provided to me for reference. Thank you all.

Posts: 1

Participants: 1

Read full topic

Consult! Can rhino be deployed on a network server?

$
0
0

@zhantu wrote:

Consult! Can rhino be deployed on a network server?
Use modeling and other functions through website or web framework or network.
Thank you.

Posts: 3

Participants: 2

Read full topic

RhinoCommon in pythonscript

$
0
0

@charlottewyy wrote:

I wanted to write a ‘‘saved selection’’ function for Rhino 6 from ‘‘named position’’. I tried to get access to the plugin ‘‘Named Position’’, so I used RhinoCommon to inquiry the GUID and then use ‘‘Find’’ to get a plugin object. However, I found the GUID, but I cannot locate the plugin object. I don’t think it’s a correct
output.

Posts: 1

Participants: 1

Read full topic

Viewing all 8668 articles
Browse latest View live