Skip to content

Instantly share code, notes, and snippets.

View jhorikawa's full-sized avatar

Junichiro Horikawa jhorikawa

View GitHub Profile
@jhorikawa
jhorikawa / batchexport.py
Created March 22, 2019 08:38
Batch export objects from layer to FBX using Rhino Python.
import rhinoscriptsyntax as rs
for i in range(3):
for n in range(8):
for t in range(2):
name = 'model'+str(i)+'_'+str(n)+'_'+str(t)
ids = rs.ObjectsByLayer(name)
rs.UnselectAllObjects()
rs.SelectObjects(ids)
@jhorikawa
jhorikawa / Tracing.jsx
Last active November 3, 2018 15:37
Illustrator javascript to open image for image tracing.
var folderPath = "~/Desktop";
var fileName = "scanned.png";
var saveName = "scanned.svg";
var filePath = new File(folderPath + fileName);
open(filePath);
var rItems = activeDocument.rasterItems;
for(var i = 0; i<rItems.length; i++){
@jhorikawa
jhorikawa / ParameterController.cs
Created April 23, 2018 17:39
Unity C# script to control digital asset from Houdini on runtime (only on Unity Editor) using Houdini Engine.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParameterController : MonoBehaviour {
private HoudiniApiAssetAccessor myAsset;
public GameObject digitalAssetObject;
// Use this for initialization
@jhorikawa
jhorikawa / GearGH.cs
Created February 23, 2018 16:48
Grasshopper C# component script for gear simulation.
public class Script_Instance : GH_ScriptInstance
{
#region Utility functions
/// <summary>Print a String to the [Out] Parameter of the Script component.</summary>
/// <param name="text">String to print.</param>
private void Print(string text) { /* Implementation hidden. */ }
/// <summary>Print a formatted String to the [Out] Parameter of the Script component.</summary>
/// <param name="format">String format.</param>
/// <param name="args">Formatting parameters.</param>
private void Print(string format, params object[] args) { /* Implementation hidden. */ }
@jhorikawa
jhorikawa / Follow.cs
Created January 26, 2018 23:01
Unity script for object to follow mouse position. https://youtu.be/sa8tlx9tD-w
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Follow : MonoBehaviour {
public Material characterMarkerMat;
// Use this for initialization
void Start () {
@jhorikawa
jhorikawa / Scanner.cs
Created January 22, 2018 17:27
Unity script for document scanning using OpenCVForUnity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using OpenCVForUnity;
public class Scanner : MonoBehaviour {
public Texture2D baseTexture;
public RawImage sourceRawImage;
public RawImage targetRawImage;
@jhorikawa
jhorikawa / Bubble.cs
Created January 20, 2018 20:32
Unity 2018 Shader Graph Intro / Bubble shader scripts.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bubble : MonoBehaviour {
// Use this for initialization
void Start () {
}
@jhorikawa
jhorikawa / VertexColor.shader
Created January 15, 2018 18:39
Unity Shader to visualize vertex color.
Shader "Custom/VertexColor" {
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
#pragma target 3.0
struct Input {
@jhorikawa
jhorikawa / TableDesigner.cs
Created December 23, 2017 01:27
Unity + Archimatix Pro でリアルタイム・パラメトリック・デザイン ref: https://qiita.com/jhorikawa_err/items/c925dfe61187239e1242
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AX;
public class TableDesigner : MonoBehaviour {
public AXModel model;
public AXParameter p_radius;
public AXParameter p_height;
@jhorikawa
jhorikawa / PDFTest.cs
Last active December 12, 2017 08:38
UnityでiTextSharpを使ってPDFを作成する ref: https://qiita.com/jhorikawa_err/items/c50eb9d334f6f4252faf
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
using System;
public class PDFTest : MonoBehaviour {