function: Return one of instance from array


 This function return one of instance from array. If there are multiple set of instance in array, return multiple object.

 配列内のオブジェクトのインスタンス関係を調べ、インスタンス関係にあるオブジェクトのうち1つを代表として返す関数。 インスタンス関係にあるオブジェクトの組みが複数の場合、複数のオブジェクトを返します。

-- FUNCTION check relationship of objects in array, sampling instance
fn extract_instance_one obj_array = (
 local i = 1 --Initialize
 
 while i <= obj_array.count do(
  local j = i + 1 --Initialize
  
  while j <= obj_array.count do(
   if areNodesInstances obj_array[i] obj_array[j] == true then( 
    deleteItem obj_array j 
   )else(
    j = j + 1 --Update j
   )
   print("a count is " + obj_array.count as string)
  )
  print("Loop count  " + i as string)
  i = i + 1 --Update i
 )
 return obj_array
)


--using example: extract one of instance from selection
a = selection as array
select (extract_instance_one a)


0 コメント: