Trimbrep fails in ghpy but works in py on same brep


#1

Hi guys,
I run into a wall as the trimbrep fails in a ghpy component while it works perfectly in the regular py script editor. Want to use ghpy to compile a component. Not at the pc right now but the error of the trimbrep in ghpy was along the lines of attrib object has no id properties or something like that. Same testing brep used in both ghpy and py.
Any idea why it fails?


(NARUTO) #2

Hi Isvflorin
Please upload the files?


#3

Probably because grasshopper uses its own tolerance and py the tolerance from the current document. Can you check if those 2 are the same? Had this problem also a while ago.


#4

Thanks Jordy,
But don’t think this is the issue, I use the command witha custom tolerance argument already, as it was failing with the default in py script editor.


#5

Ah oke. Was worth a shot :slight_smile: Got anything we can test with? The script / gh file or your failed trimbrep?


#6

Hard to put the file in… But just tested on a blank canvas.
Create a sphere in the origin.

import rhinoscriptsyntax as rs

obj=x

obj=rs.trimbrep(obj, rs.planefromnormal([0,0,0],rs.vectorcreate([0,0,0],[0,0,-1])),0.001)[0]
print obj

Do a getobject for the py version. Do you get attributedgeometry object has no attribute id?


(Giulio Piacentino) #7

Hi Florin, @isvflorin

What’s your setup? Especially, where are you doing the getobject()?
Thanks

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#8

Not all rhinoscriptsyntax functions are currently supported in ghpython components. Maybe Giulio could fix the rhobj = rhutil.coercerhinoobject(object_id) part.

In order for TrimBrep function to work, you need to switch to Rhino document.

The other solution is not to use it, but use the Brep.Trim method directly (which is what rs.TrimBrep does).

TrimBrep.gh (12.7 KB)
TrimBrep.3dm (37.6 KB)


(Giulio Piacentino) #9

This is a bug in the originally-sound implementation of rhinoscriptsyntax. This operation should not depend from Rhino document objects - we are working on getting these calls all cleared up.
http://mcneel.myjetbrains.com/youtrack/issue/RH-30298

Thanks for reporting this!

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#10

I was doing the getobject in the regular py script editor, the code above is for a ghpython component. Glad you guys are going to sort this out.