Skip to content

Instantly share code, notes, and snippets.

Steve Baer sbaer

Block or report user

Report or block sbaer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rhino3dm.d.ts
declare module 'rhino3dm' {
enum ActiveSpace {
None,
ModelSpace,
PageSpace
}
enum ComponentIndexType {
InvalidType,
@sbaer
sbaer / nurbscurve.json
Last active Aug 10, 2019
NURBS Curve as JSON
View nurbscurve.json
[{"version": 10000, "archive3dm": 60, "opennurbs": -1942458756, "data": "+n8CAP0BAAAAAAAA+/8CABQAAAAAAAAA3dTXTkfp0xG/5QAQgwEi8BDyeHD8/wIAxQEAAAAAAAAQAwAAAAEAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAA8D8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA8L8AAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifk/GC1EVPshCUAYLURU+yEJQNIhM3982RJA0iEzf3zZEkAYLURU+yEZQBgtRFT7IRlACQAAAAAAAAAAAChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPA/2WzfzHb4IEDZbN/MdvggQAAAAAAAAAAAzDt/Zp6g5j8AAAAAAAAAAAAAAAAAAChAAAAAAAAAAAAAAAAAAADwP9ls38x2+CDA2WzfzHb4IEAAAAAAAAAAAMw7f2aeoOY/AAAAAAAAKMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8D/ZbN/MdvggwNls38x2+CDAAAAAAAAAAADMO39mnqDmPwAAAAAAAAAAAAAAAAAAKMAAAAAAAAAAAAAAAAAAAPA/2WzfzHb4IEDZbN/MdvggwAAAAAAAAAAAzDt/Zp6g5j8AAAAAAAAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwP04BQN3/fwKAAAAAAAAAAAA="}]
View lotta_lines.py
import Rhino
import scriptcontext
import time
import math
start = time.clock()
for i in xrange(600000):
line = Rhino.Geometry.Line(0,0,0,math.sin(i),math.cos(i),0)
scriptcontext.doc.Objects.AddLine(line)
end = time.clock()
View block_piece_select.py
import rhinoscriptsyntax as rs
import Rhino
def ModifyInstancePiece():
rs.UnselectAllObjects()
go = Rhino.Input.Custom.GetObject()
go.SubObjectSelect = True
go.Get()
if go.CommandResult() != Rhino.Commands.Result.Success:
return
@sbaer
sbaer / subdvertex.cs
Created Aug 21, 2015
SubDVertex ideas
View subdvertex.cs
struct SubDVertex
{
SubD m_parent;
IntPtr m_ptr_vertex; // ON_SubDVertex* vertex
uint m_parent_sn;
ComponentIndex m_component_index;
internal SubDVertex(SubD subd, IntPtr ptr_vertex, ComponentIndex ci, Point3d location)
{
m_parent = subd;
@sbaer
sbaer / gist:ec31b428c9be49b06e00
Last active Aug 29, 2015
CreatePlugIn function
View gist:ec31b428c9be49b06e00
public static PlugIn CreatePlugIn(Type pluginType, bool printDebugMessages)
{
if (null == pluginType || !typeof(PlugIn).IsAssignableFrom(pluginType))
return null;
InitializeRhinoCommon();
// If we turn on debug messages, we always get debug output
if (printDebugMessages)
SendDebugToCommandLine = true;
@sbaer
sbaer / gist:d3b6660697812b444ead
Created Jun 19, 2015
Use OpenGL in Display Conduit
View gist:d3b6660697812b444ead
[CommandStyle(Style.Hidden)]
public class TestOpenGlCallCommand : Command
{
public override string EnglishName { get { return "TestGlCall"; } }
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
m_conduit.Enabled = !m_conduit.Enabled;
doc.Views.Redraw();
return Result.Success;
}
@sbaer
sbaer / monobuild.py
Created Oct 31, 2014
post build fie rename for RhinoCommon builds
View monobuild.py
"""
Post-Build script for RhinoCommon plug-in projects.
Make sure this file is in the same directory as your plug-in
project. In Xamarin Studio under project properties, add the following
to Custom Commands->After Build
python monobuild.py ${TargetFile}
Also make sure to set your project's build output to build to the MacPlugIns
directory
ex.
/Users/steve/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/HelloMonoPlugIn
@sbaer
sbaer / gist:b2ff6de6eda8b6d0a814
Last active Jun 24, 2016
Sample use of Eto and Rhino
View gist:b2ff6de6eda8b6d0a814
using System;
using Eto.Forms;
using Eto.Drawing;
using Eto;
using System.Collections.Generic;
namespace EtoRhinoTests
{
public class EtoRhinoCommand : Rhino.Commands.Command
{
@sbaer
sbaer / gist:7938220
Created Dec 13, 2013
packing arguments as tuples and then unpacking them in the parallel function
View gist:7938220
import ghpythonlib.components as ghcomp
import ghpythonlib.parallel
#custom function that is executed by parallel.run
def slice_at_angle(args):
brep, plane = args #unpack input
result = ghcomp.BrepXPlane(brep, plane)
if result: return result.curves
if parallel:
You can’t perform that action at this time.