speckle_connector/converter/to_native.rb
# finds or creates a component definition from the geometry and the given name
finds or creates a component definition from the geometry and the given name
finds or creates a component definition from the geometry and the given name
def component_definition_to_native(geometry, name, application_id = "")
    definition = Sketchup.active_model.definitions[name]
    return definition if definition && (definition.name == name || definition.guid == application_id)
    definition&.entities&.clear!
    definition ||= Sketchup.active_model.definitions.add(name)
    geometry.each { |obj| convert_to_native(obj, definition.entities) }
    puts("definition finished: #{name} (#{application_id})")
    definition
  end
def component_definition_to_native ( geometry , name , application_id = "" ) definition = Sketchup . active_model . definitions [ name ] return definition if definition && ( definition . name == name || definition . guid == application_id ) definition &. entities &. clear! definition ||= Sketchup . active_model . definitions . add ( name ) geometry . each { | obj | convert_to_native ( obj , definition . entities ) } puts ( "definition finished: #{name} (#{application_id})" ) definition end
finds or creates a component definition from the geometry and the given name
finds or creates a component definition from the geometry and the given name
# puts("    entity count: #{definition.entities.count}")
geometry
name
application_id