RhinoScript IsArc

rhinoscript

#1

There is an old unanswered thread:

The Documentation about

IsArc:
Verifies an object is an arc curve object or is a NURBS curve object that looks like an arc.

can somebody post a Nurbs curve that looks like an arc - and IsArc returns true ?
If I _rebuild an arc and set the tolerance - parameter of IsArc (much) higher then the deviation - IsArc still returns false.
If I build a degree 2 curve and set the weight according to an similar Arc - isArc still returns false.

The function behaves like a IsRealArc Function - the behaviour i would need.
But the documentation claims, the Function is a “IsShapelikeArc” - the behaviour that would trouble me, but also would be necessary in other cases.

thanks for clarifying this. - best Tom


(Dale Fugier) #2

Hi Tom,

See the attached.

– Dale

arcs.3dm (25.1 KB)


#3

thanks Dale - so the _what (rhino command line) command will not show any difference, but a c# RhinoCommon Type-Test “if (Geometry) is ArcCurve” or “is NurbsCurve” in RhinoCommone does it. Any approach to distinguish the two types with rhinoscript ?
Both types export in dxf as Arcs. Can i trust on that ? (the Arc-like-nurbs while not become a spline or something else - even with strange settings ??) - i am exporting machine data.

And the pity - your info still does not solve my entire problem - the _convert command does not do anything on the attached curve. the strange thing: as soon as i move the curve it does the job.

Crv_not_convert.3dm (140.2 KB)

_convert
Output=Arcs SimplifyInput=Yes DeleteInput=Yes AngleTolerance=5 Tolerance=0.05 MinLength=1 MaxLength=0 OutputLayer=Input

appreciate your help

thanks - best - Tom


(Dale Fugier) #4

Use the List command to view detailed technical information.

Use Rhino.IsNurbCurve.

Yes


#5

great. thanks for your fast reply…


#6

(Rhinoscript) Rhino.IsNurbsCurve (with s) works fine with Rh 5.
but it is not in the documentation nor in the Autocomplete. Also not in the WIP / Rh 6

And did somebody find a moment to figure out, why the (Rhino, Commandline) _Convert Command is not working for the above Curve attached ? thanks.


(Dale Fugier) #7

Wow there is an oversight, as the function has been there since (probably) Rhino 3.0. I’ll see to fixing the docs for the Rhino WIP.

Yes, this is known - https://mcneel.myjetbrains.com/youtrack/issue/RH-37229

Running Convert with an angle tolerance of 0 will produce a polycurve with a single arc segment.

The SimplyCrv command in the Rhino WIP will also give you a single arc segment.


#8

thanks again for your reply dale -

regarding the curve convert - i think you did not take the curve i posted in the file (Crv_not_convert.3dm (140.2 KB))
and the posted parameters

???


(Pascal Golay) #10

Hi Tom - the curve, apart from the end caps, is already a series of very small arcs - as though it is the output from Convert on a simpler curve. What is the output that you were looking for from this curve?

-Pascal


#11

dear pascal thanks for looking at this. The output i am looking for is Curve that only consists of Lines and Arcs - and a Rhinoscript that is handling that transformation. I use a scripted version auf the “_convert” command.

The curve i posted behaves strange: if i run the _convert command in place the command will do nothing. (_sellast is empty afterwards, or Rhinoscript LastCreatedObjects will find nothing)
if i move or copy the curve to a new location, the _convert command will react as expected. (_sellast / LastCreatedObjects will catch the curve)

see attachted screenshot showing the same curve in different locations with different results of the _convert command.

Therefore my problem is that the scripted version of the command will look like an error. (even if there is non) - i have hundreds of curves and i need a stable workflow.
thanks
best
tom


(Pascal Golay) #12

Hi Tom - it looks to me like the SelLast is getting the moved or copied curve - that is why it seems to react. I think nothing happens as far as Convert goes though, so SelLast drops back to the result of the move operation. As far as I can see the curve as you posted it is already composed of arcs and the two end lines. If you want to use the top-level Rhino command inside a script and know if there was a result inside a script, you can use

rs.LeastCommandResult() (Python) or Rhino.LastCommandResult() (Rhinoscript)

after running the command - if that function returns 0 then the command ran successfully and produced a result. In this case it returns 3, for failure.

Does that help at all?

-Pascal


#13

dear pascal - thanks for your attention.
it is not the move / copy result.
Do the following to reproduce the strange behaviour:

  • copy the initial curve0 to a new location to get curve1
  • draw any geometry to have some update for the _selLast command
  • _convert curve0 with posted parameters (it will look like the top curve in the screenshot - the feedback in the commandline is 0 tangent…)
  • _selLast will not find curve0
  • _convert curve1 with posted parameters ( bottom curve in screenshot - the feedback in the commandline is 753 tangent … ( or similar number)
  • _selLast will find curve1

can you repeat that results ?


(Pascal Golay) #14

Hi Tom Yep, thanks, I see it this time - and Rhino.LastCommandResult() does return zero for curve1. Hm. I also see that if I move curve1 after Convert, it becomes a bad object, in V5 and not in V6. As far as I can see, it all works as expected in V6/WIP.

-Pascal