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

Interaction C# C++

$
0
0

@Markus_Erhardt wrote:

I am relatavely busy between coding, Learning your SDK's and writing some spec's.
How do you manage the interaction between C++ and C#?
Is it possible to transfert an object from the C# part to the C++ side ?
If yes , how would you manage the transfert from a list (dynamic list) of object from C# side to the C++ side?

Posts: 2

Participants: 2

Read full topic


Transfer C# object to C++ code

$
0
0

@Markus_Erhardt wrote:

Could you give an example how to pass an object like a NurbsCurve from C# to C++.
I underdtand it should somewhere use the NonConstPointer but how?

Posts: 2

Participants: 2

Read full topic

RhinoCommon - rhcommon_c.dll error on Windows 10

$
0
0

@Brian_Lee wrote:

Hello!

Lately I have been working on a project which utilizes some awesomeness of RhinoCommon along side the Revit API. The purpose is to use RhinoCommon as a more efficient solution for some geometry operations where the Revit API becomes too heavy and memory intensive. So far its been great on Windows 8, but I lately have changed workstations and now am setting up with Windows10 and am discovering some issues.

The error I am getting is with rhcommon_c.dll :

Another error log:

System.DllNotFoundException: Unable to load DLL 'rhcommon_c': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) at Microsoft.Scripting.Interpreter.NewInstruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run5[T0,T1,T2,T3,T4,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) at Microsoft.Scripting.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at pyRevitLoader.ScriptExecutor.ExecuteScript(String ...

I am using pyRevit which uses IronPython 2.7:

clr.References
* mscorlib, Version=4.0.0.0
* System, Version=4.0.0.0
* IronPython.SQLite, Version=2.7.0.40
* IronPython.Wpf, Version=2.7.0.40
* RhinoCommon, Version=5.1.30000.17

Example:

import sys
import clr

clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
import Autodesk
from Autodesk.Revit.UI import *
from Autodesk.Revit.DB import *

version = revit.Application.VersionNumber.ToString()
uidoc = revit.ActiveUIDocument
currentView = uidoc.ActiveView

sys.path.append("C:\Program Files\Rhinoceros 5 (64-bit)\System")

clr.AddReference('RhinoCommon')
import Rhino as r
import Rhino.Geometry as rg

testPoint = rg.Point3d(1,1,1) #works
print testPoint

testLine = rg.LineCurve(rg.Point3d(0,0,0), rg.Point3d(1,1,1)) #crashes
print testLine

Any advice on this issue? The fact that some classes work and some don't is odd. Is there something that I'm missing with using RhinoCommon on windows 10? Or am I going in the wrong direction all together?

Any help is much appreciated!

Best,

Brian

Posts: 3

Participants: 2

Read full topic

ToolBars in WPF

$
0
0

@Markus_Erhardt wrote:

Creating a Toolbar needs to generate a Rui File.
1) I didn't find a function in C# to create directly my own toolbars from Code.
2) If that would be possible do you think we could use WPF?

Perhaps the best way is to use the docking panels

Posts: 3

Participants: 3

Read full topic

IronPython installation + Rhino 5 / Rhino WIP

$
0
0

@piac wrote:

Over the last few months, we received several report about issues with independent IronPython installations (IIPI) and Rhino. IIPI are only installations of IronPython made via MSI files, and they appear in the Control Panel like this:

It is possible to install IronPython via folder decompression, and that has no impact on Rhino.

I installed both IronPython 2.7.5 and IronPython 2.7.7 final from the IronPython website and checked for compatibility with running the _EditPythonScript editor, and importing the os module.

Here are the results:

                              |   IronPython 2.7.5    |     IronPython 2.7.7

Rhinoceros 5 SR12 or SR13     |          OK           |   OK only with no GAC*
Rhinoceros WIP (31 Jan 2017)  |          OK           |           OK


*This is what the GAC options looks like, during installation:

If you need version 2.7.7, and need Rhinoceros 5 SR12 and 13 to run Python on the same system, you have a few options:

  • reinstall with disabled GAC installation.
  • uninstall IronPython.
  • switch to IronPython version 2.7.5, both with or without GAC.

Posts: 2

Participants: 2

Read full topic

Atom rhino-python deprecation errors?

Exploding text in rhinocommon

$
0
0

@Mahdiyar_Esmail_Beig wrote:

Hello everyone,
I want to translate this pythonscript code into rhinocommon:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino as r

sc.doc = r.RhinoDoc.ActiveDoc

Plane = sc.doc.Views.ActiveView.ActiveViewport.ConstructionPlane()
height = 2
font = "Arial"
text = "Sample Text"
preText = rs.AddText(text, Plane, height, font, False, False)
textGeo = rs.ExplodeText(preText, True)

Here are the code that I wrote in C#:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
    string text = "Smample Text";
    Rhino.Geometry.Plane plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane();
    double height = 10;
    string font = "Arial";
    doc.Objects.AddText(text, plane, height, font, false, false);

    return Result.Success;
}

But I can't figure out how to explode the text object.

Posts: 3

Participants: 2

Read full topic

Inserting a block in a different view

$
0
0

@AlanGreyjoy wrote:

From model space, I am inserting a block like so.

thisDoc.Views.ActiveView = pageView(0)
partViewBOMBlock = rs.InsertBlock("PartViewTriplePlyBOM", pvPCoor)
rs.SelectObject(partViewBOMBlock)
rs.Command("_Explode")
rs.UnselectAllObjects()

But, I don't want to switch from model space, to the view, and back again.

Is there any way to insert a block into a view without switching to it?

Posts: 6

Participants: 2

Read full topic


PlanarSrf using Rhinocommon

$
0
0

@eebs99 wrote:

I'm trying to do the equivalent of PlanarSrf using RhinoCommon, and I've come across an issue.

So far I'm using Brep.CreatePatch() to do it, and it works - EXCEPT if the closed curve in question self intersects (like an inward loop).

The Patch result looks fine in Wireframe, but when I go to any other view I get a weird polygon of some sort that doesn't fit the border I see in the Wireframe view.

If I extract the border from this failed Patch, and use PlanarSrf, the desired result appears.

How can I duplicate that result using Rhinocommon?

Posts: 2

Participants: 2

Read full topic

TextEntity, Get rotation of the text

$
0
0

@mprades wrote:

Hello,
I wonder if it is possible to get the actual text rotation form textEntity.

Thanks in advance.

Posts: 3

Participants: 2

Read full topic

Override Object Selection Color

Select points like in the command PointCloud

$
0
0

@dsw wrote:

Hi

we are trying to select points using CRhinoGetObject::GetObjects with a geometry filter for CRhinoGetObject::point_object. But with this code we cannot select "curve points" (which are shown with the command PointsOn)
How can we achieve a point selection like in the command PointCloud?

Posts: 3

Participants: 2

Read full topic

Select more objects to an existing list - Rhino Common

$
0
0

@cristina.b wrote:

Hi,
We have a list of objects which we highlight(select in code).
We need to be able to let the user pick new objects without unselecting these objects.
The user should be able to select/unselect every object (both old and newly selected).
The selection process should end when the user presses 'Enter' or in a similar manner.
Do you have any suggestions how to accomplish this?

Thank you!

Posts: 3

Participants: 2

Read full topic

How can i specify the expiration date in C++

$
0
0

@ama7da_ndunacht wrote:

Hello,
the expiration date is defined like that RhinoSdkPlugin.h :
tm m_date_to_expire;
but i dont understand how can i specify that for example my expiration date is 15 February 2017
Thanks

Posts: 2

Participants: 2

Read full topic

Determining the scale of objects to be drawn to the viewport by a DisplayConduit

$
0
0

@Taavi_Looke wrote:

Hi!

What is the correct way to determine the scale (or size on screen) of object that are to be drawn onto the viewport by a DisplayConduit in Rhinocommon? I have rather large geometry that has to be drawn and it's too slow to draw the whole thing if it is scaled very small, hence I want to draw a simplified version.

Thanks
Taavi

Posts: 1

Participants: 1

Read full topic


COM application with RhinoCommon and Python

$
0
0

@djordje wrote:

Hi,
I've been looking at some pages of the new rhinopython developer pages (nice work by the way!!). One of them attracted my attention.
It's the developer tools diagram from Python Primer:

To be honest I never understood it, even back then when I read the Python Primer.

My question is: is it possible that with regards to Python programming language, COM application can only be accessed with rhinosciptsyntax?
Can it be accessed with Python through RhinoCommon as well?

I understand that rhinoscriptsyntax function is only a wrapper around RhinoCommon, but the RhinoScript in that photo makes me confused. Is it related to VBScript back in time when Rhino did not have Rhino Python Editor (Rhino 4)?

Thank you for the clarification.

Posts: 7

Participants: 2

Read full topic

C++ Tracking object change

$
0
0

@dimcic wrote:

Hi,

I was wondering what is the best way to track any type of change the user makes on an object... If I get the CRhinoObject * and cast it to ON_Brep* I want to recast every time the user translates/transforms the object or moves control points... I would really appreciate some help with this..thanks!

Milos

Posts: 2

Participants: 2

Read full topic

Using a pluging based on zoo without access to internet

$
0
0

@ama7da_ndunacht wrote:

Hello,
I'm developing a plugin on c++ that use zoo to check the licence ,once i insert the serial key it's ok zoo plugin dont ask me again for the serial , but once i'm not connected to internet it request a serial key because he is doing the check every time my pluging is load.

my question is there is a way to disable this check every time?

Thanks

Posts: 1

Participants: 1

Read full topic

Rhi not updating rui file

$
0
0

@KeithR wrote:

Can rhino delete the %appdata% plugin folder when re-installing an rhi file. This would allow a clean install and save any problems with rui files not updating.

Currently I am distributing an exe file which manages this - but I would like to start distributing an rhi file compiled from my (rhp + some folders).

TIA

Posts: 4

Participants: 2

Read full topic

Twisted rail in RhinoCommon

$
0
0

@cristina.b wrote:

Hi,
We create the intersection between a 3D surface and a plane, then we do a Rhino.Geometry.SweepOneRail using the intersection curve as the rail. In one particular case, we obtained a twisted rail. Dividing the rail into many small segments, we've noticed that there is a specific point where the twist happens.

Do you have any advice to avoid this to ensure that the rail is always on the correct side of the surface?

Thank you very much!
Cristina

Posts: 4

Participants: 2

Read full topic

Viewing all 8519 articles
Browse latest View live