Grasshopper

algorithmic modeling for Rhino

Hello,

I am in the course of learning script example from Rhino 5 Python Primer regarding recursion.

I have a function written as below:

```python

def AddArcDir(ptStart, ptEnd, vecDir):
vecBase = rs.PointSubtract(ptEnd, ptStart)
if rs.VectorLength(vecBase)==0.0: return

if rs.IsVectorParallelTo(vecBase, vecDir): return

vecBase = rs.VectorUnitize(vecBase)
vecDir = rs.VectorUnitize(vecDir)

vecBisector = rs.VectorAdd(vecDir, vecBase)
vecBisector = rs.VectorUnitize(vecBisector)

dotProd = rs.VectorDotProduct(vecBisector, vecDir)
midLength = (0.5*rs.Distance(ptStart, ptEnd)/dotProd

vecBisector = rs.VectorScale(vecBisector,midLength)
return rs.AddArc3Pt(ptStart, rs.PointAdd(ptStart, vecBisector), ptEnd)

```

In the line : 

```python

vecBisector = rs.VectorScale(vecBisector,midLength)

```

I get an error message "SyntaxError: unexpected token 'vecBisector' ". Why do I get this message?

Views: 486

Replies to This Discussion

I tlooks like you need to close your parenthesis on the line above:

midLength = ( 0.5*rs.Distance(ptStart, ptEnd) / dotProd )

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service