Bug in rs.addcurve or append :/


#1

I have tried to bugtrack this stuff but I don’t understand what is going on, for some reason code that works fine in V5 adds extra points at w(0,0,0) which is quite strange, but it happens on multiple of my scripts.

And now that I work on a mesh tool that analyzes faces based on their boundries I realized that it only happens on the quads and not the tris (obviously based on how I check for similar vertex data on vertex 3 and 4) but still it is very strange. Oh, and in my example it happnes on 66 curves, but there are 198 points at w(0,0,0)…

image

mesh for quad tri bug.3dm (43.5 KB)

mesh quad tri bug.py (544 Bytes)


#2

by the way, here is the code so you can read it online:


import rhinoscriptsyntax as rs

mesh=rs.GetObject(filter=32)

vertices=rs.MeshVertices(mesh)
faces=rs.MeshFaceVertices(mesh)

for face in faces:
    
    pts=[]
    
    pts.append( vertices[ face[0] ] )
    pts.append( vertices[ face[1] ] )
    pts.append( vertices[ face[2] ] )
    
    if face[2]==face[3]:
        #--- Mesh is TRI
        rs.Sleep(0)
    else:
        #--- Mesh is QUAD
        
        pts.append( vertices[ face[3] ] )
    
    pts.append( vertices[ face[0] ] )
    
    rs.AddCurve(pts,degree=1)


#3

Hi Holo,

if you use rs.AddPolyline(pts) instead of rs.AddCurve(pts,degree=1) it works.
So there seems to be a bug in rhinocommon Curve.CreateControlPointCurve.

Jess


#4

Dang @Jess, you beat me to it…


#5

Cool, thanks for the workaround!

But why does it only happen to the “quad” curves and not the “tri” curves? That is the oddest part IMO.


#6

I expect it doesn’t like the first and last point being the same - which should theoretically just create a closed curve - coupled with Degree1. If you raise the degree to 2 or 3, it works fine.


#7

Ok, that makes sense, but on my other scripts that have the same w(0,0,0) issues all the curves are open…
Anyway, I leave it to the big brains and thank you for the workarounds!


#8

Actually it works with 3, 7, 15, 31, 63… initial points.
But I’ve stopped wondering about the oddities of bugs :wink:


#9

Makes a cool form with degree 2 or 3 though…


#10

Hi @dale I see that you edited the post, but I hope you didn’t just sign it as “Solved”. Have you looked at what’s causing the odd w0,0,0 points?


(Dale Fugier) #11

Hi @Holo,

Thanks for you patience. It took me a while to track down this bug. I’ve logged the issue.

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

– Dale


#12

Sweet!
Well done!
Is it fixed in the upcoming SR?


(Dale Fugier) #13

Looks that way.