Skip to content

Instantly share code, notes, and snippets.

@shspage
shspage / 1_example_mxi_for_aip.md
Last active Apr 4, 2022
Illustrator用プラグインからzxpを作成する例
View 1_example_mxi_for_aip.md

Illustrator用プラグインからzxpを作成する例

ディレクトリ構造

  • anchorGrabber
    • anchorGrabber.mxi
    • mac
      • anchorGrabber.aip

zxp生成コマンドはHTML拡張からzxpを作成する場合と同じ

View sketch_dec-31-2020_18-20-11.glisp.glisp
;; grid specification
(def interval 40)
(def nlines 10)
(transform [1 0 0 1
(* nlines interval -0.5)
(* nlines interval -0.5)]
;; circles as controller
(def cs [
View sketch_dec-31-2020_09-23-57.glisp.glisp
;; grid specification
(def interval 40)
(def nlines 10)
(transform [1 0 0 1
(* nlines interval -0.5)
(* nlines interval -0.5)]
;; circles as controller
(def cs [
View blender_set_verts_anim_study.py
import bpy
import math
import numpy as np
from time import time
# 参考:
# https://blender.stackexchange.com/questions/190547/mesh-edges-foreach-set-doesnt-update
bpy.app.handlers.frame_change_pre.clear()
bpy.app.handlers.frame_change_post.clear()
@shspage
shspage / blender_smooth_surface_study.py
Last active Dec 19, 2020
いびつな面をなめらかにするテスト
View blender_smooth_surface_study.py
import bpy
import numpy as np
from scipy.interpolate import Rbf
def getGridEdgeIndices(polys):
"""Gets the index of the vertices on the outer edge"""
idxs = []
for poly in polys:
idxs.extend([x for x in poly.vertices])
idxs, counts = np.unique(idxs, return_counts=1)
@shspage
shspage / blender_interpolate_study.py
Last active Dec 18, 2020
グリッド上の選択点を元に曲面を補完するテスト
View blender_interpolate_study.py
import bpy
import numpy as np
from scipy.interpolate import griddata
def func():
bpy.ops.object.mode_set(mode='OBJECT')
grid = bpy.data.objects['Grid']
vs = grid.data.vertices
points = []
View simple_delaunay_refinement_3d_for_blender.py
import bpy
import numpy as np
from scipy.spatial import ConvexHull
MAX_ITERATION = 10
MAX_ERROR_SQUARED = 1e-4
NUM_POINTS = 400
RADIUS = 10 # 球の半径
points = np.random.randn(3, NUM_POINTS)
@shspage
shspage / sketch_dec-06-2020_20-44-19.glisp.glisp
Last active Dec 17, 2020
gilsp( https://github.com/baku89/glisp ) 用スクリプトです。多角形をUIとして使う習作
View sketch_dec-06-2020_20-44-19.glisp.glisp
; controllers
(def G0 (ngon [1 1.8125] 137 11))
(def G1 (ngon [3 0.8125] 106 7))
(def G2 (ngon [9 -4.1875] 74 8))
(def G3 (ngon [8 -1.1875] 46 5))
; coordinates of the nth vertex
(defn fv [s n] (nth s (inc n)))
; number of vertices
(defn fc [s] (dec (count s)))
View sketch_dec-03-2020_21-03-24.glisp,shspage.glisp
(def spiral_radius 30)
(def interval 1.2)
(def arc_angle (deg 80))
(defn prepare [tr t r]
(if (> r spiral_radius)
tr
(let [t1 (+ t (atan2 interval r))
r1 (+ r (/ interval t1))]
(prepare (conj tr t1 r1) t1 r1))))