Timer python

Hi,

How to change this python script, that every time I change base - point, the script updates itself?

Is it possible to do this without grasshopper timer, using Rhino EditPythonScript

Python script:

#############

import rhinoscriptsyntax as rs

def vectorField():
    cloud_id = rs.GetObject("Input pointcloud", 2, True, True)
    if cloud_id is None: return
    
    listpoints = rs.PointCloudPoints(cloud_id)
    base_point = rs.GetPoint("Vector field base point")
    if base_point is None: return
    
    for point in listpoints:
        vecbase = rs.VectorCreate(point, base_point)
        vecdir = rs.VectorCrossProduct(vecbase, (0,0,1) )
        
        if vecdir:
            vecdir = rs.VectorUnitize(vecdir)
            vecdir = rs.VectorScale(vecdir, 2.0)
            AddVector(vecdir, point)

def AddVector(vecdir, point):
    tip_point = rs.PointAdd(point, vecdir)
    line = rs.AddLine(point, tip_point)
    if line: return rs.CurveArrows(line,2)

vectorField()

#############

Below screenshot is attached

  • up

    Giulio Piacentino

    Hi Petras

    are you looking for something similar to this?

    The only main difference from your script is that, unfortunately, arrowheads are not currently supported in Grasshopper, but we could apply them once we bake the lines into Rhino. Or we could draw them with tiny surfaces, lines or meshes.

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

    2