Information

RhinoScript

RhinoScript is a scripting tool based on Microsoft's VBScript language. With RhinoScript, you can quickly add functionality to Rhino, or automate repetitive tasks.

Website: http://wiki.mcneel.com/developer/rhinoscript
Members: 169
Latest Activity: Jun 19, 2019

Discussions

Enable HistoryRecording with macro. How to turn on?

@leex wrote:

Hi
How to turn on before starting a command and then turn it off after completion?

Posts: 4

Participants: 3

Read full topic

How to get raw code content of another python script

@yun.sung wrote:

@piac

Is there a way for a python script to get the raw code from another python script?
Similar to how GhPython.Assemblies.CodeGeneration.GenerateComponentCode works?

The output should be a raw string, newlines will be \n etc.

Posts: 4

Participants: 2

Read full topic

Object Date Modified

@Ncik wrote:

G’day everyone,

I’m trying to develop a QA process to identify parts that are un-finished. A clue to this is to highlight parts that have not been modified in a while. (probably a colour scale or just identify the oldest.)

A quick search for date, time or modified in Rhinocommon and Python APIs indicates there doesn’t appear to be any relevant data added to objects or it is inaccessible. Is this correct?

cheers,
Nick

Posts: 2

Participants: 2

Read full topic

Bug in SR23 RC : Error with adding text objects in python

@Holo wrote:

Hi guys,
@stevebaer @wim

it seems you have changed something that makes adding text objects requiring a font to be defined.
This causes scripts that has worked for over a year to suddenly fail and is a problem.

I don’t think it’s OK to change stuff like that in a minor SR (nor in a bigger update as going from V6 to V7 either actually) since Rhino is more or less auto updated, and thus this causes issues for those who has scripts that uses text objects with default fonts in production.

Note: rs.AddText() says it has font as OPTIONAL.

So if you want to change something then do it behind the scene adding Arial as default if nothing is defined by the user.

Posts: 7

Participants: 4

Read full topic

Curves through points from a point matrix

@jcraig0611 wrote:

Hi all,

I’m very new to Python in Rhino and have run into a bit of a snag for a script I’m trying to write. In the lines below, I establish a point matrix based on user input via rs.GetInteger, save those to a list (ptList_1) and then try to create a series of individual curves from rows of x or y points so that I can loft a surface from them. The way it is written now, I can get a curve extending through the entire list, but am not sure how to stop it at each new line so that they’re individual. Sorry if this is poorly explained, but any help would be greatly appreciated!

import rhinoscriptsyntax as rsimport random
# Empty lists
ptList_1 = []

ptList_2 = []
# For curves to loft surface
crvList_1 = []
# For first set of circles
crvList_2 = []
# For second set of circles
crvList_3 = []
# Point dictionary for first matrix set
ptDict_1 = {}
# Point dictionary for second matrix set (moved points)
ptDict_2 = {}

# i, j and k values

imax = rs.GetInteger('Choose an x value', 10)
jmax = rs.GetInteger('Choose a y value', 10)
kmax = rs.GetInteger('Choose a z value', 2)

attPt_1 = rs.AddPoint(random.randrange(1,(imax*5)), random.randrange(1,(jmax*5)), random.randrange(1,30))
#attPt_2 = rs.AddPoint((random.randrange(1,15)*(imax/4)),(random.randrange(1,15)*(imax/4)),(random.randrange(1,15)*(imax/4)))

# Values for first point matrix loop

for i in range(imax):
    for j in range(jmax):
        
        x = i * 5
        y = j * 5
        
        point = (x,y,0)
        # Save points to dictionary for line construction
        ptDict_1[(i,j)] = point        
        ptList_1.append(rs.AddPoint(point))
        
        #print ptList_1

for i in range(imax*jmax):
    distance = rs.Distance(ptList_1[i], attPt_1)
    move_1 = distance/2
    #print move_1
    ptList_2.append(rs.MoveObject(ptList_1[i], (0,0,move_1)))

for j in range(jmax):
        crvList_1.append(rs.AddCurve((ptList_1), 2))

Posts: 3

Participants: 2

Read full topic

 

Members (169)

 
 
 

Translate

© 2020   Created by McNeel Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service