Category definition for Scripting


(Steve Baer) #1

Topics related to RhinoScript and Python scripting.

Syntax Highlighting:

Format and highlight your script code by fencing your code block within three back ticks. If you name the language your script is in, you get syntax highlighting, too:


Python:

```python

# Your python code here

print “Hello Pythonic World”

```

becomes

#Your python code here
print "Hello Pythonic World"

VBScript:

```vbscript

’ Your VBScript code here

print “Hello VBScript”

```

becomes

' Your VBScript code here
print "Hello VBScript"

Python – move a mesh using pythonscript
Move group & export to dxf in Python
Renaming a sub-layer with Python
Multiple instances of a custom preview gh component
Error Using Rhino Commands with compiled plugin
How to get GUID of the offsetted geometry
Basic python code - how to wrap value in "for i in" loop with conditional?
Select objects by key/value
Display Conduit making python functions not seem to work
PrevSelectedObjects not working?
Python – move a mesh using pythonscript
#2

Hi Steve,
Perhaps we can put up a sticky on how to post source code? Learning from the old Python/Grasshopper forums, this was always an issue.
Best,
Anders


(Brian Gillespie) #3

I added information on formatting code to the main sticky at the top of this category - does that help?


#4

It does indeed, looks very nice.


# Testing Discourse source code posting
class SomeClass(object):

    """docstring for SomeClass"""

    def __init__(self, gratitude):
        self.gratitude = gratitude

    def thanksBrian(self):
        """docstring for method"""
        for i in range(self.gratitude):
            print "Thanks Brian, looks great!"

test = SomeClass(1000)
test.thanksBrian()