Grasshopper

algorithmic modeling for Rhino

Hi to all,

i'm trying to simplify and convert a nurbs curve to a series of arcs in order to be able to measure their radius

i found this function in the SDK "RhUtil::RhinoConvertCurveToPolyline" but the things is that it converts teh curve into series of lines and not arcs

Does any have an idea of how it could be made ?

Svetlin

Views: 13098

Attachments:

Replies to This Discussion

i've probably have found the solution in that page :

http://news2.mcneel.com/scripts/dnewsweb.exe?cmd=article&group=...

hopefully that works
Hi Svetlin,

Uncanny timing as I'm just back on this topic myself. Did you manage to resolve this?

If you're wishing to achieve the same thing using Rhinocommon curves, there is a Simplify method that takes the equivalent arguments. However, I can't get it to generate polycurves of only arcs and lines using the arguments advised in that post.

I'm going to get them to clarify. If you need something in the interim, I'd written my own function to do this prior to becoming aware of the SDK function, and added it as a component in StructDrawRhino (latest version). You need the evaluation license to use it though.



Cheers,

Jon
Attachments:
Hi Jon,

thanks for the reply

i still didn't manage to solve the problem and i'm getting quite confused between the old sdk and the new one.... especially with this function and my poor programming skills

so i tried to stick to the old sdk since there are couple of examples in vb.net

so far i got at this point :

in Rhino there is the convert command is very simple and allows to transform the curve into :
a - lines
b - arcs

in the old SDK there is the RhUtil.RhinoConvertCurveToPolyline - it basically converts the curve into line segments (it was pretty straightforward to script it)

and there is RhUtil.RhinoSimplifyCurve ->
with this function there are two methodes described :

the first one was implemented by David in the SimplifyCurve componnent, however the output is still a nurbs curve and the two parameteres are the angle and distance tolerance

the second as refered to the sdk there is an additionnal "flags" parameter that normally should allow to precise the desired output...

but here comes the problem : when i try to implement the function in grasshopper it doesn't take into account the "flags" parameter

with the rhinocommon sdk i found the

Curve..::..TryGetArc Method (Arc%)

but i didn't understood whenever it converts the curve into one arc or it could break it into several arcs...

i'll try this afternoon to see how the new sdk and the simplify curve could make it as well as the structdrawrhino function

Best
Svetlin
i'm just trying with this one...

Private Sub RunScript(ByVal curve As Curve, ByVal distance As Double, ByVal angle As Double, ByVal options As Object, ByRef A As Object)
'your code goes here…


Dim curve1 As PolyCurve

curve1 = curve.Simplify(Rhino.Geometry.CurveSimplifyOptions.RebuildArcs, distance, angle)

A = curve1

End Sub


but no results.... neither errors...
This is my understanding (Steve, David or Giulio might correct me).

The options seem to be inverse how you would expect, ie RebuildArcs will "not" rebuild or combine adjacent arcs that have radii within tolerance. I'm assuming you know there is a reference for the new sdk here: http://www.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Curve_Si...

No results means no simplification was determined. I've posted to the rhino plugins newsgroup if you want to follow there. I want to use this too, and can let you know how to call it using the SDK when I find out.

Cheers,

Jon
i assume it should function in a similar way as the old sdk
but let's see what will be the answers... i'll be following the newsgroup post as well

it's a very helpful function especially when it comes to structural / production geometry approach

Best
Svetlin

Jon,

 

What sort of routine did you use for your custom component?  

 

Did you ever get the SDK figured out?

 

-taz

Hi Taz,

 

I was told there is no access to this in v4 sdk (I haven't checked v5).  I don't achieve tangency in my adjacent arcs (although could extend it to do so), it's a recursive method, fits an arc to start, end and mid point and checks for deviation and splits the curve if it has to.

 

Cheers,

 

Jon

Thanks!

 

Just curious.

 

I figured it would be recursive. 

I have had to convert splines into lines and arcs to make the geometry work with an old CNC router. This is what I came up with.

Attachments:

and now with the gh file...

Attachments:

Hello Jason this is brilliant, thanks for sharing !!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service