Circle candidates that don't simplify

Well, this thread ended up being about two things - the difference in behavior of rhinoscriptsyntax in vb and python, as well as what looks like a bug in SimplifyCrv:

So I was just throwing those circle candidates up there to test for SimplifyCrv…

–Mitch

Would the other circle methods need updating too? For example, I’m finding that CircleRadius and CircleCenterPoint are also not behaving the way they did in Rhinoscript, if creating what appears to be a circle by joining two arcs (which represent a hole imported from SolidWorks).

I will attach a test detail that illustrates this issue. Duplicate the two edges of any hole, join the two curves, and see what you can’t do with the “circle”.

Hopefully this will be helpful,

Dan

circle issue.3dm (199.5 KB)

Here is another one that I can’t figure out why it won’t simplify. The red curve in the attached is a degree 2 NURBS curve that is as close as I can see to a real circle, it has a CrvDev of 3.37174e-07 from a “true” circle. Will not simplify into a circle, either via Rhino commands or scripted methods. Also tested in V6 WIP, same problem.

–Mitch
NoSimplify2.3dm (26.9 KB)

Hi Mitch, I think near circles and arcs never, or almost never, get simplified correctly…

https://mcneel.myjetbrains.com/youtrack/issue/RH-27259

-Pascal

Never say never !!!

Seems to me this is pretty important to get working, transferring non-circles to a CAM program that expects them for feature recognition is a no-go otherwise.

Thanks, --Mitch

Yeah, sorry, I meant that is the current state, not that it can never happen; in fact I think it is not a very big deal… let’s ask: @GregArden, can this be fixed? I don’t know if Mitch’s example here is the same as the ones already on https://mcneel.myjetbrains.com/youtrack/issue/RH-27259 nor if those are similar…

-Pascal

What I am finding is that extracting edges of holes created with MakeHole end up as degree 2 NURBS curves which don’t simplify; whereas a standard BooleanDifference or RoundHole actually do end up as circles. So not only should SimplifyCrv be fixed so it gets degree 2 NURBS circles, but perhaps the MakeHole code should also be looked at… @rajaa

–Mitch

Holes.3dm (100.0 KB)

Out of frustration and need for my current project, I created a quickie hackie. The script below will replace any closed planar “near-circle” curves (curve deviation within file tolerance of a true circle) with Rhino circle objects. Hopefully this will only be necessary in V5…

–Mitch

SimplifyRecalcitrantCircles.py (2.2 KB)

1 Like

RoundHole creates a circle and trim the planar surface with, then generate the walls, etc.
MakeHole extrudes the curve into a solid brep, then boolean out of the target.
In your example, I created a circle, used it in MakeHole, and the result was an edge that is a circle (attached). Not sure how you created the one marked as MakeHole. Holes_RI.zip (60.7 KB)

Yeah, after testing more, sometimes it results in a circle and sometimes it doesn’t… Seems like it’s almost random. I’ll try to figure out how to reproduce this consistently, something causes it.

In any case, the Simplify code really needs to work, that’s the priority. --Mitch

RoundHole ensures that the circle is created on the planar face, and it will always be parallel to that face. MakeHole does not check if the extruded circle is parallel to the face, so a slight rotation can result in a non-circle curve on the face. Could that be the cause?

@rajaa No, I don’t think so. Everything in the particular file I’m working on is all perfectly planar and orthogonal. However I have discovered how to reproduce this consistently, below is a test file.

It seems that the un-simplifiable degree 2 NURBS curve edges are produced when one does a BooleanDifference with a cylinder that has been created by piping a straight line (Pipe command). The same thing does not happen when a cylinder object is used. In the file below, try a BD with the pipes, then dupe the hole edges and test. If you undo, then try with the cylinders you will see the difference. Hope the test file helps.

–Mitch

NonCircleHoleExample2.3dm (193.2 KB)

Edit:
Here is another one - use MakeHole with the red circles and the vertical plate, then delete the circles and duplicate a hole edge. Note the existing holes have the same problem. As far as I can tell the surfaces of the plate are planar surfaces exactly axis-aligned in the XYZ coordinate system, as are the circle objects.

MakeHoleExample.3dm (100.0 KB)

I fixed an embarrassing bug in RhinoSimplifyCurve() where the wrong return code was being sent back. This function is used in SimplifyCurve, Convert, some export options and some geometry creation code. I hope this fixes a lot of these problem let me know. re: https://mcneel.myjetbrains.com/youtrack/issue/RH-27259

Thanks Greg! So the fix will be in the next WIP build? --Mitch

Yes, when the bugtrack includes comments about the code being merged into master that means the change has gone into the WIP. In short, you should see this next week.