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

Layer Order


C# API like PointClosestObject

$
0
0

@hyunsoo1.kim wrote:

Hello, I want to find the closest object (textobject, curveobject and so on) from a point.
I found PointClosestObject function but it doesn’t seem to be C# API.
Is there any C# API like it?
If not, could you let me know alternative way to do that?

Thanks in advance. :smiley:

Posts: 2

Participants: 2

Read full topic

Bug Rhino7 Mesh.CreateBooleanIntersection

$
0
0

@Ano wrote:

Hello

I came across what appears to be a bug in Rhino.Geometry.Mesh.CreateBooleanIntersection. I am running the attached Python code on the two meshes in the attached file. One of the meshes has two vertices very close to each other at a distance of about 0.08, this is correct.

MeshBoolean200321.3dm (39.5 KB) MeshBoolean200321.py (791 Bytes)

import rhinoscriptsyntax as rs
import Rhino
selectedA = rs.GetObject(‘mesh a’,32)
selectedB = rs.GetObject(‘mesh b’,32)
for offsetX in [0, 200, -200]:
if offsetX:
meshA = rs.coercemesh(rs.CopyObject(selectedA,[offsetX,0,0]))
meshB = rs.coercemesh(rs.CopyObject(selectedB,[offsetX,0,0]))
else:
meshA = rs.coercemesh(selectedA)
meshB = rs.coercemesh(selectedB)
booleansAB = Rhino.Geometry.Mesh.CreateBooleanIntersection([meshA],[meshB])
booleansBA = Rhino.Geometry.Mesh.CreateBooleanIntersection([meshB],[meshA])
print offsetX, ((‘AB closed’ if booleansAB[0].IsClosed else ‘AB open’)if booleansAB else ‘AB failed’)
print offsetX, ((‘BA closed’ if booleansBA[0].IsClosed else ‘BA open’)if booleansBA else ‘BA failed’)

In Rhino 6, all booleans fail. In Rhino 7 curiously, I get the following result:

0 AB open
0 BA failed
200 AB open
200 BA failed
-200 AB closed
-200 BA closed

The same applies if done manually in Rhino 7: If I copy or move the objects by -200 along the x-axis they boolean fine, otherwise not.

As it might take time to fix the Rhino code, is there any quick fix I can do, such as rebuilding the mesh or similar? Thank you very much!

Posts: 1

Participants: 1

Read full topic

Rhino 7 API

$
0
0

@aitorleceta wrote:

Is it Rhinocommon for WIP available for reference on the web? wanting to dive a little to see what is available related to subds…

thanks

Posts: 4

Participants: 3

Read full topic

Selective DXF export

$
0
0

@software_comas wrote:

Hi guys
I’m going to develop a simple RhinoCommon command to let user to select objects and export them to DXF.
After some searching in this forum, it looks like the only way to do that is to launch a script, as this sample code seems to confirm.
Please let me know if that can be done in a better/smarter way.
I wonder if there’s some way to choose the DXF export scheme used during export operations.
Thanks a lot!

Posts: 1

Participants: 1

Read full topic

Rhino Inside Wall By Curve python duplicates

$
0
0

@igpema wrote:


wenn I generate the a revit wall, the script generates two walls instead of only one. Where is the issue here?
I dont want to use the node Wall.ByCurve cause I want to have a workflow in Python, that gives me a better control of the workflow.
Thanks in advance
Wall From Profile04.gh (17.0 KB)

Posts: 1

Participants: 1

Read full topic

Bug Rhino7 Intersection.MeshMeshFast()

$
0
0

@Ano wrote:

Hello

I came across a bug in Rhino.Geometry.Intersect.Intersection.MeshMeshFast(). I am getting the error message

Message: Value cannot be null.
Parameter name: source

I believe that the Intersection.MeshMeshFast() function first calls the new Intersection.MeshMesh() function to set the Polyline source, and on failure returns null. However, the Intersection.MeshMesh() function can complete successfully and return Polyline intersections as null. This then causes the error in Intersection.MeshMeshFast() without it being able to call UnsafeNativeMethods.ON_Mesh_IntersectMesh(). Should be quick to fix.

Thanks,

Chris

Posts: 1

Participants: 1

Read full topic

CreateBooleanIntersection removes faces


Localized number formats problem/question

$
0
0

@Jarek wrote:

Hi All, working in RhinoScript here, I have some settings saved in ini file as strings, in a US decimals format, let’s say a=“0.89”.
When I want to use it as a number, I do Cdbl(a) to convert.
But when I do the same with a Rhino version that uses comma in decimals, Cdbl returns error.
For example in Polish version of Rhino, running Cdbl(“0.89”) results in error, it has to be "Cdbl(“0,89”).

How to best handle such cases of number conversion that depend on language version?
Is there anything built-in VBScript to handle these cases automatically?
(maybe I should write a function that looks for “.” and replaces it with “,”, and vice-versa?)

thanks,

–jarek

Posts: 3

Participants: 2

Read full topic

Render plugin settings UI?

$
0
0

@darbyjohnston wrote:

Hi, I’m working on my first render plugin and have gotten to the point where I need a bit of UI to control the various settings of the renderer I am integrating. Things like combo boxes, sliders, and check boxes that I would expect to find in the “Rendering” panel when my plugin is set as the current renderer.

I’ve taken a look at the example Marmalade plugin and it looks like it is using MFC UI for the render settings in “MarmaladeRenderSettingsSection.h/.cpp”? Are their any other ways to add UI besides MFC? There is some code for “automatic” UI in the materials and texture parts of the Marmalade plugin, but I haven’t found any examples of using it for render settings.

There is also the enum RhRdkUiFrameworks in RhRdkDefinitions.h that implies WPF or Eto could also be used? Are there any examples of this?

I’m writing my plugin in C++ for Rhino 6.

Thanks, Darby

Posts: 1

Participants: 1

Read full topic

Refresh Eto Form

$
0
0

@em.rudelle wrote:

Hi,

(In C#) How is it possible to manually ask an Eto window/form to refresh ? Here is my goal :
In a personal class, derived from Eto.Forms.Form, when user hits a button, it lunches a long process. In order to give feedback to user, I’d like to update a status label. Here is the code of the raised function :

public void OnCheckButton()
    {
        _cleanLabel.Text = "Processing ..."; // User never see this, because window doesn't refresh
        _nErrorGeometry = _bdIda.CheckGeometry(); // A function that takes a minute to run
        _cleanLabel.Text = "Done.";
    }

The user never sees the label with “Processsing …” written, because the window only refreshes in the end. I’ve noticed that if I prompt an Eto message in between, it will refresh the initial window. So I guess there is a way to do it.

Posts: 1

Participants: 1

Read full topic

MeshOutline failure

$
0
0

@michael.trabella wrote:

I need to process several MeshOutline in Rhinocommon from the Top View to find the outlines of a polysurface (beforehand converted to a Mesh with specific parameters) at different heights.
But it happens very frequently that the Mesh.GetOultines() fails and returns Nothing.

I find a work around by adding the mesh into the document, run the script command _MeshOutlines and get the result.
But then I managed to find an example where even the script _MeshOutlines from the document fails, but succeed if the mesh is translated along XY.

meshoutline_fail.3dm (187.0 KB)

I would like to work exclusively with virtual geometry in RhinoCommon and not using the RhinoDoc and scripts.

Similar problem:

Posts: 2

Participants: 2

Read full topic

Adding custom file type to Rhino Library

Registry path

$
0
0

@MatrixRatrix wrote:

On my plugin Setup I make a “HKEY_LOCAL_MACHINE” function to make the registry key
of my plugin wend the install the setup, the data have to apoint to the plugin’s path, and it actually works.

But I need put in data the environment path like this:

This path work on Win explorer, but when rhino starts no plugin in found and therefore does not install plugin.

what is the correct environment variable?

Posts: 1

Participants: 1

Read full topic

Solve grasshopper geometry problems using ML

$
0
0

@dai_kandeel wrote:

Hello
First, Sorry if I am not asking the question in a proper way!
I am trying to discover some kind of problems/bugs- maybe related to data structure - or geometrical ones that face users in grasshopper and can be solved applying machine learning algorithms.
I know there are some plugins do clustering and so , but I mean which kind of problems can I start thinking of ?
Thanks

Posts: 1

Participants: 1

Read full topic


Rhino C++ Plugin : Materials not showing up after exploding blocks in C++ plugin

$
0
0

@binigya wrote:

Hi,
So I am exporting Rhino models into another format.
I’m obtaining meshes using RhinoMeshObjects. So, whenever I explode some blocks in the model, and export it via my plugin, some of the exploded meshes do not have any material applied on them.
So does exploding a block instance change its material property?
Currently, I am using this code to get the material index (The materials themselves are being exported fine though):

        int GetMaterialIndex(CRhinoDoc& doc, const CRhinoObjectMesh& object_mesh, int default_material_index)
    {
    	char* name = GetNameFromONwStr(object_mesh.m_parent_object->Name());
    	if (name != nullptr)
    	{
    		::RhinoApp().Print("\nGetting the material index for object %s", name);
    	}
    	int material_index = -1;
    	int layer_index = -1;

	switch (object_mesh.m_mesh_attributes.MaterialSource())
	{
	case ON::material_from_object:
		::RhinoApp().Print("\nMaterial is from - OBJECT");
		material_index = object_mesh.m_mesh_attributes.m_material_index;
		break;

	case ON::material_from_layer:
		::RhinoApp().Print("\nMaterial is from - LAYER");
		layer_index = object_mesh.m_mesh_attributes.m_layer_index;
		material_index = doc.m_layer_table[layer_index].m_material_index;
		::RhinoApp().Print("\nMaterial Index is %d", material_index);
		break;

	case ON::material_from_parent:
	{
		::RhinoApp().Print("\nMaterial is from - PARENT");
		const CRhinoInstanceObject* iref_object = object_mesh.m_iref_object;
		if (iref_object)
		{
			switch (iref_object->Attributes().MaterialSource())
			{
			case ON::material_from_object:
				material_index = iref_object->Attributes().m_material_index;
				break;

			case ON::material_from_layer:
				layer_index = iref_object->Attributes().m_layer_index;
				material_index = doc.m_layer_table[layer_index].m_material_index;
				break;
			}
		}
	}
	break;

	default:
		::RhinoApp().Print("\n****NO MATERIAL IS FOUND FOR THIS OBJECT !!!!****");
		break;

	}
	if (material_index == -1)
	{
		return default_material_index;
	}
	else
	{
		return material_index;
	}

}

Posts: 2

Participants: 2

Read full topic

DisplayConduit class and clipping issue

$
0
0

@leusd100 wrote:

I use OpenGL to generate a model and insert it into the Rhino scene, but the scale is very large (see image1 for an example). I want that when loading the model, it automatically aligns to all types of Top, Front, Right and Perspective (see image2). I reviewed many articles on this subject and I came across this article => (https://developer.rhino3d.com/guides/rhinocommon/display-conduits/) and I was interested in the overridden CalculateBoundingBox of the DisplayConduit class. I wanted to align the object’s Bounding box with the Bounding box of the view, but so far nothing has worked)). I overridden the CalculateBoundingBox method, but it does not give anything. Below is the code I made to test this method. Please tell me if anyone has any ideas on this. This is very important to me. Thank you in advance))

RhinoCommandDebugCommand.cs (3.3 KB)

Posts: 1

Participants: 1

Read full topic

2Shapes and Rhino 7.0

CreatePreview - How does it work?

$
0
0

@marton.parlagh wrote:

Hello,

I can not figure out how Render plugin CreatePreview() should work.

Ok, I understand the basic concept, but how can is use it asynchronously?

I use progressive render type
protected override PreviewRenderTypes PreviewRenderType()
{
return PreviewRenderTypes.Progressive;
}

inside CreatePreview I handle only Quality.RefineThirdPass, and I use scene.PreviewNotifier.NotifyIntermediateUpdate(RenderWindow);
to update the preview.

I can do it fine if it is in the same thread as CreatePreview. But if I open a new Thread for preview calculations I can not call NotifyIntermediateUpdate from there because it triggers an exception. I guess after I return from CreatePreview the previewnotifier is not really valid anymore so my parallel calculation can not use it.
But what is the correct process?

Márton

Posts: 5

Participants: 2

Read full topic

Show gumball on selected objects

$
0
0

@Harper wrote:

Hello,

Anyone knows how to show the Rhino gumball after select the objects by code like that:
RhinoDoc.ActiveDoc.Objects.Select(objIdList, true);

Thanks and regards!

Will

Posts: 2

Participants: 2

Read full topic

Viewing all 8573 articles
Browse latest View live