Grasshopper

algorithmic modeling for Rhino

Dear All,
I have a problem with this script included in the component "GHPython"...
apparently there are no errors but the result is null.
I used these two components for surfaces:

rs.AddSrfControlPtGrid(arrCount, Grid, degree=(5,5))
rs.AddSrfPtGrid(arrCount, Grid, degree=(5,5), closed=(False, False))

And this is the script:

 

SurfaceTest2.py


Thank you in advance for any help!
Thank you! ^__^

||||||||||||||||| SCRIPT BEGIN |||||||||||||||||||

import scriptcontext
import math
import Rhino
import System.Guid
import rhinoscriptsyntax as rs
## from curve import __CurveFromId
## import object as rhobject
## import utility as rhutil



def CreaNuovaSuperficieBezier ():

        
        arrCount = []
        arrCount.append(6)
        arrCount.append(6)
        
        Grid2 = [Pos0,Pos1,Pos2,Pos3,Pos4,Pos5,Tan0,Tan1,Tan2,Tan3,Tan4,Tan5,Cur0,Cur1,Cur2,Cur3,Cur4,Cur5,SecondCur0,SecondCur1,SecondCur2,SecondCur3,SecondCur4,SecondCur5,SecondTan0,SecondTan1,SecondTan2,SecondTan3,SecondTan4,SecondTan5,SecondPos0,SecondPos1,SecondPos2,SecondPos3,SecondPos4,SecondPos5]
        
        surfaceNewCPG2 = rs.AddSrfControlPtGrid(arrCount, Grid2, degree=(5,5))
        surfaceNewPT2  = rs.AddSrfPtGrid(arrCount, Grid2, degree=(5,5), closed=(False, False))

        print(Pos0)
        print(Pos1)
        print(Pos2)
        print(Pos3)
        print(Pos4)
        print(Pos5)
        print(Tan0)
        print(Tan1)
        print(Tan2)
        print(Tan3)
        print(Tan4)
        print(Tan5)
        print(Cur0)
        print(Cur1)
        print(Cur2)
        print(Cur3)
        print(Cur4)
        print(Cur5)
        print(SecondCur0)
        print(SecondCur1)
        print(SecondCur2)
        print(SecondCur3)
        print(SecondCur4)
        print(SecondCur5)
        print(SecondTan0)
        print(SecondTan1)
        print(SecondTan2)
        print(SecondTan3)
        print(SecondTan4)
        print(SecondTan5)
        print(SecondPos0)
        print(SecondPos1)
        print(SecondPos2)
        print(SecondPos3)
        print(SecondPos4)
        print(SecondPos5)
        print Grid2

CreaNuovaSuperficieBezier ()
 ||||||||||||||||| SCRIPT END |||||||||||||||||||

Views: 848

Replies to This Discussion

I didn't test it but as far as I can see there are two problems with this script:

1. You don't return the surfaces from the function.

2. You don't assign the result to Python component output.

I attached a modified file for you. I commented between the lines.

Mostapha

Attachments:

Sorry for my ignorance -___-

... but how can I "assign the returned value to Python component output"?


Thank You Again ^_^

 

surfaceNewPT = CreaNuovaSuperficieBezier ()

Ahhh! Ok, ok, I made it!

I have written in the right column of the component "GHpython" the value names:

 

surfaceNewCPG2

surfaceNewPT2

 

..and now it's all right! ^__^


I also learned an important lesson about Python language through the use of the command "return"... I am a beginner, sorry.


Thank You
!
Thank You
!
Thank You
!

I link, for complete information, the working script (your script without some of my unnecessary lines).

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service