【发布时间】:2019-05-24 09:07:27
【问题描述】:
使用Grasshopper:如果我将domain 传递给Python 组件,python 会将其视为一个间隔。我可以对其进行操作,如下:
print x
x.Grow(x[0]-y)
x.Grow(x[1]+y)
print x
print type(x)
print dir(x)
哪些打印:
20.3596657850938,87.5596657850938
19.3596657850938,88.5596657850938
<type 'Interval'>
['CompareTo', 'EpsilonEquals', 'Equals', 'FromIntersection', 'FromUnion', 'GetHashCode', 'GetObjectData', 'GetType', 'Grow', 'IncludesInterval', 'IncludesParameter', 'IsDecreasing', 'IsIncreasing', 'IsSingleton', 'IsValid', 'Item', 'Length', 'MakeIncreasing', 'Max', 'MemberwiseClone', 'Mid', 'Min', 'NormalizedIntervalAt', 'NormalizedParameterAt', 'ParameterAt', 'ParameterIntervalAt', 'ReferenceEquals', 'Reverse', 'Swap', 'T0', 'T1', 'ToString', 'Unset', '__add__', '__class__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__rsub__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__sub__', '__subclasshook__']
但是,我不知道如何构建一个新的。它们看起来非常有用,我想更多地使用它们。
我已尝试导入 interval 模块 (Runtime error (ImportException): No module named interval)。我尝试将列表转换为间隔:Interval([1,2]) → Runtime error (UnboundNameException): name 'Interval' is not defined。
不知道区间是属于蟒蛇、铁蟒还是蚱蜢。
如何创建新的间隔?
【问题讨论】:
标签: python ironpython grasshopper