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

C++ deletion of custom grip points (one or many)

$
0
0

@gccdragoonkain wrote:

Our control cage structure actually allows for the deletion of points from the control cage structure. However, in rhino when I select grip(s) and tap delete, nothing happens (which is to be expected)

What is the easiest way to allow rhino to call a method in my CRhinoGripObject or CRhinoObjectGrips subclasses when the user tries to delete a grip?

I tried implementing IsDeletable with no effect.

Posts: 3

Participants: 2

Read full topic


Can't figure out how to select (highlight for the user) objects

RhinoEtoApp.MainWindow in doc

RhinoEtoApp.MainWindow.SizeChanged has no effect!

$
0
0

@kitjmv wrote:

Hello

RhinoEtoApp.MainWindow.SizeChanged has no effect

There is no compilation error but there not captured event handler

image

jmv

Posts: 1

Participants: 1

Read full topic

No call to ApplyLightChanges when layer visibility is changed

C++ Selecting multiple curve, some of them are not valid

$
0
0

@Petras_Vestartas wrote:

Hi,

I would like to ask how to retrieve multiple curves, and append to C++ collection only valid ones.
Essentially my simple question is what Collection type I should use to add valid curves when I do not know the fixed length of collection?

Second question: to retrieve all selected objects I have to write:
go.GetObjects(0, -1); ?

For example here I retrieve curve objects from rhino and if they are valid I would like to add them to a collection.

CRhinoGetObject go;
go.SetCommandPrompt(L"Select Curves");
go.SetGeometryFilter(CRhinoGetObject::curve_object);
go.GetObjects(0, -1);


if (go.CommandResult() != CRhinoCommand::success)
	return go.CommandResult();

//What kind of collection I should declare here <---------
   
for (int i = 0; i < go.ObjectCount(); i++) {

	//Get first object + validate
	const ON_Curve* crv = go.Object(0).Curve();
	if (crv == 0) {
		return CRhinoCommand::failure;
	}
	else {
		//Question---------> add to curve list;
	}
}

Posts: 1

Participants: 1

Read full topic

C# What is a correct way to remove several ngons from mesh that has ngons?

$
0
0

@Petras_Vestartas wrote:

Hi,

I would like to merge several connected ngons into one.

Before doing that, I expected I could remove several existing ngons ones, and then create new ones.

But when I print how many ngons are before and after removal I get the same number.
What would be an approach to my problem?

        Rhino.RhinoApp.WriteLine(mesh.Ngons.Count.ToString()); //Prints 55 

        mesh.Ngons.RemoveAt(1);

        Rhino.RhinoApp.WriteLine(mesh.Ngons.Count.ToString()); //Prints 55

Posts: 1

Participants: 1

Read full topic

How to create parallel projection viewport?

$
0
0

@isuo wrote:

Hello there!

I want to create new layout with Rhino API. Desired detail projection is isometric, but it is not specified in a list of possible arguments for DefinedViewportProjection. What did I miss and how to create isometric view?

Posts: 1

Participants: 1

Read full topic


Custom user dragging of grips within rhino command

$
0
0

@gccdragoonkain wrote:

This one is very tricky. It may not make sense for how rhino works, but it makes sense to me and definitely for the UX of how I want this plugin to function.

I have a multitude of problems with the code the way I have it working below. My questions/issues are below the code listing.

    CRhinoGetPoint gp0;
    gp0.SetCommandPrompt(L"Select Pull Origin");
    gp0.GetPoint();
    ON_3dPoint origin = gp0.Point();

    CRhinoGetPoint gp;
    gp.SetCommandPrompt(L"Select Pull Destination");
    gp.SetBasePoint(origin);
    gp.DrawLineFromPoint(origin, TRUE);
    gp.GetPoint();

    if(gp.CommandResult() != CRhinoCommand::success)
      return gp.CommandResult();

    ON_3dPoint pt = gp.Point();
    ON_3dVector v = origin - pt;
    //if(v.IsTiny())
    //  return CRhinoCommand::nothing;

    //you've got to be kidding me....
    //ON_Xform trans = ON_Xform::TranslationTransformation(v);
    for(int i = 0; i < translationTarget.Count(); i++)
    {
      translationTarget[i]->SetPoint(translationTarget[i]->Point().point+v);
      //context.m_doc.TransformObject(translationTarget[i], trans, true, true, false);
    }

    auto surfacedObj = dynamic_cast<CRhinoSuperDGrips *>(newObj->m_grips)->NewObject(true);
    if(!context.m_doc.ReplaceObject(CRhinoObjRef(newObj), surfacedObj))
    {
      OutputDebugStringA("there was a problem");
    }
    context.m_doc.Redraw();

First, is there a way to not make the user laboriously click two points to get my translation, but instead to simply drag the screen in one swoop?

Second, do I really have to update my rhino grip points one by one? translation via TransformObject didn’t work. This isn’t a big deal but… it’s quite cumbersome.

Third, related to the second issue, when I drag the points on the upper left viewport, the Y & Z directions seem to be swapped, likely due to a difference in coordinate systems between grip point and return values from the GetPoint

Posts: 3

Participants: 2

Read full topic

Surface Thickness Settings

$
0
0

@jeremy.graham86 wrote:

Hi,

Is there any way in Rhino common to access the new Thickness settings found on some objects such as surfaces? As Shown below…

cheers!

Capture

Posts: 1

Participants: 1

Read full topic

Duplicate border

$
0
0

@f.leon.marquez95 wrote:

Hello, I would like to know if there is a way to duplicate the border with a c++ script of a selected surface. I am using the visual studio 2010 and Rhino5

Thank you

Posts: 2

Participants: 2

Read full topic

General Question: Please advice if I can keep coding in Python for what I would like to do

$
0
0

@qtov wrote:

Hello,

If not have time skip to bottom with the list of items 1 2 3. Can I do these in python?

I have picked up Python and have been writing some scripts for Rhino in the last few weeks and I really like how all works in Python.

I would like to ask what more experienced programmers think, if I can stay in Python (and not learn a new language) for the things I want to program.

I want to manipulate meshes.
Selecting vertices, edges, faces, mainly modifying the geometry based on criteria for each of the selections.

As an example, looking at this page (below), I see that under syntax, there is only C# and VB listed.
Is it possible to access these features with Python?

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_Collections_MeshTopologyEdgeList.htm

What I would like to work on is create a set of tools for me, to help me manage very specific terrain and landscape design tasks. And so modify quite low definition meshes in specific ways to suit my design needs.
I am mixing design and art thinking here with my coding skills and I want to write something like an algorithm that will help aid and generate designs based on very specific meshes that I will create most likely in blender or perhaps 3ds max (as I already have good skills there) but from there to work entirely in Rhino.

Few examples of small tasks that I can think of at this initial stage:

  1. I would have data points of coordinates (locations) in 3d space. Take these coordinate datapoints, and to each, add a (spherical ?) bounding area. Then take a mesh and go through each edge. If both vertices of an edge fall within any two of the initial coordinate “spheres” then add these edges to an array that I can use to select them later.
    In short I am going to use one basic mesh to extract the datapoints and later use these points as a selection aid to apply to another mesh.

  2. If I do not have sufficient faces in some areas, can I easily use a selection of edges to split them the way “split a mesh edge” does (the sizzors icon). So basically just dividing each of the selected edges in two.

  3. Can I extract info about two faces of a mesh, lets say how big a face is, how many edges does it have etc, while pointing to these two faces by giving an input of the edge that is dividing them.

Thanks for reading and for eventual input I might receive from this essay : )

Main question is if I can do all in Python.
Secondary would be any advice of where I can begin… the first 1, 2 things that will get me rolling with this.

Thanks

Posts: 2

Participants: 2

Read full topic

Thoughts On Using F# For Dev?

$
0
0

@EricM wrote:

Let me preface this by saying F# and c# are functionally equivalent. I’m interested to know if there are any F# RhinoCommon devs who could weigh in on the pros and cons of using F# the F# way? Like the performance gain through ease of concurrency vs the loss from memory allocations due to the default of immutable variables.

I’m currently trying to parse through some c# I wrote years ago, and I’m reminded of all the purported benefits an F#. The conciseness, functions as parameters, piping, etc. of F# is in line with what I’m doing. I don’t want to build a library of objects. I’m building a library of functions to augment Rhino’s library of objects.

Posts: 3

Participants: 3

Read full topic

Access connected grasshopper canvas components

$
0
0

@nathan.perkins wrote:

I’m trying to integrate an external program I’ve written via calling a new process. I’m using python to call the program from within GH. I’d like to get some quick visual feedback on the state of the output and one way I’d thought of is to change the colour of the connected panel. At some point I saw somewhere that you could access the inputs and outputs of the current component, but I can no longer find the example. So ideally what I’d like to do is change the color of the connected output panel. If there’s no errors, set the shown panel color to green, if there are errors, set it to red. Is this possible, or am I barking up the wron g tree? Any help greatly appreciated.

Posts: 3

Participants: 2

Read full topic

C# RhinoCommon Mesh Topological Indentical Vertices

$
0
0

@Petras_Vestartas wrote:

Hi,

When vertices become topologically identical?
Is it somehow connected with tolerance?
int[] tv0 = mesh.Vertices.GetTopologicalIndenticalVertices(v0);

The reason for asking is that for cylindrical surface mesh subdivision I get 4 identical points, while same surface with some distortion on he right has only two topolgically identical points. (no gaps at surface edge)

And this tolerance issue results only on at the edges of surfaces, when I detect closed surface condition I reset end points to start ones:

Posts: 2

Participants: 2

Read full topic


DrawMeshFalseColors v6 bug

How to update a mesh after making a change to it? (SwapEdge)

$
0
0

@qtov wrote:

Hello,

I am trying to
SwapEdge
of a mesh box that I triangulated.

 #I get the box with:
 Mesh = rs.coercemesh(meshID)
 # The ID of an edge which can be swapped
 EdgeID = 10

 #And then try to pass this:
 Mesh.TopologyEdges.SwapEdge(EdgeID)

But nothing happens, there is no error as well.

Any idea why, am I approaching this correctly?

Posts: 1

Participants: 1

Read full topic

Brep.CreateEdgeSurface(curves)

$
0
0

@jake1 wrote:

Hello All,

I am making Surfaces from a list of edge curves.
I seem to be getting unpredictable UV directions for my surfaces.

I though that the UV would be determined by the order and direction of the list of curves.
Is there some other factor that I am not considering?

Currently, I have my list of curves setup as follows:
Curve[0] ends at the start of Curve[1]
Curve[1] ends at the start of Curve[2]
Curve[2] ends at the start of Curve[3]
Curve[3] ends at the start of Curve[0]

I pass that list to Brep.CreateEdgeSurface(curves).
Sometimes the UV is as expected, sometimes it isn’t…

I am thinking about comparing the resulting UV corner points of my surface to check if they match my Curve Endpoints then flip/transpose as needed to make the correct adjustments to the surface.

Is there a better approach? I haven’t found any details on how the List of Curves makes the Surface.
Any advice or examples would be greatly appreciated!

Kind regards,
Jake

Posts: 2

Participants: 2

Read full topic

BitmapTable.Find doesn't write missing bitmap?

$
0
0

@Max_Eskin wrote:

I’m trying to use BitmapTable via RhinoCommon. Using Rhino 5 Windows SR14. If I add a bitmap to the file, and subsequently delete it from disk, calling document.Bitmaps.Find(filename, true, out path) returns an entry, but does not save the bitmap to disk as the API suggests it should, and path is empty.

However, calling entry.Save on the returned entry does work. What gives? Should I just not rely on Find to save bitmaps or am I doing something wrong?

Posts: 1

Participants: 1

Read full topic

C++ how to add command option WITHOUT pausing for input

$
0
0

@gccdragoonkain wrote:

I have a command that is almost identical in behavior except for one boolean. I really don’t want to fork my entire command code just for that boolean. What I’m trying to do is something like “MyCommand(true)” “MyCommand(false)” so I can add the command to the toolbar for with each mode. Can I do this?

I tried using CRhinoGetOption but its Option() method immediately fails no matter what I add to it.

Posts: 2

Participants: 1

Read full topic

Viewing all 8664 articles
Browse latest View live