Skip to content

Instantly share code, notes, and snippets.

View jhorikawa's full-sized avatar

Junichiro Horikawa jhorikawa

View GitHub Profile
@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 / 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 / packobjectsbydistance.cs
Last active March 22, 2019 08:45
Pack objects by objects' distance in Grasshopper. (C#)
private void RunScript(List<Point3d> pts, List<object> objs, double thresh, ref object A, ref object B)
{
DataTree<object> tree = new DataTree<object>();
List<int> usedList = new List<int>();
List<Point3d> centers = new List<Point3d>();
for(int i = 0; i < pts.Count; i++){
var pt1 = pts[i];
if(!usedList.Contains(i)){
GH_Path path = new GH_Path(i);
tree.Add(objs[i], path);
@jhorikawa
jhorikawa / netflix_brightness.js
Created May 7, 2019 13:14
Increase brightness of the video of Netflix by typing code on web browser's console.
$("video").setAttribute("style", $("video").getAttribute("style") + "filter: brightness(200%);");
@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 / autolayout.json
Created August 18, 2019 04:06
JSON file for auto-layout.
{
"room_requisites" :
[
{
"id" : 0,
"name" : "dining",
"type" : "social",
"min_width" : 3.0,
"max_width" : 30.0,
"min_length" : 3.0,
@jhorikawa
jhorikawa / nodeLabeling
Last active September 9, 2019 14:24
VEX script for node labeling with numbering image.
import hou
items = hou.selectedItems()
editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
images = list(editor.backgroundImages())
for item in items:
if isinstance(item, hou.NetworkBox):
nodes = item.nodes()
nodes = hou.sortedNodes(nodes)
for i in range(len(nodes)):
node = nodes[i]
import hou
import time
import os
editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
dir = os.path.dirname(hou.hipFile.path())
items = hou.selectedItems()
editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
for item in items:
import hou
import os
items = hou.selectedItems()
editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
dir = os.path.dirname(hou.hipFile.path())
file = open(dir + '/params.txt', 'a')
for item in items:
seps = item.comment().split('-')
if len(seps) == 2 and seps[1] == "1":
file.write('== '+seps[0]+'\n\n')
@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