Skip to content

Instantly share code, notes, and snippets.

View stephensmitchell's full-sized avatar
🎯
Focusing

Stephen S. Mitchell stephensmitchell

🎯
Focusing
View GitHub Profile
@stephensmitchell
stephensmitchell / Command.fs
Created March 3, 2023 09:51 — forked from pzurek/Command.fs
A quick F# example for Revit
namespace FSharpPanelBuilder
open System
open System.Collections.Generic
open Autodesk.Revit
open Autodesk.Revit.UI
open Autodesk.Revit.Attributes
open Autodesk.Revit.DB
open Autodesk.Revit.UI.Selection
namespace Tsunami.Server
open System
open System.IO
open System.Linq
open System.Net
open System.Net.Sockets
open System.Text
open System.Threading
open System.Runtime.Serialization
// Based on the SDK Sampl GeometryCreation_BooleanOperations
// This is testing code. Many improvements can be made before use in real work
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitDBAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPIUI.dll"
#r @"C:\Program Files\Mantis\Tsunami.IDEDesktop.dll"
open Autodesk.Revit
open Autodesk.Revit.UI
@stephensmitchell
stephensmitchell / Scenes.cs
Created November 30, 2022 21:13 — forked from bma73/Scenes.cs
Unity3D: Editor window which lists all scenes avaible in the current project and loads them by clicking on the according button.
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Collections.Generic;
public class Scenes : EditorWindow
{
[MenuItem("Window/Scenes...", false)]
public static void ShowWindow ()
{
@stephensmitchell
stephensmitchell / Edit Light Properties Rhino
Created August 4, 2022 18:39 — forked from fraguada/Edit Light Properties Rhino
Small example method to edit Rhino light properties
private void RunScript(Guid id, Color col, double pow, ref object A)
{
Rhino.DocObjects.ObjRef obj = new Rhino.DocObjects.ObjRef(id);
Rhino.DocObjects.LightObject lobj = obj.Object() as Rhino.DocObjects.LightObject;
lobj.LightGeometry.Diffuse = col;
lobj.LightGeometry.Intensity = pow;
lobj.CommitChanges();
}
@stephensmitchell
stephensmitchell / chat-frontend.js
Created June 26, 2022 01:10 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@stephensmitchell
stephensmitchell / shell.ipynb
Created April 15, 2022 16:10 — forked from nikhilkumarsingh/shell.ipynb
Running shell commands using Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stephensmitchell
stephensmitchell / recover-scene.py
Created March 20, 2022 06:12
This script imports a Cinema 4D scenefile and disables all deformers, generators and expressions. This is useful if the scene was saved at a state it is unrecoverable because of an issue while scripting (eg. saved the scene before a Python tag was executed, but now that Python tag always runs in an # infinite loop).
# Copyright (c) 2013, Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@stephensmitchell
stephensmitchell / gist:02ef135a65c7e586ae3653e81e7079db
Last active October 18, 2021 06:23 — forked from sbaer/gist:1023456
Get world points from mouse cursor position
import scriptcontext
import time
import System
import Rhino
rc, view = Rhino.Input.RhinoGet.GetView("select view")
print "position mouse where you want"
for i in [5,4,3,2,1]:
@stephensmitchell
stephensmitchell / App.svelte
Created October 6, 2021 02:16 — forked from jasonsturges/App.svelte
3D with Svelte and Three.js
<script>
import { onMount } from 'svelte';
import { createScene } from "./scene";
let el;
onMount(() => {
createScene(el)
});
</script>