Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Lost in Python - rhinoscriptsyntax

$
0
0

Hi,

I must be really dumb but something here just evades me. I want to define a vector in a python script. I literally copied this line from here

import rhinoscriptsyntax as rs
 
vec = rs.CreateVector(1.0, 2.0, 3.0)

And it´s throwing an error " Message: ‘module’ object has no attribute ‘CreateVector’ " in line 29:

import rhinoscriptsyntax as rs

msg = "Select closed curve to use as selection boundary within the viewport"
bound = rs.GetObject(msg, 4, True)
#if not bound: return 

rs.EnableRedraw(False)

rs.Command("_SelBoundary _selid " + str(bound) + " _Enter", False)
objs = rs.SelectedObjects()
rs.UnselectAllObjects()

if objs:
    group = rs.AddGroup()

    # Uncomment below to select just curves
    # res = [c for c in objs if rs.IsCurve(c)]
    # objs = res

    rs.AddObjectsToGroup(objs, group)
    rs.AddObjectToGroup(bound, group)
    rs.ObjectsByGroup(group, True)

rs.EnableRedraw(True)

Objects = rs.SelectedObjects()
RefPts = rs.GetPoints(max_points=2)
Target = rs.GetPoint()
vec = rs.CreateVector(1.0, 0, 0)
Target2 = rs.MoveObject(Target, vec)
Targets = [Target, Target2]
rs.OrientObjects(Objects, RefPts, Targets)

Can anyone explain what am I doing wrong?
Thank you :slight_smile:

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles