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

Offset curve domains

$
0
0

@onrender wrote:

Hi,

I have a quick question. If I offset a curve is there a chance to swap its domain so, the domain(Min) become somain(Max) and domain(Max) become domain(Min) ?

Posts: 2

Participants: 2

Read full topic


Pass "i" variable by json-rpc to python script

$
0
0

@mohammadsaeed01 wrote:

Hi Guys,

I want to be able to pass a variable like i=1199 by json-rpc to python script in another user.

I have this json-rpc and can activate an the python script in another user:

import requests
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon

headers = {
    'Content-Type': 'application/json',
}

data = '''{
    "jsonrpc":"2.0",
    "method":"Addons.ExecuteAddon",
    "params": {
        "addonid":"script.activatewindowid",
        "params": {
            "i":"1199"
        }
    },
    "id":1
}'''

response = requests.post('http://192.168.1.200:8080/jsonrpc',
    headers=headers,
    data=data,
    auth=('kodi', '1234'))

but I need to pass variable or arguments like i=“1199” to work in python script like this:

import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
 
i = "i"
 
if i == "1199":
    xbmc.executebuiltin('ActivateWindow(9000)')
else:
    xbmc.executebuiltin('ActivateWindow(1199)')

Sorry but I am still beginner in json-rpc and python

Thanks for all

Posts: 1

Participants: 1

Read full topic

Possible bug into Intersection.CurveSurface() method?

$
0
0

@lionpeloux wrote:

I think I might have encountered a bug in the Intersection.CurveSurface Method (Curve, Interval, Surface, Double, Double) method used with the subdomain parameter.

In a specific situation (see attached grasshopper definition), the method returns a valid intersection point between a sphere and a curve. However, the point is not in the specified subdomain and the method should not return any intersection object (I think). Conversely, the method returns a valid intersection point (XYZ coords) but with a wrong curve parameter, which is in fact the lower bound of the specified subdomain.

curve-sphere.gh (11.6 KB)

Posts: 1

Participants: 1

Read full topic

Grips not present in a mesh duplicate

$
0
0

@gennaro wrote:

Hi everybody,

I found a strange behaviour in Rhino 6. I need to pick a grip, duplicate the Owner and then pick the correspondent grip in this duplicate. I attach here an example code:

CRhinoGetObject gv;
	gv.SetCommandPrompt(L"Select mesh vertex to move");
	gv.SetGeometryFilter(CRhinoGetObject::grip_object);
	gv.GetObjects(1, 1);
	if (gv.CommandResult() != success)
		return gv.CommandResult();
	const CRhinoObject* obj = gv.Object(0).Object();
	const CRhinoGripObject * grip = CRhinoGripObject::Cast(obj);

	if (grip) {
		if (grip->Owner()) {
			CRhinoObject * duplicatedGripsObj = grip->Owner()->Duplicate();
			if (duplicatedGripsObj) {
				duplicatedGripsObj->EnableGrips(true);
				ON_3dPoint pt =	duplicatedGripsObj->m_grips->m_grip_list[grip->m_grip_index]->Point().point;
				context.m_doc.AddPointObject(pt);
				context.m_doc.Redraw();
			}
		}
	}

This code works fine on breps and meshes in Rhiino 5 but it crashes on meshes in Rhino 6.
Is there an additional step needed in the new Rhino?
Thanks!

G.

Posts: 2

Participants: 2

Read full topic

FindByCrossingWindowRegion bug

$
0
0

@clement wrote:

Hi @dale,

there seems to be a bug in the FindByCrossingWindowRegion method in V5 and V6. If the region contains a group, objects are found multiple times. To reproduce, please run below code with the file attached:

import Rhino
import scriptcontext

def DoSomething():
    
    p = Rhino.Geometry.Plane.WorldXY
    r = Rhino.Geometry.Rectangle3d(p, 20, 20).ToPolyline()
    v = scriptcontext.doc.Views.ActiveView.ActiveViewport
    f = Rhino.DocObjects.ObjectType.Curve
    
    rc = scriptcontext.doc.Objects.FindByCrossingWindowRegion(v, r, True, f)
    print "Found {} curves".format(rc.Count)
    
DoSomething()

If finds 5 curves, but only 4 are in the file. If the 4 curves are ungrouped, it works OK. Additionally please select the objects (grouped or ungrouped) and then run the code snipped again. It does not find any curve.

FindByCrossingWindowRegion.3dm (45.8 KB)

_
c,

Posts: 1

Participants: 1

Read full topic

Issue with Mesh.Reduce method

$
0
0

@visose wrote:

The Mesh.Reduce method writes lines directly to the console for reporting progress.
It would be better if it doesn’t interact directly with the UI and is thread safe.
It could still have the ability to report progress with IProgress or something similar.

Posts: 1

Participants: 1

Read full topic

Visible curve projection

$
0
0

@D-W wrote:

I was wondering if there is any option to get “visible” projection of curve on brep/mesh both behaves the same way - for my use mesh would be better.

However here’s the thing:

I have 2 mesh boxes which are joined so this is one mesh and i get 2 curves (and curve is projected through - like i would cut it with extrusion):

This is what i would suposed to get from “visible” projection of curve on mesh - visible means that visible from projection plane - besides it should be only one curve since mesh is combined:

Any ideas how to achive this? Curve.ProjectToMesh Method gives the same result as rhino command.

Posts: 1

Participants: 1

Read full topic

OptionInteger


Plugin installation problem

$
0
0

@gerryark wrote:

Ok build the plugin with Zoo licence management, so my plugin has a CRhinoLicenseValidator
class ( dunno if this has to with the issue),

After installing the plugin ( tried both using the rhi installer then my own built install file built with Innosetup )
I get a error message from Rhino that says unable to load the plugin, no other info is available just that message.
I then go into the plugins and install from there and it works fine , clearly it asks for a licence code since its the first load.
So I think the license validation may have something to do with the failure .
m2c

Gerry

Posts: 1

Participants: 1

Read full topic

RhinoCommon/Python : ViewDisplayMode copying problem

$
0
0

@Jarek wrote:

Hi All,

I am trying to work with ViewDisplayMode copies but ran into a problem that I can’t figure out. Sample code below.The goal is to make a copy of given display mode with specific name, [do anything to it] and then delete at the end of the script. Repeat at each run of the script.

The problem is, the code below works only once for each new duplicate with the same name.
Even though the copied mode gets successfully deleted at the end of the script (I can tell from the Options > View > Advanced menu), the next time I run the script no copy is made, and the returned guid is all 0000-0000-0000…

What am I missing here? Should there be any use of Dispose method so the copy can be created each time the code runs ?

import Rhino.Display
import System
import rhinoscriptsyntax as rs

g=rs.ViewDisplayModeId("Shaded")
newguid = Rhino.Display.DisplayModeDescription.CopyDisplayMode(g,"Shaded---COPY")
guid_s = System.Guid.ToString(newguid)
Rhino.Display.DisplayModeDescription.DeleteDiplayMode(newguid)
print guid_s

thanks in advance for any hints

–jarek

Posts: 1

Participants: 1

Read full topic

Highest point of a 2d geometry

$
0
0

@onrender wrote:

Hi,

I try to find out what the highest point is of a 2d geometry that includes polylines and curves.
I would say that it is pretty is for polylines by a simple for loop, however I am not sure about curves.
Is there any method that tell me the highest point of a curve (or spline)? (or I need to check math equations?)

I am now experimenting with the bounding box.

Posts: 2

Participants: 2

Read full topic

Typo in in Rhino.Display.DisplayModeDescription.DeleteDiplayMode

VB vs Python and Event Handlers/Watcher (beginner question)

$
0
0

@onrender wrote:

Hi,

I have a quick question. I have just found a sample project for event handlers and I just realised it is in VB.

I thought, that VB is a scripting language just like Python. Previously it has been concluded that Python is a scripting language that’s why it has not got features to handle events and we need to create plugins if we want to introduce Event handlers/Watchers for curtain action. So, when we use VB are we able to apply events from Rhino common?

I have no knowledge of VB but C# and python.

Posts: 1

Participants: 1

Read full topic

Searching RhinoCommon API

$
0
0

@onrender wrote:

Hi there,

I would like to ask why the search engine (at RhinoCommon API) stops at 100 and omit the rest of the found items. I searched for “events” and search result omitted another 205 results.

Posts: 2

Participants: 2

Read full topic

Is there a method in rhinocommon or RhinoScriptSyntax to sketch a curve

$
0
0

@kyxiang1 wrote:

I was wondering if there is a method in rhinocommon or RhinoScriptSyntax to sketch a curve。Just like the command _sketch on toolbar.

thanks.

Posts: 1

Participants: 1

Read full topic


Create new CRhinoPageView and show it

$
0
0

@dsw wrote:

Hi
i’m using the method doc->CreateRhinoPageView(); to create a new page view. It does generate a new page view, but it is not visible. I have to switch to model and back to page view to get it visible and clickable.

Do you have an example for howto use CreateRhinoPageView() correctly?

Posts: 2

Participants: 2

Read full topic

Rhino.Input.Custom.GetPoint events seem to suspend in some cases

$
0
0

@nathancoatney wrote:

I am using the events in .GetPoint() to draw things during mouse move. Everything is working except when the mouse point gets close to the camera plane in perspective view, the events seem to stop firing. Below is python code that demonstrates what I’m seeing. If you navigate the camera close to the world XY plane, then move the mouse up/down, across the plane, the events seem to stop and the mouse x, y won’t print. Also the crossahairs drawn by .GetPoint() will stick.

I’ve googled around, and tried various parameters but can’t seem to find a fix. Any help appreciated.

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

def handle_mouse_move(object, e):
    try:
        print(e.WindowPoint.X, e.WindowPoint.Y)
    except Exception as exp:
        print(exp)

def demonstrate_get_problem():
    
    getter = Rhino.Input.Custom.GetPoint()
    
    getter.AcceptNothing(True)
    getter.PermitObjectSnap(False)
    getter.PermitOrthoSnap(False)
    getter.PermitConstraintOptions(False)
    
    getter.MouseMove += handle_mouse_move
    # getter.DynamicDraw += handle_dynamic_draw
    # MouseDown += handle_mouse_down
    
    getter.Get(True, False)
    
    
if __name__ == '__main__':
    demonstrate_get_problem()

Posts: 2

Participants: 1

Read full topic

RhinoCommon Import SVG Problem

$
0
0

@yaseen wrote:

Hi All,

Trying to import some svg files using the following code:

string script = "_-Import " + filename + " _Enter";
Rhino.RhinoApp.RunScript(script, true);

The filename looks like this in the debugger:

G:\\...\\assets\\ic_3d_rotation.svg

Running the plugin doesn’t error, the output console in Rhino shows:

Command: _-Import

And nothing gets imported.

Must be something I’m doing wrong due to being new to RhinoCommon API.

Any ideas what could solve this problem?

Many thanks

Posts: 2

Participants: 1

Read full topic

RhinoApp().ActiveDoc()->DrawToDC crash

$
0
0

@gm_user wrote:

Hi all,
differently from Rhinoceros 5 where the code works perfectly, in Rhinoceros 6 the last row (highlighted in boldface) makes the plugin crash. The dib has been correctly created.
Any idea how to fix the problem?

Thanks,
Giovanna

CRhinoView* view = RhinoApp().ActiveView();
if(view)
{
CRhinoObjectIterator it( CRhinoObjectIterator::normal_or_locked_objects, CRhinoObjectIterator::active_and_reference_objects );

			
ON::display_mode dm = view->ActiveViewport().DisplayMode();
view->ActiveViewport().SetDisplayMode(ON::wireframe_display);

ON_Color savedColor;
CRhinoAppAppearanceSettings appearanceSettings = RhinoApp().AppSettings().AppearanceSettings();
savedColor = appearanceSettings.m_viewport_background_color;
				
appearanceSettings.m_viewport_background_color = RGB(255,255,255);
RhinoApp().AppSettings().SetAppearanceSettings(appearanceSettings);		
view->ActiveViewport().SetShowConstructionAxes(false);
view->ActiveViewport().SetShowConstructionGrid(false);	

if(RhinoApp().ActiveDoc())							
**RhinoApp().ActiveDoc()->DrawToDC(it, dib, dib.Width(), dib.Height(), view->ActiveViewport().View(), TRUE, FALSE, FALSE, FALSE);** // crash here
}

Posts: 2

Participants: 2

Read full topic

Turning off layers in detail with Rhinocommon

$
0
0

@carlRTC wrote:

Hi, I am trying to turn off (hide) layers in a detail viewport using Rhinocommon. I though this would be simply a matter of activating the detail view, then setting Layer.IsVisible = False, then Layer.CommitChanges().

This does not seem to be the case. It seems Layer.IsVisible always refers to the layer’s main visibility settings, never its per-view visibility setting.

How does one do the equivalent of HideLayersInDetail using Rhinocommon?

Thank you!

Posts: 1

Participants: 1

Read full topic

Viewing all 8647 articles
Browse latest View live