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

How conduits should be used?

$
0
0

@D-W wrote:

@dale would you mind explaining what is ‘the proper way’ of using conduits? I have doubt because i’m creating something similar to layers and i wonder if each object (layer) should have own conduit override or should i create one instance of conduit override for handling all objects (layers) in array/list?

Posts: 5

Participants: 3

Read full topic


Service Releases not pushing to all users resulting in Rhino SDK/plugin incompatibility

$
0
0

@archinate1 wrote:

Hello,
We have recently experienced an issue with some users getting new Service Releases and others are not. This is creating an incompatibility issue with newly built plugins that happen to be using the newer Rhino 6 and SDK that does not appear to be available to other users.

User/Dev 1 is showing “6.4.18124.12321, 5/4/2018” and is showing “Up to date”
User/Dev 2 is showing “6.4.18130.19341, 5/10/2018” and is showing “Up to date”

The issue is that if User 2 develops a plugin for User 1, User 1 receives a message that they need a newer Rhino SDK.

We could change our dev process to use past NuGet package builds, but I find it odd that some users are not automatically getting SR updates pushed to their machine while others are and both are showing “Up to date”. Is there a reason for this?

-Nate

Posts: 1

Participants: 1

Read full topic

Draw2dRectangle fillcolor not shown

$
0
0

@clement wrote:

Hi @stevebaer,

i cannot get the fill color to work in RH6, it is just shown transparent (no color) when used in a dynamic display conduit during a GetPoint operation:

args.Display.Draw2dRectangle(rec, Color.Gray, 1, Color.White)

In RH5 above shows a rectangle with white fill and gray outline.

_
c.

Posts: 1

Participants: 1

Read full topic

Compound transformation equivivalent in C#

$
0
0

@Petras_Vestartas wrote:

Hi,

If I have several Transformation Matrices:

1)Orientation
2)Rotation
3)And 3 translations

Is there a possibility to merge all those matrices into one?

In grasshopper I used compound component to merge several matrices.

But using rhinocommon I tried to multiply matrices and it does not produce same result, for instance in this example I did not include translation, but still not producing what gh does with compound:

Transform mergedMatrix = Transform.Multiply(Orientation, Rotation);

What is correct way of joining matrices?

Posts: 9

Participants: 5

Read full topic

New behaviors for Dockable panels using WpfElementHost in Rhino 6

$
0
0

@dave_stasiuk wrote:

While upgrading our WPF plug-ins to Rhino 6, we’re seeing a significant change in how the WpfElementHost is working that we thought would be worth documenting. In Rhino 5, the WpfElementHost class constructor seems to be called just once, which is the first time that the dockable panel is opened. In Rhino 6, we notice now that every time a document is changed, if the dockable panel is opened, the WpfElementHost constructor is is called. This occurs before any document-related event is fired (so before NewDocument, BeginOpenDocument, EndOpenDocument).

We also noticed that view models bound to the WpfElementHost don’t appear to be disposed at this point. So we have a RhinoEntry class that manages how our plug-ins interact with selection, object creation/deletion, and document related events. What we’ve found is that instances of this class bound to our view models remain alive and well even after new models are bound to the user control, and their event listening continues. So if our users change documents multiple times, as many of our RhinoEntry classes exist behind the scenes. We’ve adapted for this by relocating this class as a static class in our plug-in, but thought it was worth noting this change in behavior.

Posts: 1

Participants: 1

Read full topic

Unroller curves have no length

$
0
0

@Willem wrote:

Hi,

some Curves returned by the Unroller have 0 length when running Curve.GetLength()
When the curve is Duplicated the duplicate does return a non zero length.
Run the attached python script on the attached rhino file as an example

unrolltest.3dm (42.2 KB)

unrolltest.py (838 Bytes)

image

-Willem

Posts: 1

Participants: 1

Read full topic

Installing RHIs with R6.4

$
0
0

@axa wrote:

Has anything changed with how R6 installs RHIs? Until just recently, when double-clicking an RHI, the Rhino Installer Engine would install the plug-in for R5 and R6.
I’ve just upgraded to R6.4, and this behavious has changed. The RHI is now only installed for R5. I haven’t worked out yet how to actually install an RHI for R6.4
The plug-in in question is done in Python and Script Compiler.

Posts: 2

Participants: 2

Read full topic

Find if mesh face normals are inverted

$
0
0

@Petras_Vestartas wrote:

Hi,

I have helper function that lofts two polylines into closed mesh.

Sometimes mesh face normals are inverted.
(red) color

Is there anyway to find which mesh is with inverted normals in order to flip it?

In one example I saw Dale was using similar thing in RhinoCommon to determine if brep face normals are flipped.
I am wondering if something similar exists for meshes

Posts: 2

Participants: 2

Read full topic


Offset Point on Surface in RhinoCommon

$
0
0

@Dmitriy wrote:

Hi,
As mentioned in the title - I need to offset point on the surface.

The way I can do it now is the following:

  • Offset input curve (Curve.OffsetOnSurface) with certain distance
  • Get a point on the basic curve
  • Find closest point on the offset curve.

But actually I don’t need an offset curve.
Any way to make it faster?

Thanks in advance,
Dmitriy

Posts: 9

Participants: 4

Read full topic

Question about interpCrv(interpolation curve) degree in relation to polynomial interpolation

$
0
0

@AndrewAhn wrote:

rhino uses polynomial interpolation for its InterpCrv.
(http://docs.mcneel.com/rhino/5/help/en-us/commands/changedegree.htm#Degree)

Since polynomial interpolation method makes N-1 degree polynomial function(ex. to interpolate 5 points, highest polynomial degree is 4), where degree cannot be an option to change,

how does interpcrv function has a ‘degree’ input with it?

if I am interpolating N points into a curve, isn’t degree become automatically N-1?

Does ‘degree’ input in interpcrv has different meaning than ‘degree’ as used in polynimial function?

Posts: 1

Participants: 1

Read full topic

How to prepare C-code dll library for calling from Python script with ctypes interface

$
0
0

@Terry_Chappell wrote:

@dale, @Helvetosaur
I have a large mesh with 4.4 million faces. It is a 3D model of a map created from 400 drone images. I have colored the mesh using a Python script but it takes time to generate the vertex colors before I can apply the colors using:

meshVertexColors(mesh, colors)

The results look nice:

but can be painfully slow to iterate in order to bring focus on an area of interest:

If I moved generation of the colors array to C-code I think this could be much faster, perhaps less than a second. I have read about using ctypes for interfacing to C-code from Python. My question is, can I use the method you outlined in “Creating your first C/C++ plugin for Rhino” http://developer.rhino3d.com/guides/cpp/your-first-plugin-windows/ to compile my C-code and create a C-code dll library which I can then call from Python using a ctypes interface?

I am worried about starting along the path of using your guide since it is targeted towards creation of a stand-alone C-code plugin. But this seems like overkill if all I need is the dll which I can reference in Python using:

import ctypes
# Load the shared library into c types.
libc = ctypes.CDLL("./myclib.so")

Any guidance you can provide would be much appreciated as I have not done any C-code work in the Rhino environment (or any other environment for that matter). But I have programmed in many other languages and written 100,000+ lines of code. So I am not too worried about the C-code it self but I am definitely concerned about getting the C-code complied and linked into a dll library which I can call from Python.

I also have many other map types that could benefit from using a fast C-code function so learning how to do this would be of significant benefit. My Drone Maps Python script is now 7300+ lines, works quite well and has a nice GUI:


But it is painfully slow for some operations.

I have already exploited the parallel code I lifted from Grasshopper but this provides no more than 2-4X speed up. I need more like 10-100X speedup which hopefully C-code can provide.

Regards,
Terry.

Posts: 4

Participants: 3

Read full topic

Check if two boundingboxes intersects/collides

$
0
0

@Petras_Vestartas wrote:

Is there a faster way to check if two boundingboxes intersects/collides than converting those bboxes to meshes and using meshmeshfast:
Rhino.Geometry.Intersect.Intersection.MeshMeshFast

I just need true and false output.

Posts: 6

Participants: 3

Read full topic

Bug with DisplayConduit

$
0
0

@Matthieu_from_NAVINN wrote:

Hi, I think there is a bug in rhinocommon’s DisplayConduit, more precisely in Protected Overrides Sub PreDrawObject(e As DrawObjectEventArgs).

When I use this:

    Dim pt = New Rhino.Geometry.Point3d(location.X, location.Y - 10, location.Z)
    e.Display.Draw2dText("TextContent", Color.Black, pt, True, True, "Arial")
    e.Display.DrawPoint(pt)

the “dot” is displayed with no text but still sized according to the text. When the associated object is selected the text appear, and disappear when unselected.

When I use this:

Dim MyTextDot As New Rhino.Geometry.TextDot("TextContent", New Rhino.Geometry.Point3d(location.X, location.Y + 10, location.Z))
            MyTextDot.FontHeight = FontHeight
            e.Display.DrawDot(MyTextDot, DisplayColor, Color.Black, BorderColor)

the text never shows.

I tried using the same code in other subs such as Protected Overrides Sub PostDrawObjects(e As DrawEventArgs) and it works.

Posts: 6

Participants: 2

Read full topic

Create new C++ Plug-in project in Visual Studio 2017

How to add rectangle with 2 corner point

$
0
0

@vagrant.mouse wrote:

Dear all,
I have 2 points in 3D but the Z axis are 0, I would like to draw a 2D rectangle with this 2 points of diagonal, how to use 2 diagonal to draw rectangle with python code?
thx

Posts: 1

Participants: 1

Read full topic


Write obj without prompting

$
0
0

@victor.munyoz wrote:

When I call the function DocumentParser.writeObj the prompt asks the user to “select meshing options”. How can I save an obj file without asking the user to enter this value?

Posts: 1

Participants: 1

Read full topic

Startup commands in scheme?

$
0
0

@AndrewZ wrote:

Good afternoon,

Just wondering if something changed recently with startup commands in the registry? I have a startup_commands registry string in:

HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\6.0\Scheme: MyScheme\Options\GeneralSettings

that does not seem to work anymore on the most recent update (6.5.18149.14421, 5/29/2018). Is there a new method of setting up a startup command for a scheme in Rhino 6? It was working just a few days ago.

Thanks,

Posts: 4

Participants: 3

Read full topic

Detect if an object is deleted or created

$
0
0

@software_comas wrote:

Hi!
Is there a way to detect real object creation and destruction, avoiding the “fake” ones (i.e. happening during object transformation).
Thanks a lot!

Posts: 3

Participants: 2

Read full topic

Mesh IsPointInside bug

brep.MergeCoplanarFaces out of tolerance

$
0
0

@Willem wrote:

Hi,

I’m running into an issue with brep.MergeCoplanarFaces
The attached black polysurface is slightly kinked, but apparently enough to allow for the 2 faces to be regarded coplanar.

However after merging the faces the trimming edges are out of tolerance:
image

If I brep.Repair the merged brep I do get correct trimming edges, however there is a deviation of the initial surface of 0.459 which exceeds the file tolerance.

However , the Command _MergeFace will correctly state :
“Unable to move edges within face tolerance, nothing done”

How do I go about making sure the merger was within tolerance?
Should I check edge deviations myself or am I missing some additional RhinoCommon functionality?
What coplanarity tolerance is used?

Thanks
-Willem

below example file and script

merge_coplanar.3dm (48.2 KB)

import rhinoscriptsyntax as rs
import scriptcontext as sc


obj = rs.GetObject('select brep ro merge coplanars')
if obj:
    brep = rs.coercebrep(obj)
    
    tolerance = sc.doc.ModelAbsoluteTolerance
    
    brep.MergeCoplanarFaces(tolerance)
    id = sc.doc.Objects.AddBrep(brep)
    rs.ObjectColor(id ,  [255,0,0] )
    
    brep.Repair(tolerance)#make sure the edges are correct
    id = sc.doc.Objects.AddBrep(brep)
    rs.ObjectColor(id ,  [20,255,0] )

Posts: 1

Participants: 1

Read full topic

Viewing all 8531 articles
Browse latest View live