<p>该实例中,我们会用VSL来检索和修改数组中的数据。</p>
<h3>
<a name="TOC-1"></a>
概述</h3>
<p>在创建数组时,建议以下参数类型:</p>
<ol>
<li>
Integer</li>
<li>
Float</li>
<li>
String
</li>
<li>Object</li>
<li>
Parameter</li>
</ol>
<p>前面四种类型 - "Integer", "Float", "String" 及 "Object"
-占用的系统内存比"Parameter"类型将近小十倍。仅仅在必需时使用"Parameter"
类型的数组,比如当在Schematic视图和数组单元格间快捷方式时(自动更新数组而不需使用BB)使用。注意:这些这种快捷方式仅仅在从
Schematic视图到数组时会发生,其它方式都不行;你必须从Schematic中复制数据并将快捷方式复制到数组单元格。</p>
<h3>
<a name="TOC-VSL-"></a>
可用的VSL方法</h3>
<h4>
<a name="TOC-2"></a>
检索单元格的值</h4>
<p>
下面是用于从数组中检索数据的方法,及附带的所需参数:<br></p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/Methodes1.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511640199/vsl-virtools/Examples/7_arrays/Methodes1.png" border="0" alt=""></a>
</div>
</div>
<p>
<br><em> GetElement</em>
</p>
<p>
这个方法返回作品中该元素的索引值。然后你需要通过bc的"Get Object"方法从索引值来识别该元素。</p>
<p></p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElement.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511669385/vsl-virtools/Examples/7_arrays/GetElement.png" border="0" alt=""></a>
</div>
</div>
<br><p><br><em>GetElementObject</em>
</p>
<p>这是从由CKObject类实体(二维实体 - 2D entities,三维实体 - 3D entities, 动画 -
animations,等等)组成的数组中检索元素的最简单的方法,它基于行与列索引的详细指定。既然检索值是"object"类型,我们就经常要通
过"Cast"方法来转换类型了。</p>
<div style="text-align: center;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementObject.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511693954/vsl-virtools/Examples/7_arrays/GetElementObject.png" border="0" alt=""></a>
</div>
</div>
<div style="display: block; text-align: left;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementValue.png?attredirects=0"><br></a>
</div>
<p><br><em>GetElementStringValue</em>
</p>
<p>利用这个方法从一个包含字符串类型元素的数组检索字符值。通过使用一个null参数,我们检索所读取字符串的总大小。注意:该大小包含了最后的字符
串"0" -
表示字符串的结束。然后我们通过指定的参数重设字符串的大小。然而在指定大小的时候,"Resize"方法不需要考虑最后的字符串"0",所以我们减掉了
1.</p>
<div style="display: block; text-align: left;">
<div style="display: block; text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementStringValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511710992/vsl-virtools/Examples/7_arrays/GetElementStringValue.png" border="0" alt=""></a>
</div>
</div>
<p></p>
<p>
警告:要避免下面的脚本,"str"类型的使用尽管编译时没有问题,但会产生错误。</p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/WrongGetElementStringValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511730355/vsl-virtools/Examples/7_arrays/WrongGetElementStringValue.png" border="0" alt=""></a>
</div>
</div>
<p></p>
<div style="display: block; text-align: left;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementObject.png?attredirects=0"><br></a>
</div>
<p>
<br><em>GetElementValue</em>
</p>
<p>
这里,我们用"p_Value"变量存储从数组检索的值。这个方法尤其适用于那些包含了非衍生自CKObject类类型(integer, float, matrix, vector等)值的数组。</p>
<div style="text-align: center;">
<div style="display: block;">
<div style="display: block;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511741097/vsl-virtools/Examples/7_arrays/GetElementValue.png" border="0" alt=""></a>
</div>
</div>
</div>
<p></p>
<h4>
<a name="TOC-3"></a>
修改单元格的值</h4>
<p>
如下,我们把用于修改数组中值的VSL方法集合在一起,提示框上可以看到所必要的参数:<br></p>
<div style="text-align: center;">
<div style="display: block;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/Methodes2.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511759729/vsl-virtools/Examples/7_arrays/Methodes2.png" border="0" alt=""></a>
</div>
</div>
<p></p>
<p align="left">注意: "SetElementValueFromParameter" 方法还没在这里出现,将会放在以后的文档中。</p>
<p>
<br><em>SetElementObject</em>
</p>
<p>这是向由CKObject类实体(二维实体 - 2D entities、三维实体 - 3D entities、 动画 - animations、等等)组成的数组中放置元素的最简单的方法,它基于行与列索引的详细指定。</p>
<div style="text-align: center;">
<div style="display: block;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementObject.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511774914/vsl-virtools/Examples/7_arrays/SetElementObject.png" border="0" alt=""></a>
</div>
</div>
<p>
<br><em>SetElementStringValue</em>
</p>
<p>这个方法用于包含字符串的数组,且是基于详细指定行与列索引来用的。</p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementStringValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245546717050/vsl-virtools/Examples/7_arrays/SetElementStringValue.png" border="0" alt=""></a>
</div>
</div>
<br><p>
<br><em>SetElementValue</em>
</p>
<p>
这个方法用来存储那些包含非衍生自CKObject类的类型(如integer、float、matrix、vector等)的数组的值。</p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245546738937/vsl-virtools/Examples/7_arrays/SetElementValue.png" border="0" alt=""></a>
</div>
</div>
<p>
<br>
现在去看看<strong>Virtools Minisite</strong>
中提供的其它更多VSL技术样例吧,在Dev文档目录 /CMOS/TechnicalSamples/VSL/Samples/.
下。</p>
<h3>
<a name="TOC-1"></a>
概述</h3>
<p>在创建数组时,建议以下参数类型:</p>
<ol>
<li>
Integer</li>
<li>
Float</li>
<li>
String
</li>
<li>Object</li>
<li>
Parameter</li>
</ol>
<p>前面四种类型 - "Integer", "Float", "String" 及 "Object"
-占用的系统内存比"Parameter"类型将近小十倍。仅仅在必需时使用"Parameter"
类型的数组,比如当在Schematic视图和数组单元格间快捷方式时(自动更新数组而不需使用BB)使用。注意:这些这种快捷方式仅仅在从
Schematic视图到数组时会发生,其它方式都不行;你必须从Schematic中复制数据并将快捷方式复制到数组单元格。</p>
<h3>
<a name="TOC-VSL-"></a>
可用的VSL方法</h3>
<h4>
<a name="TOC-2"></a>
检索单元格的值</h4>
<p>
下面是用于从数组中检索数据的方法,及附带的所需参数:<br></p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/Methodes1.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511640199/vsl-virtools/Examples/7_arrays/Methodes1.png" border="0" alt=""></a>
</div>
</div>
<p>
<br><em> GetElement</em>
</p>
<p>
这个方法返回作品中该元素的索引值。然后你需要通过bc的"Get Object"方法从索引值来识别该元素。</p>
<p></p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElement.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511669385/vsl-virtools/Examples/7_arrays/GetElement.png" border="0" alt=""></a>
</div>
</div>
<br><p><br><em>GetElementObject</em>
</p>
<p>这是从由CKObject类实体(二维实体 - 2D entities,三维实体 - 3D entities, 动画 -
animations,等等)组成的数组中检索元素的最简单的方法,它基于行与列索引的详细指定。既然检索值是"object"类型,我们就经常要通
过"Cast"方法来转换类型了。</p>
<div style="text-align: center;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementObject.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511693954/vsl-virtools/Examples/7_arrays/GetElementObject.png" border="0" alt=""></a>
</div>
</div>
<div style="display: block; text-align: left;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementValue.png?attredirects=0"><br></a>
</div>
<p><br><em>GetElementStringValue</em>
</p>
<p>利用这个方法从一个包含字符串类型元素的数组检索字符值。通过使用一个null参数,我们检索所读取字符串的总大小。注意:该大小包含了最后的字符
串"0" -
表示字符串的结束。然后我们通过指定的参数重设字符串的大小。然而在指定大小的时候,"Resize"方法不需要考虑最后的字符串"0",所以我们减掉了
1.</p>
<div style="display: block; text-align: left;">
<div style="display: block; text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementStringValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511710992/vsl-virtools/Examples/7_arrays/GetElementStringValue.png" border="0" alt=""></a>
</div>
</div>
<p></p>
<p>
警告:要避免下面的脚本,"str"类型的使用尽管编译时没有问题,但会产生错误。</p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/WrongGetElementStringValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511730355/vsl-virtools/Examples/7_arrays/WrongGetElementStringValue.png" border="0" alt=""></a>
</div>
</div>
<p></p>
<div style="display: block; text-align: left;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementObject.png?attredirects=0"><br></a>
</div>
<p>
<br><em>GetElementValue</em>
</p>
<p>
这里,我们用"p_Value"变量存储从数组检索的值。这个方法尤其适用于那些包含了非衍生自CKObject类类型(integer, float, matrix, vector等)值的数组。</p>
<div style="text-align: center;">
<div style="display: block;">
<div style="display: block;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/GetElementValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511741097/vsl-virtools/Examples/7_arrays/GetElementValue.png" border="0" alt=""></a>
</div>
</div>
</div>
<p></p>
<h4>
<a name="TOC-3"></a>
修改单元格的值</h4>
<p>
如下,我们把用于修改数组中值的VSL方法集合在一起,提示框上可以看到所必要的参数:<br></p>
<div style="text-align: center;">
<div style="display: block;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/Methodes2.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511759729/vsl-virtools/Examples/7_arrays/Methodes2.png" border="0" alt=""></a>
</div>
</div>
<p></p>
<p align="left">注意: "SetElementValueFromParameter" 方法还没在这里出现,将会放在以后的文档中。</p>
<p>
<br><em>SetElementObject</em>
</p>
<p>这是向由CKObject类实体(二维实体 - 2D entities、三维实体 - 3D entities、 动画 - animations、等等)组成的数组中放置元素的最简单的方法,它基于行与列索引的详细指定。</p>
<div style="text-align: center;">
<div style="display: block;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementObject.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245511774914/vsl-virtools/Examples/7_arrays/SetElementObject.png" border="0" alt=""></a>
</div>
</div>
<p>
<br><em>SetElementStringValue</em>
</p>
<p>这个方法用于包含字符串的数组,且是基于详细指定行与列索引来用的。</p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementStringValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245546717050/vsl-virtools/Examples/7_arrays/SetElementStringValue.png" border="0" alt=""></a>
</div>
</div>
<br><p>
<br><em>SetElementValue</em>
</p>
<p>
这个方法用来存储那些包含非衍生自CKObject类的类型(如integer、float、matrix、vector等)的数组的值。</p>
<div style="display: block; text-align: left;">
<div style="text-align: center;">
<a href="https://sites.google.com/site/x3dofcn/vsl-virtools/Examples/7_arrays/SetElementValue.png?attredirects=0"><img src="https://sites.google.com/site/x3dofcn/_/rsrc/1245546738937/vsl-virtools/Examples/7_arrays/SetElementValue.png" border="0" alt=""></a>
</div>
</div>
<p>
<br>
现在去看看<strong>Virtools Minisite</strong>
中提供的其它更多VSL技术样例吧,在Dev文档目录 /CMOS/TechnicalSamples/VSL/Samples/.
下。</p>