• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Wiki
  • Script node examples

Script node examples · Изменения

История страницы
Updated Script node examples (markdown) создал Май 06, 2021 по автору Dealga McArdle's avatar Dealga McArdle
Скрыть пробелы
Построчно Рядом
Script-node-examples.md
Просмотреть страницу @e1cd47de
......@@ -12,8 +12,50 @@ The documentation can be found [here](), but it's a bit clinical and will make m
sine petal was the first ever script written in ScriptNodeLite and I think it shows how to setup a node.
```python
"""
in n_petals s default=8 nested=2
in vp_petal s default=10 nested=2
in profile_radius s ;=2.3 n=2
in amp s default=1.0 nested=2
in origin v defautt=(0,0,0) n=2
out verts v
out edges s
"""
from math import sin, cos, radians, pi
from mathutils import Vector, Euler
# create flower
n_verts = n_petals * vp_petal
section_angle = 360.0 / n_verts
position = (2 * (pi / (n_verts / n_petals)))
x, y, z = origin[:3]
Verts = []
Edges = []
for i in range(n_verts):
difference = amp * cos(i * position)
arm = profile_radius + difference
ampline = Vector((arm, 0.0, 0.0))
rad_angle = radians(section_angle * i)
myEuler = Euler((0.0, 0.0, rad_angle), 'XYZ')
ampline.rotate(myEuler)
Verts.append((ampline.x+x, ampline.y+y, 0.0+z))
# makes edge keys, ensure cyclic
if Verts:
i = 0
Edges.extend([[i, i + 1] for i in range(n_verts - 1)])
Edges.append([len(Edges), 0])
verts = [Verts]
edges = [Edges]
```
and here's a `numpy` version of the same script, to show that there's a reason to learn `numpy` if you want to write fast and succinct code.
```python
......
Клонировать репозиторий
  • For Users:
    • Web resources about Sverchok
    • Dependencies and their installation
      • Simple dependencies
      • PIP
        • Side modules
      • SciPy
      • SciKit image
      • Circlify
      • PyMcubes
      • GeomDL
      • FreeCAD
      • Open3D
    • Sverchok for Blender 2.8x Release Notes
    • Sverchok for Blender 2.79 Installation
    • Interface overview
    • Set up GitHub account for exporting node trees from Sverchok
    • Custom Defaults
    • Sverchok Extensions
    • FAQ
  • Examples:
    • Profile Node Examples
    • Script Node Examples
  • For Developers:
    • Install Development version
    • Contributing
      • Git practices
    • Building documentation tarball
    • Macros
    • Sverchok Node Tutorial
      • High-level node howto
      • Details