MahmoudAbdelRahman / GH_CPython

CPython plugin for Rhino-Grasshopper
BSD 2-Clause "Simplified" License
175 stars 38 forks source link

Strange error on parameter output #16

Closed dantaeyoung closed 7 years ago

dantaeyoung commented 7 years ago

I'm getting a strange error when returning a very specific value: "Line(3)" as an output.

My code is:

s = "Line(0123456789)"
output_ = s

screenshot

Any ideas? Thank you, @MahmoudAbdelRahman !

MahmoudAbdelRahman commented 7 years ago

Hi @dantaeyoung, Thanks so much for the feedback, Yes, this problem occurs because I'm now trying to add Grasshopper library. so if you set the output to be for example output_ = "Line(ax, ay, az, bx, by, bz)" it will add a new line with these parameters.

I've changed this code a little bit to be as follows:

output_ = "gCPy.Line(ax, ay, az, bx, by, bz)", I don't know if it is a good practice or not, but I'll try to make it as good as possible. image

The next update should include Grasshopper module, for example, to add new line it will be as follows (it is still under development):

import Grasshopper as gh
output = gh.addLine(0., 0., 0., 5., 5., 0.)
#or
p1 = gh.Point3(0., 0., 0.)
p2 = gh.Point3(5., 5., 0)

output_ = gh.addLine(p1, p2)

any suggestions or comments or feedback are most welcome. Thanks so much. Best regards, Mahmoud Abdelrahman.

MahmoudAbdelRahman commented 7 years ago

Hi @dantaeyoung , You can download the modified version from here, You will notice a new file called Grasshopper.py at C:\GH_CPython\.

This is example of what it could do

image

Sincere regards Mahmoud AbdelRahman

dantaeyoung commented 6 years ago

Thanks for this @MahmoudAbdelRahman !

Question/suggestion: would it be better/easier to implement Rhinoscriptsyntax? That way it's guaranteed that GH_CPython gh implementation can follow that of GH_Python, rather than having to recreate all GH functions and potentially introducing a layer of bugs/maintenance..

MahmoudAbdelRahman commented 6 years ago

Hi @dantaeyoung , Yes, I totally agree with you, I'm trying to find a way to do this. Thanks so much.