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

CRhinoGet::result GetPoint from thread

$
0
0

@ceruti wrote:

I have the problem that I can’t to use the function
CRhinoGet::result GetPoint
to get the point when it is called from a thread differrent main thread.
The function started, but clicking left or right button mouse nothing happens.
Can you help me?
Thanks

Posts: 2

Participants: 2

Read full topic


Curve.Simplify not taking any options besides 0

$
0
0

@shwdehaan wrote:

If I run

curve.Simplify(64, .1, 1)

on any curve, I get this message:

Runtime error (TypeErrorException): Cannot convert numeric value 64 to CurveSimplifyOptions. The value must be zero.

Traceback:
line 16, in script

…but if I use 0 as CurveSimplifyOptions, the curve is not simplified.

Does anyone know why the method doesn’t take any other value than 0?

Posts: 2

Participants: 2

Read full topic

RHI Plugin

$
0
0

@ricardo.eira wrote:

Hello,

I have a problem, I make a plugin, and work well on my pc, but when the same plugin (RHP file) is installed on another pc, I have a problem with some functions that do not work.

On my bin folder I have all this files that is generate by visual studio:

I’ve already checked that all this file should accompany the plugin, otherwise it will not work.

My question is, how can I embed all the files in RHP ? or there is a away to generate a .exe ?

Thanks

Posts: 1

Participants: 1

Read full topic

Howto retrieve plugin specific document data

$
0
0

@dsw wrote:

Hi

i store plugin specific data in a document via the CRhinoPlugIn::WriteDocument event which works fine within the plugin.
Now i have a situation where i want to read the 3dm file without opening it and i use at the moment following code:

	FILE* archive_fp = ON::OpenFile(file3dm, L"rb");
	if (0 == archive_fp)
	ON_BinaryFile archive(ON::archive_mode::read3dm, archive_fp);
	ONX_Model model;
	bool rc = model.Read(archive);
	ON::CloseFile(archive_fp);
	for (int i = 0; i < onxModel.m_object_table.Count(); i++)
	{
		const ONX_Model_Object& model_obj = onxModel.m_object_table[i];

                ...
	}

	onxModel.Destroy();

Is it possible to get the document data which was written with CRhinoPlugIn::WriteDocument also with ONX_Model?

Posts: 1

Participants: 1

Read full topic

Retrieve filename of imported file

$
0
0

@Willem wrote:

Hi,

If a user had opened a none Rhino file (eg a stp file)
The filename is displayed in the window title:
image
How would I retrieve the info on the imported file.
IS that available through RhinoCommon or should I just grab that title somehow ( if so does anybody know how)

Thanks
-Willem

Posts: 3

Participants: 3

Read full topic

Last command

$
0
0

@ricardo.eira wrote:

Hello

I have this simple command on C# button:
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show(“Command Teste”);
}

Why is this command not saved as last command ?? (Repeat command with space or right mouse clic)

Posts: 1

Participants: 1

Read full topic

RhinoCommon C# Plane equation

$
0
0

@savage wrote:

The C# Plane constructor with four double arguments (API link) states it “Constructs a plane from an equation ax+by+cz=d.” However, it appears to actually construct a plane for ax+by+cz+d=0, reversing the sign of d. Is this a mistake in the documentation?

I am attaching a grasshopper script that constructs a plane with a=0, b=0, c=1, d=h, which should give a plane z=h (h is adjustable). Instead, as the elevation (h) is increased, the plane is lowered, consistent with z+h=0.

PlaneEquation.3dm (50.9 KB)
PlaneEquation.gh (2.7 KB)

Posts: 1

Participants: 1

Read full topic

DuplicateEdgeCurves with index

$
0
0

@onrender wrote:

Hi there,

I would like to know how to select certain Brep edges by having their index numbers. I have found the DuplicateEdgeCurves command in Python but it duplicates all edges.

Posts: 1

Participants: 1

Read full topic


DuplicateEdgeCurves Method for Polysurfaces [SOLVED]

$
0
0

@onrender wrote:

Hi,

I tried to use the Brep.DuplicateEdgeCurves Method (Boolean) from Rhino Common but I realized it works for Surfaces only but not for polysurfaces however in Rhino Python the DuplicateEdgeCurves works for polysurfaces as well. Why is the difference?

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

    import Rhino
    import scriptcontext

    def DupBorder():
        filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter
        rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", False, filter)
        if rc != Rhino.Commands.Result.Success: return rc

        rhobj = objref.Object()
        brep = objref.Brep()
        if not rhobj or not brep: return Rhino.Commands.Result.Failure
        rhobj.Select(False)
        curves = brep.DuplicateEdgeCurves(True)
        tol = scriptcontext.doc.ModelAbsoluteTolerance * 2.1
        curves = Rhino.Geometry.Curve.JoinCurves(curves, tol)
        for curve in curves:
            id = scriptcontext.doc.Objects.AddCurve(curve)
            scriptcontext.doc.Objects.Select(id)
        scriptcontext.doc.Views.Redraw()
        return Rhino.Commands.Result.Success

    if __name__=="__main__":
        DupBorder()

Posts: 2

Participants: 1

Read full topic

Unexpected results for GetModelToEarthTransform

$
0
0

@dave_stasiuk wrote:

I am getting unexpected results from EarthAnchorPoint.GetModelToEarthTransform. Regardless of the unit system being passed into the method, it is consistently returning {R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)} I am working in Version 6 SR11 (6.11.18348.17061).

What’s odd is that this has worked without any trouble previously. Any ideas as to what may be happening?

Posts: 2

Participants: 2

Read full topic

Converting the codebase of a plug-in from Rhino.NET to Rhinocommon

$
0
0

@Andrew_Mole wrote:

We have a plug-in which we are looking at updating for Rhino 6. It has quite a lot of code that uses Rhino.NET, and I understand that this is no longer supported, but should be replaced by Rhinocommon libraries.

I do not have any experience with this, so any pointers to learning materials would be appreciated. Is there a guide on what mapping / replacement of classes and functions is involved in moving from Rhino.NET to RhinoCommon?

I am trying to understand the difference between Geometry in the Rhino.Geometry library and in the Rhino.DocObjects library. Am I right in assuming that the DocObjects contain the geometry and the GUID and that I should be looking to operate with those? Should the RMA object (such as MRhinoCurveObject) typically be replaced by DocObjects?

The kind of questions I am looking to answer are as follows. What are the replacements for the following (or where should I go to look)?:

  • On3dPoint -> Point3d
  • On3dVector -> Vector3d
  • OnLine -> Line (?)
  • OnLineCurve -> ?
  • MRhinoCurveObject -> Rhino.DocObjects.CurveObject or Rhino.Geometry.Curve ?
  • OnObject -> Object(?)
  • RhUtil -> ? (is there a comparison anywhere)
  • RMA.Rhino-> ?
  • RMA.OpenNURBS -> ?

I need to replace the following code (in VB.NET):
a_function(…, ByRef line As OnLine, …)
if line IsNot Nothing …

Can I replace this with:
a_function(…, ByRef line As Line, …)
if line.IsValid …

Posts: 1

Participants: 1

Read full topic

Exporting Block instances as meshes

$
0
0

@saroj.k wrote:

Hello,

I am writing a rhino plugin to export the rhino file to my viewer, I am able to get the meshes which are polysurfaces in rhino but block instances are missing. How Can I export block instances as meshes.

I am trying to convert block instance objects to meshes, but I am not able to get the meshes.

Here is my code.

// Set up objects and object iterator
	ON_SimpleArray<const CRhinoObject*> allObjects(256);
ON_ClassArray<CRhinoInstanceObjectPiece> piece_list;
  CRhinoObjectIterator it(rhinoDocument, CRhinoObjectIterator::undeleted_and_idef_objects, CRhinoObjectIterator::active_and_reference_objects);
	it.EnableVisibleFilter();
	const CRhinoObject* currentObj = 0;
	for (currentObj = it.First(); currentObj; currentObj = it.Next())
	{
		
		if (currentObj->ObjectType() == CRhinoObject::instance_reference)
		{
			const CRhinoInstanceObject* iref = CRhinoInstanceObject::Cast(currentObj);
			if (0 != iref && iref->IsMeshable(ON::any_mesh))
			{								
				iref->Explode(piece_list, true);
			}			
		}

for (size_t i = 0; i < piece_list.Count(); i++)
	{
		allObjects.Append(piece_list.At(i)->m_object);
	}

// Store the meshes in a custom array
	ON_ClassArray<CRhinoObjectMesh> meshes(allObjects.Count());

	// Get all the mesh objects into meshes array
	CRhinoCommand::result res = RhinoMeshObjects(allObjects, mesh_parameters, mesh_ui_style, meshes);

There is no meshes in the array.

Need help.

Posts: 1

Participants: 1

Read full topic

ON_BrepEdge::Evaluate

$
0
0

@XNurbs wrote:

We use the following code to evaluate an edge:
const ON_BrepEdge * prnEdge = …;
ON_Interval rnCurveInterval = prnEdge->Domain();
const ON_Curve* prnCurve = ON_Curve::Cast(prnEdge)

// for a dT within rnCurveInterval

double rgdPosition[6];
prnCurve->Evaluate(dT, 1, 3, rgdPosition);

There is a bug with the code as the edge domain may not be the same as the curve domain. Could Rhino make some correction to the code?

Posts: 1

Participants: 1

Read full topic

Dock CRhinoTabbedDockBarDialog

$
0
0

@XNurbs wrote:

For the CSampleObjectManagerDialog from the developer samples repository on GitHub, we would like to directly dock the dialog when creating it.
Untitled
I guess this could be done by changing the following code:

CRhinoTabbedDockBarDialog::OpenDockbarTab(context.m_doc, tabId);

Could Rhino show us the code for docking?

Posts: 1

Participants: 1

Read full topic

Create TCone in c++

$
0
0

@wayne387315 wrote:

How can I create tcone by using c++.image
I have already try ON_BrepCone() and ON_BrepCylinder().
However, they can not make it.
Is there any function or idea that I can use to create tcone?

Posts: 1

Participants: 1

Read full topic


Rhino/Python Commands

$
0
0

@awm wrote:

Hi,

I am new to Rhino and Python, and was hoping to understand the limits of how I can change geometry in Rhino using Python. While I was searching for what commands are available I found the following Doc.

https://developer.rhino3d.com/api/RhinoScriptSyntax/

Are the commands listed in this doc the extent of what can be done using Python? I noticed that there are some commands in Rhino which are not on this list, one example is the “Twist” command.

Another question I have is there a way to mimic the command line in the python scripts I plan on developing, so that I can have access to all Rhino commands?

Thank you in advance for your help.

-Alec Maxwell

Posts: 4

Participants: 3

Read full topic

Use subprocess to convert txt in another programm?

$
0
0

@flokart wrote:

Hi all,

i write a g code generator and need to convert .txt to .pgm
There is a converter called Winxiso and i try to automate this process of.

  1. open converter
  2. paste .txt filpath
  3. click compile
  4. close converter

The first two steps working already with subprocess.

import subprocess
path_programm = "C:\\Program Files (x86)\winxiso\\Winxiso.exe"
path_file = "C:\\Users\\Florian\\Desktop\\G_code\\New Text Document.txt"

subprocess.call([path_programm,path_file])

But i dont know to click a button (is this a dll file which is executed with a bool(Button)?) from python.

Any help is welcome

Posts: 2

Participants: 2

Read full topic

Execute C# Code directly in Rhino

$
0
0

@jessen.ch wrote:

Hello,

I am wondering if there is a way to compile and run C# code directly in Rhino.

I know that there’s a C# editor in Grasshopper to do this. But there’s no such an editor or plugin for Rhino.

I can afford to have my own Rhino plugin to do this work. I’ve looked into CSharpCompiler Class in .NET but don’t have a clear idea yet.

I am wondering if there is a RhinoCommon api for this, the similar like PythonScript Class but for C#?

Or there is another way to directly use .NET api to do it?

Any suggestions would be much appreciated.

Thanks ahead!

Posts: 3

Participants: 3

Read full topic

Surface.IsPlanar tolerance vs. surface type

$
0
0

@spb wrote:

Here is an example where larger tolerances are required for IsPlanar to return True for a RevSurface and a SumSurface than their NurbsSurface equivalents.

NurbsSurface IsPlanar(0.0001): True
NurbsSurface IsPlanar(0.0001): True
RevSurface IsPlanar(0.01): True
SumSurface IsPlanar(1.0): True

IsPlanar_depends_on_srf_type.3dm (53.7 KB)

IsPlanar_depends_on_srf_type.py (619 Bytes)

Rhino 6.11.18348.17061

Thank you,
Steve

Posts: 1

Participants: 1

Read full topic

Create my first C++ plugin for Rhino5

$
0
0

@15951991225 wrote:

Hello everyone ! I installed VS2010, I followed the tutorial creating first C++ plugin for Rhino5. when I start to debug, It has the problem of the following picture. 18ce60f2d86ba7f79f3af0d23e77bc9

and I download the Rhino 5 SDK from the second picture685c326c0c4320e3e9be1a06a40a325

/Joann

Posts: 1

Participants: 1

Read full topic

Viewing all 8516 articles
Browse latest View live