Compare commits

...

2 Commits

Author SHA1 Message Date
oguzhankoral 7921ab1f36 Add direct shape option to components back 2023-12-07 21:22:04 +03:00
oguzhankoral 3f793dc9db Exclude definitions from conversion escape
- Previously we were using definition mappings only for direct shape conversions but now they can live in instances
2023-12-07 21:19:02 +03:00
4 changed files with 12 additions and 3 deletions
@@ -102,12 +102,12 @@ module SpeckleConnector
if source_exist
{
selection: SketchupModel::Reader::MapperReader.entities_schema_details(selection),
mappingMethods: ['New Revit Family', 'Family Instance']
mappingMethods: ['Direct Shape', 'New Revit Family', 'Family Instance']
}.freeze
else
{
selection: SketchupModel::Reader::MapperReader.entities_schema_details(selection),
mappingMethods: ['New Revit Family']
mappingMethods: ['Direct Shape', 'New Revit Family']
}.freeze
end
end
@@ -64,7 +64,8 @@ module SpeckleConnector
def convert(entity, preferences, speckle_state, parent = :base)
convert = method(:convert)
unless SketchupModel::Reader::MapperReader.mapped_with_schema?(entity)
unless SketchupModel::Reader::MapperReader.mapped_with_schema?(entity) &&
!entity.is_a?(Sketchup::ComponentDefinition)
return from_native_to_speckle(entity, preferences, speckle_state, parent, &convert)
end
@@ -89,6 +89,11 @@ module SpeckleConnector
speckle_schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler
.speckle_schema_to_speckle(component_instance)
if speckle_schema.empty?
speckle_schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler
.speckle_schema_to_speckle(component_instance.definition)
end
# transform into global if any path provided
transformation = component_instance.transformation
transformation = SketchupModel::Query::Entity.global_transformation(component_instance, path) if path
@@ -89,6 +89,9 @@ module SpeckleConnector
entity = entity_with_path[0]
path = entity_with_path[1..-1]
method = SPECKLE_SCHEMA_DICTIONARY_HANDLER.get_attribute(entity, 'method')
if entity.is_a?(Sketchup::ComponentInstance) && method.nil?
method = SPECKLE_SCHEMA_DICTIONARY_HANDLER.get_attribute(entity.definition, 'method')
end
if !method.nil? && (method.include?('Floor') || method.include?('Wall')) && entity.is_a?(Sketchup::Face)
global_transformation = QUERY::Entity.global_transformation(entity, path)