Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e278042c8 |
@@ -151,16 +151,16 @@ module SpeckleConnector
|
||||
return speckle_state, mesh
|
||||
end
|
||||
|
||||
if entity.is_a?(Sketchup::Group)
|
||||
new_speckle_state, block_instance = SpeckleObjects::Other::BlockInstance.from_group(
|
||||
entity, @units, preferences, speckle_state, &convert
|
||||
)
|
||||
speckle_state = new_speckle_state
|
||||
add_to_report(entity, block_instance)
|
||||
return speckle_state, block_instance
|
||||
end
|
||||
# if entity.is_a?(Sketchup::Group)
|
||||
# new_speckle_state, block_instance = SpeckleObjects::Other::BlockInstance.from_group(
|
||||
# entity, @units, preferences, speckle_state, &convert
|
||||
# )
|
||||
# speckle_state = new_speckle_state
|
||||
# add_to_report(entity, block_instance)
|
||||
# return speckle_state, block_instance
|
||||
# end
|
||||
|
||||
if entity.is_a?(Sketchup::ComponentInstance)
|
||||
if entity.is_a?(Sketchup::ComponentInstance) || entity.is_a?(Sketchup::Group)
|
||||
proxy = unpacked_entities.instance_proxies[entity.persistent_id.to_s]
|
||||
add_to_report(entity, proxy)
|
||||
return speckle_state, proxy
|
||||
|
||||
@@ -51,6 +51,7 @@ module SpeckleConnector
|
||||
SpeckleObjects::Other::Transform.from_transformation(entity.transformation, @units).value,
|
||||
depth,
|
||||
@units,
|
||||
entity.is_a?(Sketchup::Group),
|
||||
application_id: instance_id
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ module SpeckleConnector
|
||||
module SpeckleObjects
|
||||
class InstanceProxy < Base
|
||||
SPECKLE_TYPE = SPECKLE_CORE_MODELS_INSTANCES_INSTANCE_PROXY
|
||||
def initialize(definition_id, transform, max_depth, units, application_id: nil)
|
||||
def initialize(definition_id, transform, max_depth, units, is_sketchup_group, application_id: nil)
|
||||
super(
|
||||
speckle_type: SPECKLE_TYPE,
|
||||
total_children_count: 0,
|
||||
@@ -19,16 +19,25 @@ module SpeckleConnector
|
||||
self[:definitionId] = definition_id
|
||||
self[:maxDepth] = max_depth
|
||||
self[:transform] = transform
|
||||
self[:isSketchupGroup] = is_sketchup_group
|
||||
end
|
||||
|
||||
# @param entities [Sketchup::Entities]
|
||||
def self.to_native(state, instance_proxy, layer, entities, definition_proxies, &_convert_to_native)
|
||||
definition_id = instance_proxy['definitionId']
|
||||
is_sketchup_group = instance_proxy['isSketchupGroup']
|
||||
proxy_transform = instance_proxy['transform']
|
||||
transform = Other::Transform.to_native(proxy_transform, instance_proxy['units'])
|
||||
definition = definition_proxies[definition_id].definition
|
||||
instance = entities.add_instance(definition, transform)
|
||||
instance.layer = layer if layer # TODO: CONVERTER_V2 check
|
||||
# TODO: CONVERTER_V2 handle groups
|
||||
instance = if is_sketchup_group
|
||||
# rubocop:disable SketchupSuggestions/AddGroup
|
||||
definition.entities.to_a.any? ? entities.add_group : entities.add_group(definition.entities.to_a)
|
||||
# rubocop:enable SketchupSuggestions/AddGroup
|
||||
else
|
||||
entities.add_instance(definition, transform)
|
||||
end
|
||||
instance.layer = layer if layer
|
||||
instance.transformation = transform if is_sketchup_group # Transform already applied to instance unless is group
|
||||
return state, [instance, definition]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user