コード例 #1
0
 def get_player_symbol(self):
     """Character selection for the player"""
     if rs.ListBox((PLAYER_O, PLAYER_X),
                   message='Choose your symbol',
                   default=PLAYER_O) == PLAYER_O:
         self.player_symbol, self.ai_symbol = (PLAYER_O, PLAYER_X)
     else:
         self.player_symbol, self.ai_symbol = (PLAYER_X, PLAYER_O)
コード例 #2
0
def getOptions_dict(options_dict):
    # Eventually would be nice to distiguish between cancel and enter keys
    texts = options_dict.keys()
    result = rs.ListBox(texts, message="select weight function", title="Title")
    option = texts[0]
    if result:
        option = result
    else:
        print "defualt"
    return options_dict[option]
コード例 #3
0
def select_scale():
    """
    returns selected scale (e.g. 1:5, 1:1, etc.) from list box (predefined scales)
    """
    pageview = sc.doc.Views.ActiveView
    pageview.SetPageAsActive()
    page_scale = pageview.ActiveViewport.GetUserString("page_scale")
    scales = [
        "1:100", "1:50", "1:20", "1:10", "1:5", "1:2", "1:1", "2:1", "5:1",
        "10:1"
    ]
    if (page_scale == None) or (page_scale not in scales):
        value = rs.ListBox(scales, "Select scale", "Scale", "1:5")
    else:
        value = rs.ListBox(scales, "Select scale", "Scale", page_scale)
    if not value:
        return False
    else:
        return value
コード例 #4
0
def AddLayoutButton():
    layouts = ['8.5x11 Landscape', '11x17 Landscape', '18x24 Landscape']
    result = rs.ListBox(layouts, "Select layout to add", "Add Layout",
                        "11x17 Landscape")
    if result is None: return
    if result == "11x17 Landscape":
        func = 11
    elif result == "8.5x11 Landscape":
        func = 8
    elif result == "18x24 Landscape":
        func = 18
    AddLayout(func)
コード例 #5
0
def GetPopulationType(vehicles=True):
    if 'populate-type' in sc.sticky:
        typeDefault = sc.sticky['populate-type']
    else:
        typeDefault = '3D People'
    types = ['3D People', '2D People', '3D Trees', '2D Trees', 'Custom Block']
    if vehicles:
        types.insert(-1, '3D Vehicles')
    type = rs.ListBox(types, "Select block type to populate",
                      "Population Type", typeDefault)
    if type is None: return None
    sc.sticky['populate-type'] = type
    return type
コード例 #6
0
ファイル: spkcam_ui.py プロジェクト: spkdevelop/SPKCAM
 def sel_preset_button(self,sender,e):
     
     preset =  rs.ListBox(sorted(["* %s"%i if self.machining_settings[i]["persistant"] else "%s"%i for i in self.machining_settings]), message="Rutinas:", title="Cambiar rutina", default=None)
     try:
         w = self.form.panel.Controls.Find("preset", True)[0]
         if preset:
             
             self.user_data["selected_preset"] = preset.replace("*","").strip()
             w.Text = preset
         else:
             pass
     except:
         pass
コード例 #7
0
def main():
    rs.EnableRedraw(enable=False)

    notes = sc.doc.Notes
    if notes:
        variables = notes.split("\r")
        vardict = {}
        for variable in variables:
            var = variable.split("=")
            var = list([x.strip() for x in var])
            vardict[var[0]] = var[1]

    allLayers = rs.LayerNames()
    topList = []
    for layer in allLayers:
        if rs.LayerChildCount(layer) > 0:
            if re.search("::", layer):
                layer = layer.split("::")[0]
            if re.search("^L\d", layer) or re.search(
                    "^R\d", layer) or re.search("^M\d", layer) or re.search(
                        "^P\d",
                        layer) or re.search("^SECTION ", layer) or re.search(
                            "^ROOFPLAN", layer) or re.search("^SOLIDS", layer):
                topList.append(layer)
    topList = sorted(list(set(topList)))
    thisLayer = rs.CurrentLayer()

    topList.append("TURN ALL ON")
    destinationLayer = rs.ListBox(topList, "Layer To Activate")

    if not destinationLayer:
        print("No Layer Selected")
        return None
    elif destinationLayer == "TURN ALL ON":
        topList.remove(destinationLayer)
        for layer in topList:
            sc.doc = Rhino.RhinoDoc.ActiveDoc
            rs.LayerVisible(layer, True)
            rs.ExpandLayer(layer, False)
    else:
        topList.remove("TURN ALL ON")
        topList.remove(destinationLayer)
        rs.CurrentLayer(layer=destinationLayer)
        rs.ExpandLayer(destinationLayer, True)
        for layer in topList:
            sc.doc = Rhino.RhinoDoc.ActiveDoc
            rs.LayerVisible(layer, False)
            rs.ExpandLayer(layer, False)
    print(destinationLayer)
    rs.EnableRedraw(enable=True)
コード例 #8
0
def change_page_scale():
    
    #set focus to page
    pageview = sc.doc.Views.ActiveView
    pageview.SetPageAsActive()
    id = str(pageview.ActiveViewportID)
    view_port = pageview.MainViewport
    page_scales = ["1:100","1:50","1:20","1:10","1:5","1:2","1:1","2:1","5:1","10:1"]
    value = rs.ListBox(page_scales, "Set page scale", "Page scale", "1:5")
    if not value:
        return
    view_port.SetUserString("page_scale",value)
    page_scale = Rhino.Runtime.TextFields.LayoutUserText(id, "page_scale")
    return page_scale
コード例 #9
0
def main():
    sc.doc = Rhino.RhinoDoc.ActiveDoc
    rs.EnableRedraw(enable=False)

    topList = []
    topList = sorted(getLayerList.getLayers(exclude=["3D", "3dm"]))

    thisLayer = rs.CurrentLayer()

    topList.append("TURN ALL ON")
    destinationLayer = rs.ListBox(topList, "Layer To Activate")

    if not destinationLayer:
        print("No Layer Selected")
        return None

    elif destinationLayer == "TURN ALL ON":
        topList.remove(destinationLayer)
        for layer in topList:
            sc.doc = Rhino.RhinoDoc.ActiveDoc

            rs.LayerVisible(layer, True)
            rs.ExpandLayer(layer, False)

    else:
        sc.doc = Rhino.RhinoDoc.ActiveDoc

        topList.remove("TURN ALL ON")
        topList.remove(destinationLayer)
        rs.CurrentLayer(layer=destinationLayer)
        rs.ExpandLayer(destinationLayer, True)
        for layer in topList:
            sc.doc = Rhino.RhinoDoc.ActiveDoc

            rs.LayerVisible(layer, False)
            rs.ExpandLayer(layer, False)

    print(destinationLayer)
    rs.EnableRedraw(enable=True)
コード例 #10
0
ファイル: blocks.py プロジェクト: tmwarchitecture/PCPA_TOOLS
def ExportAndLinkBlock():
    try:
        name = rs.ListBox(rs.BlockNames(True),
                          'Select Block to Export and Link', 'Export and Link')
        if name is None: return

        path = rs.SaveFileName('Export and Link',
                               "Rhino 6 3D Models|.3dm||",
                               filename=name)
        if path is None: return

        try:
            rs.Command(
                "_-BlockManager e " + '"' + name + '" ' + path + ' Enter',
                False)
            rs.Command(
                "_-BlockManager _Properties " + '"' + name + '"' +
                " _UpdateType i " + path +
                " _UpdateType _Linked _Enter _Enter", False)
        except:
            pass
        return True
    except:
        return False
コード例 #11
0
def RunCommand(is_interactive):

    print('fetching conda envs....')

    envs = list_envs(show_packages=False)
    envs_dict = {}
    for env_path in envs:
        if env_path.find('envs') < 0:
            name = 'base'
        else:
            name = os.path.split(env_path)[-1]
        envs_dict[name] = env_path
    options = envs_dict.keys()

    if options:
        selected = rs.ListBox(options, "Select env to install")
        if selected:
            packages = list_package(selected)
            options = []
            for p in packages:
                if p['name'].find('compas') == 0:
                    entry = "%s   %s   %s" % (p['name'].replace('-', '_'), p['version'], p['channel'])
                    options.append((entry, False))

            if options:
                results = rs.CheckListBox(options, "Select compas packages to install from [%s]:" % selected)
                if results:
                    to_install = []
                    for package, yes in results:
                        if yes:
                            name = package.split("   ")[0]
                            to_install.append(name)
                    install_env_packages(selected, envs=envs, packages=to_install)

            else:
                print("no compas package found in env: %s" % selected)
コード例 #12
0
#create a vector between the origin and the point, represent this with a colored line
vector1 = rs.VectorCreate(pt1, origin)
rs.ObjectColor(rs.AddLine(origin, pt1), (255, 0, 0))

#prompt the user for a second point
pt2 = rs.GetPoint("Pick a second point", origin)
rs.AddPoint(pt2)

#create a vector between the origin and the point, represent this with another colorerd line
vector2 = rs.VectorCreate(pt2, origin)
rs.ObjectColor(rs.AddLine(origin, pt2), (0, 0, 255))

#create some options for Vector operations and prompt user for input with List of options
options = ("Vector Addition", "Vector Subtraction", "Vector Dot Product", "Vector Cross Product")
if options:
    result = rs.ListBox(options, "Pick a Vector Math Operation")
    #output the result with a message box (this prompts the user for an OK)
    if result: rs.MessageBox(result + " was selected")
    
    #prompt user in command line for vector unitization (this is more like standard Rhino commands
    unit = rs.GetString("Unitize Vector?", "Yes", ["Yes", "No"])
    #if we are unitizing, give the user the option of scaling the vector
    if unit == "Yes":
        #by default, out scale values will start at 1 (no scaling)
        scale = rs.GetReal("Scale value for unit vector?", 1)
    
    #Addition of Two Vectors
    if result == "Vector Addition":
        vector3 = rs.VectorAdd(vector1, vector2)
        if unit == "Yes":
            vector3 = rs.VectorUnitize(vector3) * scale
コード例 #13
0
def set_level():
    levels = {"Easy": (8, 10), "Medium": (16, 40), "Hard": (24, 99)}
    return levels[rs.ListBox(levels.keys(), 'Select difficulty:',
                             'Rhino Minesweeper')]
コード例 #14
0
def matchLayer(name, source):
    rs.LayerLinetype(name, linetype = rs.LayerLinetype(source))
    rs.LayerPrintColor(name, color = rs.LayerPrintColor(source))
    rs.LayerPrintWidth(name, width = rs.LayerPrintWidth(source))


sourceObjects = rs.GetObjects(message="Select Object to Move", preselect=True, select=False)

allLayers = rs.LayerNames()
topList = []
for layer in allLayers:
    if rs.LayerChildCount(layer) > 0:
        topList.append(layer)

destinationLayer = rs.ListBox(topList)

rs.EnableRedraw(enable=False)

for obj in sourceObjects:
    objLayer = rs.ObjectLayer(obj)
    parent, child = objLayer.split("::")
    fullDLayer = destinationLayer + "::" + child
    if not rs.IsLayer(fullDLayer):
        fullDLayer = duplicateLayer(child, objLayer, destinationLayer)    
    if copy[0] == True:
        copyObj = rs.CopyObject(obj, translation=None)
        rs.ObjectLayer(copyObj, layer=fullDLayer)
    else:
         rs.ObjectLayer(obj, layer=fullDLayer)
コード例 #15
0
def main():

    # enter deck related attributes
    deckType = getString("Enter deck specification method", "parabolic",
                         ["parabolic", "sinusoidal", "custom"])
    objects = None

    if deckType == "parabolic":
        L = getReal("Enter deck length (L)", minimum=0.0001)
        d = getReal("Enter deck depth (d_deck)", minimum=0.)
        h = getReal("Enter deck height (h_deck)", 0.)
        deck = fd.parabolicDeck(L, d, h)
        segs = getInteger("Enter number of segments to approximate arch",
                          minimum=2)

    elif deckType == "sinusoidal":
        L = getReal("Enter deck length (L)", minimum=0.0001)
        A = getReal("Enter deck amplitude (A)", minimum=0.)
        lmda = getReal("Enter deck wavelength (lambda)", L, minimum=0.0001)
        phi = getReal("Enter deck phase (phi)", 0., 0., 2 * math.pi)
        h = getReal("Enter deck height (h_deck)", 0.)
        deck = fd.sineDeck(L, A, lmda, phi, h)
        segs = getInteger("Enter number of segments to approximate arch",
                          minimum=2)
    else:

        objects = rs.GetObjects("Select deck curve(s)",
                                preselect=True,
                                minimum_count=1)
        isValid = False
        for o in objects:
            end = rs.CurveEndPoint(o)
            start = rs.CurveStartPoint(o)
            if end.X < -0.0001 or start.X < -0.0001:
                isValid = False
                break
            elif abs(end.X) <= 0.0001:
                if abs(end.Y <= 0.0001) and abs(end.Z <= 0.0001):
                    isValid = True
                    break
            elif abs(start.X) <= 0.0001:
                if abs(start.Y <= 0.0001) and abs(start.Z <= 0.0001):
                    isValid = True
                    break

        if isValid == False:
            print "Deck must start at origin"
            exit()

        if len(objects) == 1:
            o = objects[0]
            deck = lambda x: rhinosgsm.ptToVect(
                rs.EvaluateCurve(o, rs.CurveClosestPoint(o, [x, 0., 0.])))
            L = rs.CurveEndPoint(o).X - rs.CurveStartPoint(o).X
            segs = getInteger("Enter number of segments to approximate arch",
                              minimum=2)

        else:
            deck = [rhinosgsm.ptToVect(rs.CurveStartPoint(objects[0]))]
            for o in objects:
                deck.append(rhinosgsm.ptToVect(rs.CurveEndPoint(o)))
            xEnd = lambda o: max(
                rs.CurveStartPoint(o).X,
                rs.CurveEndPoint(o).X)
            L = max(map(xEnd, objects))
            segs = None

    # enter loads
    q = getReal("Enter load on deck (q)", minimum=0.0001)
    qArch = getReal("Enter self-weight of arch (q_arch)", minimum=0.0001)

    # choose whether or not to optimize
    isOpt = getString("Do you want to use an optimization function?", "yes",
                      ["yes", "no"])

    # produce optimized form
    if isOpt == "yes":

        var = getString("Enter the variable you want to change",
                        strings=["H", "anchorOffset"])

        if var == "H":
            sign = getString("Enter the sign of H",
                             "positive",
                             strings=["positive", "negative"])
            if sign == "positive":
                isArch = True
            else:
                isArch = False
            anchOff = getReal("Enter anchor offset", 0.)
            H = None

        else:
            H = 0.
            while not H != 0.:
                H = getReal("Enter horizontal force (H)")
                if not H != 0.:
                    print "H may not equal 0.0"
            anchOff = None
            isArch = None

        optParam = rs.ListBox(opt.optList(var == "H", var == "anchorOffset"),
                              "Select optimization parameter",
                              "Optimization Parameters")

        if optParam == "select arch height":
            hArch = getReal("Enter arch height", minimum=0.0001)
        else:
            hArch = None

        func = opt.optFunc(optParam, q, qArch, h=hArch)
        bridge = opt.optGlob(deck, L, q, qArch, segs, func, isArch, H, anchOff)

        if H == None:
            print "H =", bridge.getH()
        else:
            print "anchor offset =", bridge.getAnchOff()

    # produce non-optimized form
    else:
        H = 0.
        while not H != 0.:
            H = getReal("Enter horizontal force (H)")
            if not H != 0.:
                print "H may not equal 0.0"
        anchOff = getReal("Enter anchor offset", 0.)
        bridge = fd.fromDeck(deck, L, anchOff, H, q, qArch, segs)

    if segs == None:
        segs = len(objects)

    # draw bridge
    cables = getInteger("Enter number of cables to draw", segs - 1, 1,
                        segs - 1)

    if objects != None:
        rs.DeleteObjects(objects)

    rhinobridge.drawBridge(bridge, cables)
コード例 #16
0
def rescale():
    # get current state and scale from DocumentData, if present or from user, if not
    print("Current Scale: 1:", rs.GetDocumentData("ScaleModel", "scale"))
    print("Current State: ", rs.GetDocumentData("ScaleModel", "state"))

    if rs.GetDocumentData("ScaleModel", "scale") and rs.GetDocumentData(
            "ScaleModel", "state"):
        scale = float(rs.GetDocumentData("ScaleModel", "scale"))
        oldechelle = scale
        state = rs.GetDocumentData("ScaleModel", "state")
        oldetat = state
    else:
        state = ""
        state = rs.ListBox(items=("Full-Scale", "Model Scale"),
                           message="Currently at what scale ?",
                           title="Scale Model",
                           default=state)
        if state is None:  # cancelled
            return
        oldetat = state
        if state == "Model Scale":
            scale = 250.
            scale = rs.GetReal("Current Scale 1:", scale, 0)
            oldechelle = scale
            if scale is None:  # cancelled
                return
        else:
            if state == "Full-Scale":
                scale = 1.
    previous_params = (str(scale), state)
    # get desired state and scale
    state = rs.ListBox(("Full-Scale", "Model Scale"),
                       "Currently %s. Choose new state" % (state), "Rescale",
                       state)
    if state == None:  # cancelled
        return

    if state == "Model Scale":
        if not scale: scale = 250.
        scale = rs.GetReal("New Scale 1:", scale, 0)
        if scale == None: return

    rs.SetDocumentData("ScaleModel", "scale", str(scale))
    rs.SetDocumentData("ScaleModel", "state", state)

    # scale geometry and dimensions
    dimstyles = rs.DimStyleNames()

    rs.EnableRedraw(False)

    if not oldetat == state:
        if state == "Full-Scale":
            rs.ScaleObjects(rs.AllObjects(), [0, 0, 0], [(scale), (scale),
                                                         (scale)])
            for dimstyle in dimstyles:
                rs.Command('_-ScaleDimstyle "' + dimstyle + '" ' + str(scale))

        else:
            rs.ScaleObjects(rs.AllObjects(), [0, 0, 0], [(1 / scale),
                                                         (1 / scale),
                                                         (1 / scale)])
            for dimstyle in dimstyles:
                rs.Command('_-ScaleDimstyle "' + dimstyle + '" ' +
                           str(1 / scale))

    else:
        if state == "Model Scale":
            rs.ScaleObjects(rs.AllObjects(), [0, 0, 0], \
                            [(oldechelle / scale), (oldechelle / scale), (oldechelle / scale)])
            for dimstyle in dimstyles:
                rs.Command('_-ScaleDimstyle "' + dimstyle + '" ' +
                           str(oldechelle / scale))
    sc.doc.AddCustomUndoEvent("Undo ScaleModel", __undo_usertext,
                              previous_params)
    print("New Scale: 1:", rs.GetDocumentData("ScaleModel", "scale"))
    print("New State: ", rs.GetDocumentData("ScaleModel", "state"))
    rs.EnableRedraw(True)

    rs.ZoomExtents(all=True)
コード例 #17
0
def VolumeMassWeightCentroids(_materials, _densities):
    # object ids
    objects = rs.GetObjects("Pick objects of the same material",
                            16,
                            preselect=True)
    if objects:
        objectsClosed = []
        for obj in objects:
            if rs.IsPolysurfaceClosed(obj) == True:
                objectsClosed.append(obj)
        if len(objectsClosed) > 0:

            # choose material
            pickedMaterial = rs.ListBox(_materials, "Choose the material",
                                        "Material", "Stainless Steel ")
            if pickedMaterial:
                for i in range(len(materials)):
                    if _materials[i] == pickedMaterial:
                        density = _densities[i]
                        break

                # units correction
                unitsystemIndex = rs.UnitSystem()
                if unitsystemIndex == 0:
                    print "No unit system. Operation terminated"
                    return
                elif unitsystemIndex == 2:  #mm
                    density = density / 1000000
                    massFactor = 0.001
                    massUnits = "g"
                    volumeUnits = "mm3"
                    lengthUnits = "mm"
                elif unitsystemIndex == 3:  #cm
                    density = density / 1000
                    massFactor = 0.001
                    massUnits = "g"
                    volumeUnits = "cm3"
                    lengthUnits = "cm"
                elif unitsystemIndex == 4:  #m
                    density = density
                    massFactor = 1
                    massUnits = "kg"
                    volumeUnits = "m3"
                    lengthUnits = "m"
                elif unitsystemIndex == 8:  #inches
                    density = density * 0.00057803667443635
                    massFactor = 0.0283495
                    massUnits = "oz"
                    volumeUnits = "in3"
                    lengthUnits = "in"
                elif unitsystemIndex == 9:  #feet
                    density = density * 0.998847
                    massFactor = 0.453592
                    massUnits = "lb"
                    volumeUnits = "ft3"
                    lengthUnits = "ft"
                else:
                    print "You are not using one of these unit systems: mm, cm, m, in, ft. Function terminated"
                    return

            # volumes, masses, weights, centroids
                volumes = []
                masses = []
                centroids = []
                weights = []
                for obj in objectsClosed:
                    vol = rs.SurfaceVolume(obj)[0]
                    volumes.append(vol)
                    mass = density * vol
                    masses.append(mass)
                    weight = mass * massFactor * 9.81  # additionally multiply with "0.001" in case you want Kilonewtons instead of Newtons for weight unit
                    weights.append(weight)
                    centr = rs.SurfaceVolumeCentroid(obj)[0]
                    centroids.append(centr)

                # export data to csv file
                filename = rs.SaveFileName("Save csv file", "*.csv||", None,
                                           "VolMassWeigCen", "csv")
                file = open(filename, 'w')
                headerline = "Object name, Volume(%s), Mass(%s), Weight(N), Centroid(%s)[x], Centroid(%s)[y], Centroid(%s)[z]\n" % (
                    volumeUnits, massUnits, lengthUnits, lengthUnits,
                    lengthUnits)
                file.write(headerline)
                index = 0
                for i in range(len(objectsClosed)):
                    objectName = rs.ObjectName(objectsClosed[i])
                    if not objectName:
                        index += 1
                        objectName = "obj%s" % (index)
                    volu = volumes[i]
                    mas = masses[i]
                    weig = weights[i]
                    x = centroids[i][0]
                    y = centroids[i][1]
                    z = centroids[i][2]
                    line = "%s,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f \n" % (
                        objectName, volu, mas, weig, x, y, z)
                    # adding an annotation text dot to Rhino:
                    rs.AddPoint(centroids[i])
                    rs.AddTextDot(objectName, centroids[i])
                    file.write(line)
                file.close()
                print "Done"

            else:
                print "You did not choose material. Function terminated."
                return

        else:
            print "All of objects you picked are not closed (solids). Function terminated"
            return

    else:
        print "You did not choose appropriate or any objects. Function terminated."
        return
def SelectLayer():
    layername = rs.ListBox(rs.LayerNames(), "Select a layer")
    return layername
コード例 #19
0
def RunCommand(is_interactive):

    register_json_path = os.path.join(compas.APPDATA, "compas_plugins.json")
    register_json = json.load(open(register_json_path))

    selected = rs.ListBox(["Releases", "Dev(conda)"],
                          "Select which source to install")

    if selected == "Releases":

        plugins = [
            path for path in register_json["Plugins"] if os.path.exists(path)
        ]
        location = rs.ListBox(plugins, "Select from which location to install")
        if location:
            # TODO: make this work on mac
            python_path = os.path.join(location, "dev", "env", "python.exe")
            cmd = "%s -m compas_rv2.install --plugin_path %s" % (python_path,
                                                                 location)
            print(cmd)
            stdout, stderr, returncode = run(cmd)
            if returncode == 0:
                print(stdout)
                if "RV2.proxy" in sc.sticky:
                    sc.sticky["RV2.proxy"].shutdown()
                rs.MessageBox("Please restart Rhino to take effect", 0,
                              "Installation Succeed")
            else:
                print(stdout)
                print(stderr)
                rs.MessageBox(stderr, 0, "Installation Failed")

    elif selected == "Dev(conda)":

        print('fetching conda envs....')

        envs = list_envs(show_packages=False)

        if not envs:
            return

        envs_dict = {}
        for env_path in envs:
            if env_path.find('envs') < 0:
                name = 'base'
            else:
                name = os.path.split(env_path)[-1]
            envs_dict[name] = env_path
        options = envs_dict.keys()

        if options:
            selected = rs.ListBox(options, "Select conda env to install")
            if selected:
                env_path = envs_dict[selected]
                python_path = os.path.join(env_path, 'python.exe')
                if not os.path.isfile(python_path):
                    python_path = os.path.join(env_path, 'bin', 'python')
                print(python_path)
                cmd = '%s -m compas_rv2.install --dev' % (python_path)
                stdout, stderr, returncode = run(cmd)
                if returncode == 0:
                    print(stdout)
                    if "RV2.proxy" in sc.sticky:
                        sc.sticky["RV2.proxy"].shutdown()
                    rs.MessageBox("Please restart Rhino to take effect", 0,
                                  "Installation Succeed")
                else:
                    print(stdout)
                    print(stderr)
                    rs.MessageBox(stderr, 0, "Installation Failed")