Exemplo n.º 1
0
# with a textbox that can be used to define the text in a new text dot
from System.Windows.Forms import Form, DialogResult, Label, Button, TextBox, CheckBox, ComboBox, NumericUpDown
from System.Drawing import Point, Size
import rhinoscript.selection
import rhinoscript.geometry

import rhinoscriptsyntax as rs

import os
from subprocess import check_output

#add to rhino as an alias
if not rs.IsAlias("TNM_addLayer"):
    rs.AddAlias("TNM_addLayer", "'_-runPythonScript \"%s\"" % __file__)
    print 'addAlias'
else:
    print 'alias could not be added'


# Our custom form class
class AnnotateForm(Form):
    # build all of the controls in the constructor
    def __init__(self, tools):

        label_width = 30
        offset = 30
        index = 0

        # header
        self.Text = "Add layer"
        width = 400
Exemplo n.º 2
0
import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import math
import re
import time
import os

#add to rhino as an alias
if not rs.IsAlias("TNM_renameLayers"):
    rs.AddAlias("TNM_renameLayers", "'_-runPythonScript \"%s\"" % __file__)
    print 'addAlias'
else:
    print 'alias could not be added'

layers = rs.LayerIds()
for layer_id in layers:

    if rs.IsLayer(layer_id):

        old_name = rs.LayerName(layer_id, False)

        if (re.search('0.0.0', old_name)):

            new_name = old_name.replace('0.0.0', '0.0.160.0')

            rs.RenameLayer(old_name, new_name)
    else:
        print layer_id
Exemplo n.º 3
0

import rhinoscriptsyntax as rs
import Rhino
import math
import re
import time
import scriptcontext
import checkAndExport as ce

# SCRIPT GLOBALS
EXPORT_FONT = 'timfont'
MAT_THICKNESS = 18

#add to rhino as an alias
if not rs.IsAlias("TNM_make3d"):
    rs.AddAlias("TNM_make3d",  "'_-runPythonScript \"%s\"" % __file__ )
    print 'addAlias'
else:
    print 'alias could not be added'

# recursive explode of blocks
def iterateBlocks(objects):

    def explode(objs, li):
        for obj in objs:
            if rs.IsBlockInstance(obj):

                # DIRTY FIX FOR RHINO 5-SR14 522.8390 (5-22-2017)
                # temp_objs = rs.ExplodeBlockInstance(obj)
Exemplo n.º 4
0
# for a in dir(rs):
# if "Layer" in a:
# print a

# SCRIPT GLOBALS
EXPORT_FONT = 'timfont'
DEBUG_CLAMEX = True
DEBUG_FLIPCUVRVE = False

# filename = __file__.replace("\\","//")

print os.path

#add to rhino as an alias
if not rs.IsAlias("TNM_Export"):
    rs.AddAlias("TNM_Export", "'_-runPythonScript \"%s\"" % __file__)
    print 'addAlias'
else:
    print 'alias could not be added'

# print 'addalias', rs.AddAlias("checkAndExport",  "'_-runPythonScript \\"%s\\"" %  )


def redraw():
    rs.EnableRedraw(True)
    rs.EnableRedraw(False)


# function to reverse a curve if the normal points downwards in Z-dir
# assumed is that only closed curves can have inside or outside