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

Problem getting Rhino-stubs to work

$
0
0

@ivelin.peychev wrote:

@stevebaer,

How does Rhino-stubs work? In the example you give on your blog article I don’t see you importing rhino_stubs module.

What interpreter is set for the project this script is in? IronPython or CPython2.7?

Posts: 1

Participants: 1

Read full topic


Plugin can't load "Rhino version not specified"

Connect Curves in Rhino common similar to the grasshopper node

$
0
0

@flokart wrote:

In Grasshopper is a node called Connect Curves (Picture) is in rhino common a similar command?
Unbenannt

Any help is welcome.
Thanks in adcanced

Posts: 1

Participants: 1

Read full topic

VisualAnalysisMode Draw-Methods vs UpdateVertexColors

$
0
0

@Tom_ wrote:

Dear Everybode, and mostly @stevebaer
I would love to write a custom CurvatureAnalysis Version.

There is a nice example how to inherit VisualAnalysisMode:

But from the Rhinocommon-Documentation - for me it is not clear what is the Relation between UpdateVertexColors compared to all the virtual Draw… methods like DrawBrepObject or DrawNurbsSurface.

And are the Draw… Methods nested ? therefore will DrawBrepObject call DrawNurbsSurface for every Brep-Face ?

If i want to false-color a brep, the documentation tells me for false color i must override UpdateVertexColor - do i get the curvature-Information from the also passed RhinoObject ?
At the same color the documentation tells that DrawNurbsSurface is a good place to " display object-related meshes" - and i thought all surfaces in the document are Breps

A bit lost where to start.
Thanks for a starting-Point - after understanding the example mentioned above.
best regards
tom

Posts: 1

Participants: 1

Read full topic

Mouse position

$
0
0

@typerhack wrote:

Greetings,
I want to get the position of the mouse inside the rhino viewport as a Point3d without using the getpoint method. Actually, I want to track the mouse all the time. Would you mind to help me find a solution?
Thanks

Posts: 3

Participants: 2

Read full topic

Single stroke

$
0
0

@yeye wrote:

Hi:
Rhino “TextObject” command can create single stroke text, how to use C++ to create single stroke text? Is there a function that can be created?

Posts: 1

Participants: 1

Read full topic

Avoid File Version Prompt

$
0
0

@don.sayler wrote:

Hi All.

I’m creating a PlugIn that automates processing a number of v4 and v5 files. When I call the Rhinoscript to save a V4 file, I’m telling the -Save command to save as V5. But, I still get the Save As Version dialog.

In searching the forums, I found this post


but the reference in GitHub is gone.

Here’s the command I’m using
rhinoCommand = @"-_Save V=5 S=No G=No a=Yes e=Yes _Enter";
rhinoScriptResult = RhinoApp.RunScript(rhinoCommand, true);

rhinoScriptResult returns true.

I also tried V=5.0, but that didn’t help.

I’m using VS2015, RhinoCommon v5.1.30000.17

Thanks.
Don Sayler

Posts: 1

Participants: 1

Read full topic

CurveBoolean equivalent in RhinoCommon

$
0
0

@Petras_Vestartas wrote:

Hi,

Is there an equivalent to CurveBoolean Rhino command in RhinoCommon?

Probably not, but what would be an approach to select bunch of curves and by point that is inside some region create a closed outline? For Polylines I used Clipper library, but not for curves.

Posts: 1

Participants: 1

Read full topic


Export SVG without dialog box

$
0
0

@bobrovnich wrote:

Hello!
I’m trying to write a script for the automatic export to SVG.
After the following combination of commands:

import rhinoscriptsyntax as rs
filename = “test”
rs.Command(“All”)
rs.Command("_-Export " + filename + “.svg _Enter”)

the dialog box appears where you need to specify parameters such as size, view, scale, and so on.
How to make that without the dialog box? But with the following parameters:
Size: custom, 10x10 cm
Output Type: Vector output
Output Color: Print Color
View and Output Scale: Top, Extents

Posts: 2

Participants: 2

Read full topic

One noob question?

How to create a custom filter to limit surface selection to specific solids

$
0
0

@jeremy5 wrote:

When using a custom getObject class to select surfaces I would like to be able to restrict the available choice to the faces of polysurfaces or extrusions that are on a predefined list.

It may be that I can’t see the wood for the trees but I can’t work out how to write a custom geometry filter to achieve that. Can anyone help?

Jeremy

Posts: 1

Participants: 1

Read full topic

Layer UserDictionary cleared when property is changed

$
0
0

@menno wrote:

When I create a layer, set an entry on its user dictionary and change a property (in this case IsVisible) everything is fine. However, if I add the layer, the get it from the layer collection and then change IsVisible, the user dictionary gets cleared.

@dale can you confirm this? I am still on SR10, so it may have been fixed in the mean time.

public Result RunCommand(RhinoDoc doc, RunMode mode)
{
  Layer l = new Layer();
  l.Name = "With User Dictionary Entry";
  //int idx = doc.Layers.Add(l);

  //Layer retrieved = doc.Layers[idx];
  l.UserDictionary.SetEnumValue(mode);
  RhinoApp.WriteLine($"User dictionary has {l.UserDictionary.Count} entries");
  l.IsVisible = false;
  RhinoApp.WriteLine($"User dictionary has {l.UserDictionary.Count} entries");
  l.IsVisible = true;

  int idx = doc.Layers.Add(l);

  Layer retrieved = doc.Layers[idx];
  RhinoApp.WriteLine($"Retrieved user dictionary has {retrieved.UserDictionary.Count} entries");
  retrieved.IsVisible = false;
  // now, in the layer that was obtained from the layers collection, settings IsVisible=false
  // will clear out the user dictionary. This is unexpected behavior.
  RhinoApp.WriteLine($"Retrieved user dictionary has {retrieved.UserDictionary.Count} entries");
  retrieved.IsVisible = true;
  RhinoApp.WriteLine($"Retrieved user dictionary has {retrieved.UserDictionary.Count} entries");


  return Result.Success;

}

Posts: 1

Participants: 1

Read full topic

Give Object a Name with Rhino Common?

$
0
0

@flokart wrote:

Hi all,

I tried to Add a Name to a Object but it is not appearing in the Rhino UI but if i print it the object attribute.name exist.

import Rhino as rh

L = rh.RhinoDoc.ActiveDoc.Objects.FindByLayer('Line')
for i in L:
    print i.Attributes.Name
    i.Attributes.Name = 'Test' 
    print i.Attributes.Name


None
Test

A tip why the name dont appear in the object property panel is welcome

Unbenannt

Posts: 1

Participants: 1

Read full topic

Brep selection wires extraction

$
0
0

@gennaro wrote:

Hi everybody,

When I select a Brep Rhino shows yellow wires corrensponding to edges and mid isocurves of the object. I am doing this to get them :

For edges:

 for (int ed = 0; ed < brep->m_E.Count(); ed++) {
            const ON_Curve* crvedge = brep->Edge(ed)->EdgeCurveOf();

For the iso-curves

for (int bf = 0; bf < brep->m_F.Count(); bf++) {
        ON_Interval udomain = brep->m_F[bf].Domain(0);
        ON_Interval vdomain = brep->m_F[bf].Domain(1);
        ON_SimpleArray<ON_Curve*> iso_curves_u;
        ON_SimpleArray<ON_Curve*> iso_curves_v;
        int numIsoCurvesU = brep->m_F[bf].GetIsoCurves(1, udomain.Mid(), iso_curves_u);
        int numIsoCurvesV = brep->m_F[bf].GetIsoCurves(0, vdomain.Mid(), iso_curves_v);
        for (int uc = 0; uc < numIsoCurvesU; uc++) {...

I would like to speed up the process, especially for the isolines. Are these wires cached anywhere in the Brep object so I can quickly get them?

Thanks,
G.

Posts: 2

Participants: 2

Read full topic

What is the difference between : import rhinoscriptsyntax, Rhino, scriptcontext

$
0
0

@msgatrong wrote:

Hello,
I am a beginner in Ghpython, I have some questions to understand globally the functioning of Ghpython :

  1. I would like to know the difference when we import 3 libraries: rhinoscriptsyntax, Rhino, scriptcontext, for example:

import rhinoscriptsyntax as rs

import Rhino as rh

import scriptcontext as sc

When should we use each library, they do the different things?

  1. Where we can find the help for each method of these libraries, for example:

rh.Geometry.Brep.GetBoundingBox ()

rs.coercebrep (j)

I opened Help for rhinoscriptsyntax F1 (Rhino IronPython) in Grasshopper Python script Editor, I’m looking for GetBoundingBox, coercebrep but it does not exist in the help!

It’s supper if anyone can explain these questions to me. These questions are important for me to understand how Ghpython works.

I thank you very much

Posts: 3

Participants: 3

Read full topic


SurfaceRay, similar to MeshRay

Sweep1 - No Geometry

$
0
0

@mpcarlos87 wrote:

Hi,

Trying to use the SDK to generate a sweep1 if failed (using Sweep1 class and Brep.CreateFromSweep static method) so I tried to execute Sweep1 command but it still fails and doesn’t generate geometry.

I attach the file: sweepError.3dm (27.4 KB)

Regards,

Posts: 1

Participants: 1

Read full topic

Calculating control point directions

$
0
0

@dale wrote:

I’ve received a few questions lately on how to calculate the U, V, and N directions of a NURBS curve control point. Perhaps developers are wanting to mimic the behavior of Rhino’s MoveUVN command.

The following sample function will calculate these directions.

/// <summary>
/// Calculates the u, v, n directions of a NURBS curve control point
/// similar to the method used by the MoveUVN command.
/// </summary>
/// <param name="nurb">The NURBS curve to evaluate.</param>
/// <param name="cvIndex">The index of the control point to evaluate.</param>
/// <param name="uDir">The u direction.</param>
/// <param name="vDir">The v direction.</param>
/// <param name="nDir">The n direction.</param>
/// <returns>true if successful, false otherwise</returns>
static bool GetNurbsCurveControlPointDirections(
  NurbsCurve nurb, 
  int cvIndex, 
  out Vector3d uDir, 
  out Vector3d vDir, 
  out Vector3d nDir
)
{
  uDir = vDir = nDir = Vector3d.Unset;
  var rc = false;
  if (null != nurb && cvIndex >= 0 && cvIndex < nurb.Points.Count)
  {
    var t = nurb.GrevilleParameter(cvIndex);
    if (RhinoMath.IsValidDouble(t))
    {
      if (t < nurb.Domain.Min)
        t += nurb.Domain.Length;

      uDir = nurb.TangentAt(t);

      var kappa = nurb.CurvatureAt(t);
      if (nurb.TryGetPlane(out Plane plane))
      {
        vDir = plane.ZAxis;
        nDir = Vector3d.CrossProduct(uDir, vDir);
        vDir.Unitize();
      }
      else if (kappa.Unitize())
      {
        nDir = kappa;
        vDir = Vector3d.CrossProduct(nDir, uDir);
        nDir.Unitize();
      }
      else
      {
        vDir.PerpendicularTo(uDir);
        vDir.Unitize();
        nDir = Vector3d.CrossProduct(uDir, vDir);
        nDir.Unitize();
      }

      const double tol = 1E-15;

      if (Math.Abs(uDir.X) <= tol)
        uDir.X = 0.0;
      if (Math.Abs(uDir.Y) <= tol)
        uDir.Y = 0.0;
      if (Math.Abs(uDir.Z) <= tol)
        uDir.Z = 0.0;

      if (Math.Abs(vDir.X) <= tol)
        vDir.X = 0.0;
      if (Math.Abs(vDir.Y) <= tol)
        vDir.Y = 0.0;
      if (Math.Abs(vDir.Z) <= tol)
        vDir.Z = 0.0;

      if (Math.Abs(nDir.X) <= tol)
        nDir.X = 0.0;
      if (Math.Abs(nDir.Y) <= tol)
        nDir.Y = 0.0;
      if (Math.Abs(nDir.Z) <= tol)
        nDir.Z = 0.0;

      rc = true;
    }
  }

  return rc;
}

Let me know if you have any questions.

– Dale

Posts: 1

Participants: 1

Read full topic

Update issue // SR 13 // Script broken with event change

$
0
0

@nbarnes wrote:

Hi,

I am using the event “Grasshopper.Instances.DocumentServer.DocumentRemoved +=” inside a c# script component to write a text document when the grasshopper definition is close in order to understand if this particular file is open or closed.

After the latest Service Release 13 of Rhino and release of grasshopper 1.0.0007 the event does not seem to execute any more. Was a feature added that could have altered the behavior?

it’s possible i am using this event incorrectly or there is a better way.

Posts: 5

Participants: 1

Read full topic

Tracing image storage

$
0
0

@lahos wrote:

Hi,

  1. I wonder if it is possible to link to tracing image (RhinoViewport.SetTraceImage) instead of storing it in the rhino file.
    I use many named views with tracing images and the file becomes really large.
    (And I need the option to have each image visible in its own viewport. So, no picture nor background option)

  2. Even if I remove the named views and purge, the file keeps its large size.
    If it is not possible to link file, is there a way to purge tracaing images ?

Regards.

Posts: 2

Participants: 2

Read full topic

Viewing all 8565 articles
Browse latest View live