lib/measures/tbd/resources/psi.rb
##
# Populate collection of TBD "kids", i.e. subsurfaces, relying on Topolys. As
# a side effect, it will - if successful - also populate the Topolys
# model with Topolys vertices, wires, holes.
#
# @param [Topolys::Model] model A Topolys model
# @param [Hash] kids A collection of TBD subsurfaces
#
# @return [Array] Returns a 1D array of 3D Topolys holes, i.e. wires
Populate collection of TBD "kids", i.e. subsurfaces, relying on Topolys. As
a side effect, it will - if successful - also populate the Topolys
model with Topolys vertices, wires, holes.
Populate collection of TBD " kids " i . e . subsurfaces relying on Topolys . As a side effect it will - if successful - also populate the Topolys model with Topolys vertices wires holes .
def populateTBDkids(model, kids)
  holes = []
  unless model && kids
    TBD.log(TBD::DEBUG,
      "Invalid TBD (kids) arguments - skipping")
    return holes
  end
  unless model.is_a?(Topolys::Model)
    TBD.log(TBD::DEBUG,
      "#{model.class}? expected Topolys model (kids) - skipping")
    return holes
  end
  unless kids.is_a?(Hash)
    TBD.log(TBD::DEBUG,
      "#{kids.class}? expected surface Hash (kids) - skipping")
    return holes
  end
  kids.each do |id, properties|
    vtx, hole = topolysObjects(model, properties[:points])
    if vtx && hole
      hole.attributes[:id] = id
      hole.attributes[:n] = properties[:n] if properties.has_key?(:n)
      properties[:hole] = hole
      holes << hole
    end
  end
  holes
end
def populateTBDkids ( model , kids ) holes = [ ] unless model && kids TBD . log ( TBD :: DEBUG , "Invalid TBD (kids) arguments - skipping" ) return holes end unless model . is_a? ( Topolys :: Model ) TBD . log ( TBD :: DEBUG , "#{model.class}? expected Topolys model (kids) - skipping" ) return holes end unless kids . is_a? ( Hash ) TBD . log ( TBD :: DEBUG , "#{kids.class}? expected surface Hash (kids) - skipping" ) return holes end kids . each do | id , properties | vtx , hole = topolysObjects ( model , properties [ :points ] ) if vtx && hole hole . attributes [ :id ] = id hole . attributes [ :n ] = properties [ :n ] if properties . has_key? ( :n ) properties [ :hole ] = hole holes << hole end end holes end
Populate collection of TBD "kids", i.e.
Populate collection of TBD " kids " i . e .
Returns a 1D array of 3D Topolys holes, i.e. wires
Returns a 1D array of 3D Topolys holes i . e . wires
Array
model
kids
kids A collection of TBD subsurfaces
kids A collection of TBD subsurfaces