speckle_connector/converter/to_speckle.rb
def component_definition_to_speckle(definition)
    guid = definition.guid
    return @component_defs[guid] if @component_defs.key?(guid)

    speckle_def = {
      speckle_type: "Objects.Other.BlockDefinition",
      applicationId: guid,
      units: @units,
      name: definition.name,
      # i think the base point is always the origin?
      basePoint: speckle_point,
      "@geometry" => if %w[Edge Face].include?(definition.entities[0].typename)
                       group_mesh_to_speckle(definition)
                     else
                       definition.entities.map { |entity| convert_to_speckle(entity) }
                     end
    }
    @component_defs[guid] = speckle_def
  end
# covnert a component definition to a speckle block definition
covnert a component definition to a speckle block definition
covnert a component definition to a speckle block definition
def component_definition_to_speckle(definition)
    guid = definition.guid
    return @component_defs[guid] if @component_defs.key?(guid)
    speckle_def = {
      speckle_type: "Objects.Other.BlockDefinition",
      applicationId: guid,
      units: @units,
      name: definition.name,
      basePoint: speckle_point,
      "@geometry" => if %w[Edge Face].include?(definition.entities[0].typename)
                       group_mesh_to_speckle(definition)
                     else
                       definition.entities.map { |entity| convert_to_speckle(entity) }
                     end
    }
    @component_defs[guid] = speckle_def
  end
def component_definition_to_speckle ( definition ) guid = definition . guid return @component_defs [ guid ] if @component_defs . key? ( guid ) speckle_def = { speckle_type : "Objects.Other.BlockDefinition" , applicationId : guid , units : @units , name : definition . name , basePoint : speckle_point , "@geometry" => if %w[ Edge Face ] . include? ( definition . entities [ 0 ] . typename ) group_mesh_to_speckle ( definition ) else definition . entities . map { | entity | convert_to_speckle ( entity ) } end } @component_defs [ guid ] = speckle_def end
covnert a component definition to a speckle block definition
covnert a component definition to a speckle block definition
# i think the base point is always the origin?
definition