Array Points on Surface
程序员文章站
2022-03-02 09:41:12
...
# Creates an array of points on a surface
import rhinoscriptsyntax as rs
def ArrayPointsOnSurface():
# Get the surface object
surface_id = rs.GetObject("Select surface", rs.filter.surface)
if surface_id is None: return
# Get the number of rows
rows = rs.GetInteger("Number of rows", 2, 2)
if rows is None: return
# Get the number of columns
columns = rs.GetInteger("Number of columns", 2, 2)
if columns is None: return
# Get the domain of the surface
U = rs.SurfaceDomain(surface_id, 0)
V = rs.SurfaceDomain(surface_id, 1)
if U is None or V is None: return
# Add the points
for i in xrange(0,rows):
param0 = U[0] + (((U[1] - U[0]) / (rows-1)) * i)
for j in xrange(0,columns):
param1 = V[0] + (((V[1] - V[0]) / (columns-1)) * j)
point = rs.EvaluateSurface(surface_id, param0, param1)
rs.AddPoint(point)
# Check to see if this file is being executed as the "main" python
# script instead of being used as a module by some other python script
# This allows us to use the module which ever way we want.
if __name__ == "__main__":
# call the function defined above
ArrayPointsOnSurface()
推荐阅读
-
遭遇php的in_array低性能问题_php技巧
-
Implicit super constructor Array() is undefined for default constructor. Must define an explicit constructor
-
把array分离两部分
-
PHP:empty,isset,is_null,array(零),array(),array(""),0,"0""""null"NULL的总结
-
自己写的兼容低于PHP 5.5版本的array_column()函数_php技巧
-
Python—Numpy学习笔记(二)array的用法
-
leetcode 442. Find All Duplicates in an Array
-
array_search()函数,第3个参数,有什么功用
-
call_user_func_array()函数定义与用法汇总
-
javascript中的array数组使用技巧_基础知识