Compare commits
34 Commits
2.15.0-rc5
...
2.16.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 97309ebb88 | |||
| 556ddc0b6f | |||
| a0dde690ea | |||
| a76dab5be6 | |||
| 2d10bc5bbf | |||
| 4042632e0b | |||
| 7ccf83e1a4 | |||
| 019cd0756f | |||
| 0e5f9f80be | |||
| fc6767860a | |||
| 5b5b4be7b2 | |||
| 45351d082e | |||
| 22ccd07491 | |||
| 2cf9ee647b | |||
| efb567824b | |||
| f0aac39486 | |||
| f278055805 | |||
| 6f2e36fd11 | |||
| 119d80ffc8 | |||
| 771c3df864 | |||
| 7d1963e458 | |||
| dde85972b3 | |||
| 5e061da910 | |||
| 46bea345de | |||
| bc53462ad6 | |||
| 884df40a1d | |||
| b23168c067 | |||
| 5568212f15 | |||
| 79db79d799 | |||
| 18a4008efd | |||
| 83e4abd1ee | |||
| 243bcfba72 | |||
| e7f641046b | |||
| 9aaabe0fab |
+116
-2
@@ -76,6 +76,99 @@ jobs:
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers
|
||||
|
||||
build-connector-mac:
|
||||
macos:
|
||||
xcode: 12.5.1
|
||||
parameters:
|
||||
projname:
|
||||
type: string
|
||||
default: ""
|
||||
slug:
|
||||
type: string
|
||||
default: ""
|
||||
installer:
|
||||
type: boolean
|
||||
default: false
|
||||
converter-files:
|
||||
type: string
|
||||
default: ""
|
||||
installername:
|
||||
type: string
|
||||
default: ""
|
||||
build-config:
|
||||
type: string
|
||||
default: Release
|
||||
bundlename:
|
||||
type: string
|
||||
default: ""
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run:
|
||||
name: Install dotnet
|
||||
command: |
|
||||
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel Current
|
||||
|
||||
$HOME/.dotnet/dotnet --version
|
||||
$HOME/.dotnet/dotnet --list-runtimes
|
||||
$HOME/.dotnet/dotnet --list-sdks
|
||||
- run:
|
||||
name: Create installer target dir
|
||||
command: |
|
||||
mkdir -p speckle-sharp-ci-tools/Installers/<< parameters.slug >>
|
||||
- run:
|
||||
name: Set Environment Variable
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
|
||||
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
|
||||
VERSION=$(echo $VER.$WORKFLOW_NUM)
|
||||
python3 patch_version.py $SEMVER
|
||||
environment:
|
||||
WORKFLOW_NUM: << pipeline.number >>
|
||||
- run:
|
||||
name: Zip Connector files
|
||||
command: |
|
||||
zip -r << parameters.slug >>-mac.zip "./speckle_connector" "./speckle_connector.rb"
|
||||
# Copy installer files
|
||||
- run:
|
||||
name: Copy files to installer
|
||||
command: |
|
||||
mkdir -p speckle-sharp-ci-tools/Mac/<< parameters.installername >>/.installationFiles/
|
||||
cp << parameters.slug >>-mac.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
|
||||
# Create installer
|
||||
- run:
|
||||
name: Exit if External PR
|
||||
command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi
|
||||
- run:
|
||||
name: Build Mac installer
|
||||
command: ~/.dotnet/dotnet publish speckle-sharp-ci-tools/Mac/<<parameters.installername>>/<<parameters.installername>>.sln -r osx-x64 -c Release
|
||||
- run:
|
||||
name: Zip installer
|
||||
command: |
|
||||
cd speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/osx-x64/publish/
|
||||
zip -r <<parameters.slug>>.zip ./
|
||||
- store_artifacts:
|
||||
path: speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/osx-x64/publish/<<parameters.slug>>.zip
|
||||
- run:
|
||||
name: Copy to installer location
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
|
||||
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
|
||||
VERSION=$(echo $VER.$WORKFLOW_NUM)
|
||||
cp speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/osx-x64/publish/<<parameters.slug>>.zip speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<<parameters.slug>>-$SEMVER.zip
|
||||
environment:
|
||||
WORKFLOW_NUM: << pipeline.number >>
|
||||
- when:
|
||||
condition: << pipeline.git.tag >>
|
||||
steps:
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers
|
||||
|
||||
get-ci-tools: # Clones our ci tools and persists them to the workspace
|
||||
docker:
|
||||
- image: cimg/base:2021.01
|
||||
@@ -99,6 +192,7 @@ jobs:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools
|
||||
|
||||
deploy-manager2:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
@@ -146,17 +240,37 @@ workflows:
|
||||
only: /.*/
|
||||
context: innosetup
|
||||
|
||||
- build-connector-mac:
|
||||
slug: sketchup
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-ui
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
installername: SpeckleSketchUpInstall
|
||||
|
||||
- deploy-manager2:
|
||||
context: do-spaces-speckle-releases
|
||||
slug: sketchup
|
||||
os: Win
|
||||
extension: exe
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-ui
|
||||
- build-connector
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
- deploy-manager2:
|
||||
context: do-spaces-speckle-releases
|
||||
slug: sketchup
|
||||
os: OSX
|
||||
extension: zip
|
||||
requires:
|
||||
- build-connector-mac
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
|
||||
@@ -111,7 +111,7 @@ module SpeckleConnector
|
||||
categories: Mapper::Category::RevitCategory.to_a,
|
||||
types: types,
|
||||
levels: levels,
|
||||
selectedLevel: selected_level_name
|
||||
selectedLevelName: selected_level_name
|
||||
}.freeze
|
||||
end
|
||||
|
||||
@@ -140,10 +140,10 @@ module SpeckleConnector
|
||||
source_exist = !state.speckle_state.speckle_mapper_state.mapper_source.nil?
|
||||
|
||||
if source_exist
|
||||
methods = ['Column', 'Beam', 'Brace', 'Pipe', 'Duct']
|
||||
methods = ['Column', 'Beam', 'Pipe', 'Duct']
|
||||
direct_shape_selection_info_with_source(state, edges, methods)
|
||||
else
|
||||
default_methods = ['Default Column', 'Default Beam', 'Default Brace', 'Default Pipe', 'Default Duct']
|
||||
default_methods = ['Default Column', 'Default Beam', 'Default Pipe', 'Default Duct']
|
||||
direct_shape_selection_info_with_default(edges, default_methods)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,6 +38,7 @@ module SpeckleConnector
|
||||
elements = type_elements.map do |type_element|
|
||||
SpeckleObjects::BuiltElements::Revit::RevitElementType.to_native(type_element)
|
||||
end
|
||||
elements = elements.group_by { |e| e[:family] }
|
||||
[type, elements]
|
||||
end.compact.to_h
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ module SpeckleConnector
|
||||
path = ENV.fetch('APPDATA')
|
||||
Pathname.new(File.join(path, 'Speckle')).cleanpath.to_s
|
||||
when OS_MAC
|
||||
File.join(Dir.home, 'Library/Application Support/Speckle')
|
||||
File.join(Dir.home, '.config/Speckle')
|
||||
else
|
||||
raise 'Speckle could not determine your Appdata path'
|
||||
end
|
||||
|
||||
@@ -7,12 +7,14 @@ module SpeckleConnector
|
||||
|
||||
OBJECTS_BUILTELEMENTS_VIEW3D = 'Objects.BuiltElements.View:Objects.BuiltElements.View3D'
|
||||
OBJECTS_BUILTELEMENTS_NETWORK = 'Objects.BuiltElements.Network'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_LEVEL = 'Objects.BuiltElements.Level:Objects.BuiltElements.Revit.RevitLevel'
|
||||
OBJECTS_BUILTELEMENTS_DEFAULT_FLOOR = 'Objects.BuiltElements.Floor'
|
||||
OBJECTS_BUILTELEMENTS_FLOOR = 'Objects.BuiltElements.Floor:Objects.BuiltElements.Revit.RevitFloor'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_FLOOR = 'Objects.BuiltElements.Floor:Objects.BuiltElements.Revit.RevitFloor'
|
||||
OBJECTS_BUILTELEMENTS_DEFAULT_WALL = 'Objects.BuiltElements.Wall'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_WALL = 'Objects.BuiltElements.Wall:Objects.BuiltElements.Revit.RevitWall'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_DIRECTSHAPE = 'Objects.BuiltElements.Revit.DirectShape'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_PARAMETER = 'Objects.BuiltElements.Revit.Parameter'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_REVITELEMENTTYPE = 'Objects.BuiltElements.Revit.RevitElementType'
|
||||
OBJECTS_BUILTELEMENTS_REVIT_LEVEL = 'Objects.BuiltElements.Level:Objects.BuiltElements.Revit.RevitLevel'
|
||||
|
||||
OBJECTS_GEOMETRY_LINE = 'Objects.Geometry.Line'
|
||||
OBJECTS_GEOMETRY_POLYLINE = 'Objects.Geometry.Polyline'
|
||||
|
||||
@@ -56,6 +56,7 @@ module SpeckleConnector
|
||||
BLOCK_DEFINITION = OTHER::BlockDefinition
|
||||
BLOCK_INSTANCE = OTHER::BlockInstance
|
||||
REVIT_INSTANCE = REVIT::Other::RevitInstance
|
||||
REVIT_WALL = BUILTELEMENTS::RevitWall
|
||||
RENDER_MATERIAL = OTHER::RenderMaterial
|
||||
DISPLAY_VALUE = OTHER::DisplayValue
|
||||
VIEW3D = BUILTELEMENTS::View3d
|
||||
@@ -77,6 +78,7 @@ module SpeckleConnector
|
||||
Objects.Other.RenderMaterial
|
||||
Objects.Other.Instance:Objects.Other.BlockInstance
|
||||
Objects.BuiltElements.View:Objects.BuiltElements.View3D
|
||||
Objects.BuiltElements.Wall:Objects.BuiltElements.Revit.RevitWall
|
||||
Objects.BuiltElements.Network
|
||||
Objects.GIS.PolygonElement
|
||||
Speckle.Core.Models.Collection
|
||||
@@ -294,6 +296,7 @@ module SpeckleConnector
|
||||
OBJECTS_OTHER_REVIT_REVITINSTANCE => REVIT_INSTANCE.method(:to_native),
|
||||
OBJECTS_OTHER_RENDERMATERIAL => RENDER_MATERIAL.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_VIEW3D => VIEW3D.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_REVIT_WALL => REVIT_WALL.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_REVIT_DIRECTSHAPE => BUILTELEMENTS::Revit::DirectShape.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_NETWORK => BUILTELEMENTS::Network.method(:to_native),
|
||||
OBJECTS_GIS_POLYGONELEMENT => POLYGON_ELEMENT.method(:to_native),
|
||||
|
||||
BIN
Binary file not shown.
@@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../speckle_objects/built_elements/floor'
|
||||
require_relative '../speckle_objects/built_elements/revit/revit_floor'
|
||||
require_relative '../speckle_objects/built_elements/revit/revit_wall'
|
||||
require_relative '../speckle_objects/built_elements/default_floor'
|
||||
require_relative '../speckle_objects/built_elements/default_wall'
|
||||
require_relative '../sketchup_model/query/entity'
|
||||
require_relative '../sketchup_model/reader/mapper_reader'
|
||||
require_relative '../sketchup_model/dictionary/speckle_schema_dictionary_handler'
|
||||
@@ -39,7 +41,17 @@ module SpeckleConnector
|
||||
end
|
||||
|
||||
if speckle_schema['method'] == 'Floor'
|
||||
return SpeckleObjects::BuiltElements::Floor
|
||||
return SpeckleObjects::BuiltElements::RevitFloor
|
||||
.to_speckle_schema(speckle_state, entity, units, global_transformation: global_transformation)
|
||||
end
|
||||
|
||||
if speckle_schema['method'] == 'Default Wall'
|
||||
return SpeckleObjects::BuiltElements::DefaultWall
|
||||
.to_speckle_schema(entity, units, global_transformation: global_transformation)
|
||||
end
|
||||
|
||||
if speckle_schema['method'] == 'Wall'
|
||||
return SpeckleObjects::BuiltElements::RevitWall
|
||||
.to_speckle_schema(speckle_state, entity, units, global_transformation: global_transformation)
|
||||
end
|
||||
|
||||
|
||||
@@ -27,14 +27,11 @@ module SpeckleConnector
|
||||
adj_faces.uniq
|
||||
end
|
||||
|
||||
# @param face [Sketchup::Face] face to check whether is vertical or not.
|
||||
def self.vertical?(face)
|
||||
face.normal.perpendicular?(VECTOR_Z)
|
||||
end
|
||||
|
||||
# @param face [Sketchup::Face] face to check whether is horizontal or not.
|
||||
def self.horizontal?(face)
|
||||
face.normal.parallel?(VECTOR_Z)
|
||||
# @param face [Sketchup::Face] face to get max z distance for all vertices.
|
||||
def self.max_z(face)
|
||||
points = face.vertices.collect(&:position)
|
||||
points_z_values = points.collect(&:z)
|
||||
points_z_values.max - points_z_values.min
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../base'
|
||||
require_relative '../built_elements/revit/parameter'
|
||||
require_relative '../other/render_material'
|
||||
require_relative '../geometry/length'
|
||||
require_relative '../geometry/line'
|
||||
require_relative '../geometry/polyline'
|
||||
require_relative '../../constants/type_constants'
|
||||
require_relative '../../sketchup_model/dictionary/speckle_schema_dictionary_handler'
|
||||
require_relative '../../sketchup_model/utils/face_utils'
|
||||
|
||||
module SpeckleConnector
|
||||
module SpeckleObjects
|
||||
module BuiltElements
|
||||
# Default Wall object.
|
||||
class DefaultWall < Base
|
||||
SPECKLE_TYPE = OBJECTS_BUILTELEMENTS_DEFAULT_WALL
|
||||
|
||||
def initialize(base_line:, height:, flipped:, units:, material:, application_id: nil)
|
||||
super(
|
||||
speckle_type: SPECKLE_TYPE,
|
||||
total_children_count: 0,
|
||||
application_id: application_id,
|
||||
id: nil
|
||||
)
|
||||
self[:baseLine] = base_line
|
||||
self[:height] = height
|
||||
self[:flipped] = flipped
|
||||
self[:units] = units
|
||||
self[:renderMaterial] = material
|
||||
end
|
||||
|
||||
# @param face [Sketchup::Face] face to get speckle schema for floor.
|
||||
def self.to_speckle_schema(face, units, global_transformation: nil)
|
||||
base_line = Geometry::Line.base_line_from_face(face, units, global_transformation: global_transformation)
|
||||
|
||||
material = face.material || face.back_material
|
||||
|
||||
DefaultWall.new(
|
||||
base_line: base_line,
|
||||
height: Geometry.length_to_speckle(SketchupModel::Utils::FaceUtils.max_z(face), units),
|
||||
flipped: false,
|
||||
units: units,
|
||||
material: material.nil? ? nil : Other::RenderMaterial.from_material(face.material || face.back_material),
|
||||
application_id: face.persistent_id
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
+13
-11
@@ -1,20 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../base'
|
||||
require_relative '../built_elements/revit/parameter'
|
||||
require_relative '../other/render_material'
|
||||
require_relative '../geometry/line'
|
||||
require_relative '../geometry/polyline'
|
||||
require_relative '../../constants/type_constants'
|
||||
require_relative '../../sketchup_model/dictionary/speckle_schema_dictionary_handler'
|
||||
require_relative '../../base'
|
||||
require_relative '../../built_elements/revit/parameter'
|
||||
require_relative '../../other/render_material'
|
||||
require_relative '../../geometry/line'
|
||||
require_relative '../../geometry/polyline'
|
||||
require_relative '../../../constants/type_constants'
|
||||
require_relative '../../../sketchup_model/dictionary/speckle_schema_dictionary_handler'
|
||||
|
||||
module SpeckleConnector
|
||||
module SpeckleObjects
|
||||
module BuiltElements
|
||||
# Floor object.
|
||||
class Floor < Base
|
||||
SPECKLE_TYPE = OBJECTS_BUILTELEMENTS_FLOOR
|
||||
# Revit floor object.
|
||||
class RevitFloor < Base
|
||||
SPECKLE_TYPE = OBJECTS_BUILTELEMENTS_REVIT_FLOOR
|
||||
|
||||
# rubocop:disable Metrics/ParameterLists
|
||||
def initialize(family:, type:, outline:, voids:, level:, units:, material:, parameters:nil, application_id: nil)
|
||||
super(
|
||||
speckle_type: SPECKLE_TYPE,
|
||||
@@ -31,6 +32,7 @@ module SpeckleConnector
|
||||
self[:parameters] = parameters
|
||||
self[:renderMaterial] = material
|
||||
end
|
||||
# rubocop:enable Metrics/ParameterLists
|
||||
|
||||
# @param face [Sketchup::Face] face to get speckle schema for floor.
|
||||
def self.to_speckle_schema(speckle_state, face, units, global_transformation: nil)
|
||||
@@ -57,7 +59,7 @@ module SpeckleConnector
|
||||
parameters['Height Offset From Level'] = offset_parameter
|
||||
end
|
||||
|
||||
Floor.new(
|
||||
RevitFloor.new(
|
||||
family: schema['family'],
|
||||
type: schema['family_type'],
|
||||
outline: outline,
|
||||
@@ -0,0 +1,102 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../../base'
|
||||
require_relative '../../built_elements/revit/parameter'
|
||||
require_relative '../../other/render_material'
|
||||
require_relative '../../geometry/line'
|
||||
require_relative '../../geometry/length'
|
||||
require_relative '../../../constants/type_constants'
|
||||
require_relative '../../../sketchup_model/dictionary/speckle_schema_dictionary_handler'
|
||||
require_relative '../../../sketchup_model/utils/face_utils'
|
||||
|
||||
module SpeckleConnector
|
||||
module SpeckleObjects
|
||||
module BuiltElements
|
||||
# Revit wall object.
|
||||
class RevitWall < Base
|
||||
SPECKLE_TYPE = OBJECTS_BUILTELEMENTS_REVIT_WALL
|
||||
|
||||
# rubocop:disable Metrics/ParameterLists
|
||||
def initialize(family:, type:, base_line:, height:, flipped:, level:, units:, material:, parameters: nil, application_id: nil)
|
||||
super(
|
||||
speckle_type: SPECKLE_TYPE,
|
||||
total_children_count: 0,
|
||||
application_id: application_id,
|
||||
id: nil
|
||||
)
|
||||
self[:family] = family
|
||||
self[:type] = type
|
||||
self[:height] = height
|
||||
self[:flipped] = flipped
|
||||
self[:level] = level
|
||||
self[:baseLine] = base_line
|
||||
self[:units] = units
|
||||
self[:parameters] = parameters
|
||||
self[:renderMaterial] = material
|
||||
end
|
||||
# rubocop:enable Metrics/ParameterLists
|
||||
|
||||
def self.to_native(state, wall, layer, entities, &convert_to_native)
|
||||
obj = Other::DisplayValue.collect_definition_geometries(wall)
|
||||
obj['name'] = Other::DisplayValue.get_definition_name(obj)
|
||||
|
||||
state, _definitions = Other::BlockDefinition.to_native(
|
||||
state, obj, layer, entities, &convert_to_native
|
||||
)
|
||||
|
||||
definition = state.sketchup_state.sketchup_model.definitions[Other::BlockDefinition.get_definition_name(obj)]
|
||||
|
||||
Other::BlockInstance.find_and_erase_existing_instance(definition, obj['id'], obj['applicationId'])
|
||||
t_arr = obj['transform']
|
||||
transform = t_arr.nil? ? Geom::Transformation.new : Other::Transform.to_native(t_arr, obj['units'])
|
||||
instance = entities.add_instance(definition, transform)
|
||||
instance.name = Other::DisplayValue.get_instance_name(obj['name']) unless obj['name'].nil?
|
||||
instance.layer = layer unless layer.nil?
|
||||
# Align instance axes that created from display value. (without any transform)
|
||||
# BlockInstance.align_instance_axes(instance)
|
||||
return state, [instance, definition]
|
||||
end
|
||||
|
||||
# @param face [Sketchup::Face] face to get speckle schema for wall.
|
||||
def self.to_speckle_schema(speckle_state, face, units, global_transformation: nil)
|
||||
base_line = Geometry::Line.base_line_from_face(face, units, global_transformation: global_transformation)
|
||||
|
||||
material = face.material || face.back_material
|
||||
schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.speckle_schema_to_speckle(face).to_h
|
||||
source_exist = !speckle_state.speckle_mapper_state.mapper_source.nil?
|
||||
level = nil
|
||||
parameters = nil
|
||||
if source_exist
|
||||
level = speckle_state.speckle_mapper_state.mapper_source.levels.find { |l| l[:name] == schema['level'] }
|
||||
parameters = Base.new
|
||||
offset_parameter = BuiltElements::Revit::Parameter.new(name: 'Height Offset From Level')
|
||||
level_z = Geometry.length_to_native(level[:elevation], level[:units])
|
||||
min_z = face.vertices.collect(&:position).map(&:z).min
|
||||
offset_parameter['value'] = Geometry.length_to_speckle(min_z - level_z, units)
|
||||
offset_parameter['units'] = units
|
||||
parameters['Height Offset From Level'] = offset_parameter
|
||||
end
|
||||
|
||||
RevitWall.new(
|
||||
family: schema['family'],
|
||||
type: schema['family_type'],
|
||||
base_line: base_line,
|
||||
height: Geometry.length_to_speckle(SketchupModel::Utils::FaceUtils.max_z(face), units),
|
||||
flipped: false,
|
||||
level: level,
|
||||
units: units,
|
||||
parameters: parameters,
|
||||
material: material.nil? ? nil : Other::RenderMaterial.from_material(face.material || face.back_material),
|
||||
application_id: face.persistent_id
|
||||
)
|
||||
end
|
||||
|
||||
def self.get_wall_height(face, units)
|
||||
points = face.vertices.collect(&:position)
|
||||
points_z_values = points.collect(&:z)
|
||||
Geometry.length_to_speckle(points_z_values.max - points_z_values.min, units)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -40,7 +40,7 @@ module SpeckleConnector
|
||||
# rubocop:enable Metrics/ParameterLists
|
||||
|
||||
# @param edge [Sketchup::Edge] edge to convert line.
|
||||
def self.from_edge(edge, units, model_preferences)
|
||||
def self.from_edge(edge, units, model_preferences, global_transformation: nil)
|
||||
dictionaries = SketchupModel::Dictionary::BaseDictionaryHandler
|
||||
.attribute_dictionaries_to_speckle(edge, model_preferences)
|
||||
att = dictionaries.any? ? { dictionaries: dictionaries } : {}
|
||||
@@ -60,6 +60,41 @@ module SpeckleConnector
|
||||
)
|
||||
end
|
||||
|
||||
# @param edge [Sketchup::Face] face to get base line from face.
|
||||
def self.base_line_from_face(face, units, global_transformation: nil)
|
||||
points = face.vertices.collect(&:position)
|
||||
points_z_values = points.collect(&:z)
|
||||
height = Geometry.length_to_speckle(points_z_values.max - points_z_values.min, units)
|
||||
min_z = points_z_values.min
|
||||
projected_points = points.map { |p| Geom::Point3d.new(p.x, p.y, min_z) }
|
||||
distance_with_points = Struct.new(:distance, :point_1, :point_2)
|
||||
lines_with_distances = []
|
||||
projected_points.each do |p|
|
||||
projected_points.each do |p_other|
|
||||
next if p_other == p
|
||||
|
||||
lines_with_distances.append(distance_with_points.new(p.distance(p_other), p, p_other))
|
||||
end
|
||||
end
|
||||
lines_with_distances.sort_by!(&:distance).reverse!
|
||||
p_1 = lines_with_distances.first.point_1
|
||||
p_2 = lines_with_distances.first.point_2
|
||||
unless global_transformation.nil?
|
||||
p_1 = p_1.transform!(global_transformation)
|
||||
p_2 = p_2.transform!(global_transformation)
|
||||
end
|
||||
Line.new(
|
||||
start_pt: Geometry::Point.from_vertex(p_1, units),
|
||||
end_pt: Geometry::Point.from_vertex(p_2, units),
|
||||
domain: Primitive::Interval.from_numeric(0, Geometry.length_to_speckle(p_1.distance(p_2), units), units),
|
||||
units: units,
|
||||
layer: SketchupModel::Query::Layer.entity_path(face),
|
||||
sketchup_attributes: {},
|
||||
speckle_schema: {},
|
||||
application_id: face.persistent_id.to_s
|
||||
)
|
||||
end
|
||||
|
||||
# @param state [States::State] state of the application.
|
||||
# @param line [Object] object represents Speckle line.
|
||||
# @param layer [Sketchup::Layer] layer to add {Sketchup::Edge} into it.
|
||||
|
||||
@@ -159,6 +159,7 @@ module SpeckleConnector
|
||||
# rubocop:disable Metrics/CyclomaticComplexity
|
||||
# rubocop:disable Metrics/PerceivedComplexity
|
||||
def self.group_entities_to_speckle(entities, preferences, speckle_state, parent, &convert)
|
||||
entities = entities.reject(&:hidden?)
|
||||
orphan_edges = entities.grep(Sketchup::Edge).filter { |edge| edge.faces.none? }
|
||||
lines = orphan_edges.collect do |orphan_edge|
|
||||
new_speckle_state, converted = convert.call(orphan_edge, preferences, speckle_state, parent)
|
||||
|
||||
@@ -83,13 +83,19 @@ module SpeckleConnector
|
||||
|
||||
elements = obj['elements'] || obj['@elements']
|
||||
|
||||
if !elements.nil? && elements.is_a?(Array)
|
||||
elements.each do |element|
|
||||
# Mullions is a special case here, they are extracted as base object with @displayValue from revit..
|
||||
if element['@displayValue'].nil?
|
||||
obj['geometry'].append(element)
|
||||
else
|
||||
obj['geometry'] += element['@displayValue']
|
||||
# if only elements are there then assign only elements, there are some cases that RevitWalls can only
|
||||
# have elements instead of display value
|
||||
if obj['geometry'].nil? && !elements.nil?
|
||||
obj['geometry'] = elements
|
||||
else
|
||||
if !elements.nil? && elements.is_a?(Array)
|
||||
elements.each do |element|
|
||||
# Mullions is a special case here, they are extracted as base object with @displayValue from revit..
|
||||
if element['@displayValue'].nil?
|
||||
obj['geometry'].append(element)
|
||||
else
|
||||
obj['geometry'] += element['@displayValue']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,10 @@ module SpeckleConnector
|
||||
family = def_obj['family']
|
||||
type = def_obj['type']
|
||||
category = def_obj['category']
|
||||
element_id = def_obj['elementId']
|
||||
id = def_obj['id']
|
||||
|
||||
return "#{family}-#{type}-#{category}-#{def_obj['elementId']}"
|
||||
return "#{family}-#{type}-#{category}-#{element_id}-#{id}"
|
||||
end
|
||||
|
||||
def self.to_native(state, definition, layer, entities, &convert_to_native)
|
||||
|
||||
@@ -84,7 +84,7 @@ module SpeckleConnector
|
||||
|
||||
method = SPECKLE_SCHEMA_DICTIONARY_HANDLER.get_attribute(entity, 'method')
|
||||
|
||||
if method.include?('Floor') && entity.is_a?(Sketchup::Face)
|
||||
if !method.nil? && (method.include?('Floor') || method.include?('Wall')) && entity.is_a?(Sketchup::Face)
|
||||
global_transformation = QUERY::Entity.global_transformation(entity, path)
|
||||
floor = SpeckleObjects::Geometry::Mesh.from_face(speckle_state: speckle_state, face: entity,
|
||||
units: units, model_preferences: preferences,
|
||||
|
||||
@@ -232,22 +232,27 @@ export default {
|
||||
// }
|
||||
},
|
||||
clearMappingsFromTableSelection(){
|
||||
sketchup.exec({ name: "clear_mappings_from_table", data: this.elementSelection })
|
||||
sketchup.exec({ name: "clear_mappings_from_table", data: this.elementSelection })
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Clear' })
|
||||
},
|
||||
isolateMappedElementsOnSketchup(){
|
||||
if (this.isIsolated){
|
||||
this.isIsolated = false
|
||||
sketchup.exec({ name: "show_all_entities", data: {} })
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Un-Isolate' })
|
||||
} else {
|
||||
this.isIsolated = true
|
||||
sketchup.exec({ name: "isolate_mappings_from_table", data: this.elementSelection })
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Isolate' })
|
||||
}
|
||||
},
|
||||
hideMappedElementsOnSketchup(){
|
||||
sketchup.exec({ name: "hide_mappings_from_table", data: this.elementSelection })
|
||||
sketchup.exec({ name: "hide_mappings_from_table", data: this.elementSelection })
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Hide' })
|
||||
},
|
||||
selectMappedElementsOnSketchup(){
|
||||
sketchup.exec({ name: "select_mappings_from_table", data: this.elementSelection })
|
||||
sketchup.exec({ name: "select_mappings_from_table", data: this.elementSelection })
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Select Elements' })
|
||||
},
|
||||
// Update mapped elements table whenever mapped elements has changed.
|
||||
getMappedElementsTableData(){
|
||||
|
||||
+184
-62
@@ -65,24 +65,31 @@
|
||||
mdi-source-branch
|
||||
</v-icon>
|
||||
{{ `Source` }}
|
||||
<v-btn
|
||||
v-if="!sourceUpToDate"
|
||||
v-tooltip="'Source branch is not up-to-date!'"
|
||||
class="ma-0"
|
||||
height="20px"
|
||||
icon
|
||||
small
|
||||
color="red"
|
||||
@click="refreshSourceBranch"
|
||||
>
|
||||
<v-icon>
|
||||
mdi-update
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
<v-tooltip right>
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-btn
|
||||
class="ma-0 ml-1"
|
||||
height="20px"
|
||||
width="20px"
|
||||
icon
|
||||
x-small
|
||||
:color="getSourceStateIconColor()"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
@click="refreshSourceBranch"
|
||||
>
|
||||
<v-icon>
|
||||
{{ getSourceStateIcon() }}
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>{{ getSourceStateToolTip() }}</span>
|
||||
</v-tooltip>
|
||||
|
||||
</v-container>
|
||||
</v-expansion-panel-header>
|
||||
<v-expansion-panel-content>
|
||||
<mapper-source :source-up-to-date="this.sourceUpToDate"/>
|
||||
<mapper-source :source-state="this.sourceState"/>
|
||||
</v-expansion-panel-content>
|
||||
</v-expansion-panel>
|
||||
|
||||
@@ -152,7 +159,7 @@
|
||||
class="pt-0"
|
||||
label="Mapper Method"
|
||||
:disabled="!entitySelected"
|
||||
:items="enabledMethods"
|
||||
:items="availableMethods"
|
||||
density="compact"
|
||||
clearable
|
||||
@change="onSelectedMethodChange"
|
||||
@@ -167,6 +174,7 @@
|
||||
:items="families"
|
||||
density="compact"
|
||||
clearable
|
||||
@change="onSelectedFamilyChange"
|
||||
></v-autocomplete>
|
||||
|
||||
<v-autocomplete
|
||||
@@ -272,6 +280,7 @@
|
||||
import {bus} from "@/main";
|
||||
import {groupBy} from "@/utils/groupBy";
|
||||
import MappingSource from "@/components/MapperSource.vue";
|
||||
import {sourceMap} from "@vue/cli-service/lib/config/terserOptions";
|
||||
|
||||
global.mapperSourceUpdated = function (streamId, levels, types) {
|
||||
console.log(`Mapper source updated for ${streamId}.`)
|
||||
@@ -309,7 +318,7 @@ export default {
|
||||
categorySelectionActive: false,
|
||||
nameSelectionActive: false,
|
||||
|
||||
sourceUpToDate: true,
|
||||
sourceState: 'Not Set',
|
||||
// Expanded indexes for selection table (Types)
|
||||
selectionExpandedIndexes: [],
|
||||
// Expanded indexes for mapped element table (Categories)
|
||||
@@ -324,6 +333,7 @@ export default {
|
||||
entitySelected: false,
|
||||
selectedEntityCount: 0,
|
||||
selectedEntities: [],
|
||||
allFamilyTypes: {},
|
||||
familyTypes: [],
|
||||
lastSelectedEntity: null,
|
||||
|
||||
@@ -334,7 +344,7 @@ export default {
|
||||
selectedLevel: null,
|
||||
name: "",
|
||||
|
||||
enabledMethods: [],
|
||||
availableMethods: [],
|
||||
availableCategories: [],
|
||||
families: [],
|
||||
allTypes: {},
|
||||
@@ -449,10 +459,51 @@ export default {
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getSourceStateIcon(){
|
||||
switch (this.sourceState){
|
||||
case "Not Set":
|
||||
return `mdi-cloud-off-outline`;
|
||||
case "Set":
|
||||
return `mdi-checkbox-marked-circle-outline`;
|
||||
case "Outdated":
|
||||
return `mdi-update`;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
getSourceStateToolTip(){
|
||||
switch (this.sourceState){
|
||||
case "Not Set":
|
||||
return 'Source disconnected.';
|
||||
case "Set":
|
||||
return 'Source connected.';
|
||||
case "Outdated":
|
||||
return 'Source branch is not up-to-date!';
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
getSourceStateIconColor(){
|
||||
switch (this.sourceState){
|
||||
case "Not Set":
|
||||
return `grey`;
|
||||
case "Set":
|
||||
return `green`;
|
||||
case "Outdated":
|
||||
return `red`;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
onSelectedMethodChange(){
|
||||
this.hideOptionalMappingInputs()
|
||||
this.updateMappingInputs()
|
||||
this.getTypesFromSelectedMethod()
|
||||
this.getFamiliesFromSelectedMethod()
|
||||
this.getTypesFromSelectedFamily()
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Set', schema: this.selectedMethod })
|
||||
},
|
||||
onSelectedFamilyChange(){
|
||||
this.getTypesFromSelectedFamily();
|
||||
},
|
||||
updateMappingInputs(){
|
||||
if (this.selectedMethod === null){
|
||||
@@ -483,39 +534,54 @@ export default {
|
||||
this.levelSelectionActive = true
|
||||
}
|
||||
},
|
||||
getTypesFromSelectedMethod(){
|
||||
getTypesFromSelectedFamily(){
|
||||
this.familyTypes = this.allFamilyTypes[this.selectedFamily]
|
||||
this.selectedFamilyType = this.familyTypes[0].type
|
||||
if (this.selectedFamily === null || this.selectedFamily === undefined){
|
||||
this.selectedFamily = this.families[0]
|
||||
}
|
||||
if (this.familyTypes === null ||this.familyTypes === undefined){
|
||||
this.familyTypes = this.allFamilyTypes[this.selectedFamily]
|
||||
}
|
||||
if (this.selectedFamilyType === null || this.selectedFamilyType === undefined){
|
||||
this.selectedFamilyType = this.familyTypes[0].type
|
||||
}
|
||||
},
|
||||
getFamiliesFromSelectedMethod(){
|
||||
switch (this.selectedMethod) {
|
||||
case 'Floor':
|
||||
this.familyTypes = this.allTypes['Floors'];
|
||||
this.families = ['Floor'];
|
||||
this.families = Object.keys(this.allTypes['Floors']);
|
||||
this.allFamilyTypes = this.allTypes['Floors']
|
||||
break;
|
||||
case 'Wall':
|
||||
this.familyTypes = this.allTypes['Walls'];
|
||||
this.families = ['Wall'];
|
||||
this.families = Object.keys(this.allTypes['Walls']);
|
||||
this.allFamilyTypes = this.allTypes['Walls']
|
||||
break;
|
||||
case 'Column':
|
||||
this.familyTypes = this.allTypes['Columns'];
|
||||
this.families = ['Column'];
|
||||
this.families = Object.keys(this.allTypes['Columns']);
|
||||
this.allFamilyTypes = this.allTypes['Columns']
|
||||
break;
|
||||
case 'Beam':
|
||||
this.familyTypes = this.allTypes['Beams'];
|
||||
this.families = ['Beam'];
|
||||
break;
|
||||
case 'Brace':
|
||||
this.familyTypes = this.allTypes['Braces'];
|
||||
this.families = ['Brace'];
|
||||
this.families = Object.keys(this.allTypes['Beams']);
|
||||
this.allFamilyTypes = this.allTypes['Beams']
|
||||
break;
|
||||
case 'Pipe':
|
||||
this.familyTypes = this.allTypes['Pipes'];
|
||||
this.families = ['Pipe'];
|
||||
this.families = Object.keys(this.allTypes['Piping System']);
|
||||
this.allFamilyTypes = this.allTypes['Piping System']
|
||||
break;
|
||||
case 'Duct':
|
||||
this.familyTypes = this.allTypes['Ducts'];
|
||||
this.families = ['Duct'];
|
||||
this.families = Object.keys(this.allTypes['Duct System']);
|
||||
this.allFamilyTypes = this.allTypes['Duct System']
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (this.selectedFamily === null || this.selectedFamily === undefined){
|
||||
this.selectedFamily = this.families[0]
|
||||
}
|
||||
if (this.selectedLevel === null || this.selectedLevel === undefined){
|
||||
this.selectedLevel = this.levels[0].name
|
||||
}
|
||||
},
|
||||
hideOptionalMappingInputs(){
|
||||
this.categorySelectionActive = false
|
||||
@@ -525,10 +591,13 @@ export default {
|
||||
this.levelSelectionActive = false
|
||||
},
|
||||
refreshSourceBranch(){
|
||||
bus.$emit('refresh-source-branch')
|
||||
if (this.sourceState === 'Outdated'){
|
||||
bus.$emit('refresh-source-branch')
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Source Update' })
|
||||
}
|
||||
},
|
||||
clearInputs(){
|
||||
this.enabledMethods = []
|
||||
this.availableMethods = []
|
||||
this.availableCategories = []
|
||||
this.selectedEntities = []
|
||||
this.selectionTableData = []
|
||||
@@ -581,12 +650,12 @@ export default {
|
||||
return summary
|
||||
},
|
||||
setInputValuesFromSelection(){
|
||||
// Clear all inputs if entity is not selected.
|
||||
if (!this.entitySelected){
|
||||
this.name = ""
|
||||
this.selectedMethod = null
|
||||
this.selectedCategory = null
|
||||
this.clearMappingInputs()
|
||||
return
|
||||
}
|
||||
// Check if definition card is selected and set definition mappings.
|
||||
if (this.definitionSelected) {
|
||||
if (!this.definitionMapped){
|
||||
if (this.selectedEntityCount > 1){
|
||||
@@ -605,15 +674,20 @@ export default {
|
||||
this.selectedMethod = this.lastSelectedEntity['definition']['schema']['method']
|
||||
this.selectedCategory = this.lastSelectedEntity['definition']['schema']['category']
|
||||
}
|
||||
} else {
|
||||
}
|
||||
// Otherwise set entity mappings.
|
||||
else
|
||||
{
|
||||
if (!this.entityMapped){
|
||||
if (this.selectedEntityCount > 1){
|
||||
this.name = '<Mixed>'
|
||||
}else{
|
||||
this.name = this.lastSelectedEntity['entityName']
|
||||
}
|
||||
console.log("entity not mapped")
|
||||
this.updateMappingInputs()
|
||||
// this.selectedMethod = 'Direct Shape'
|
||||
this.getFamiliesFromSelectedMethod()
|
||||
this.getTypesFromSelectedFamily()
|
||||
this.selectedCategory = 49
|
||||
} else {
|
||||
if (this.selectedEntityCount > 1){
|
||||
@@ -622,10 +696,12 @@ export default {
|
||||
this.name = this.lastSelectedEntity['schema']['name']
|
||||
}
|
||||
this.selectedMethod = this.lastSelectedEntity['schema']['method']
|
||||
console.log("entity is mapped")
|
||||
this.updateMappingInputs()
|
||||
this.getTypesFromSelectedMethod()
|
||||
this.selectedCategory = this.lastSelectedEntity['schema']['category']
|
||||
this.selectedFamily = this.lastSelectedEntity['schema']['family']
|
||||
this.selectedCategory = this.lastSelectedEntity['schema']['category']
|
||||
this.getFamiliesFromSelectedMethod()
|
||||
this.getTypesFromSelectedFamily()
|
||||
this.selectedFamilyType = this.lastSelectedEntity['schema']['family_type']
|
||||
this.selectedLevel = this.lastSelectedEntity['schema']['level']
|
||||
}
|
||||
@@ -666,10 +742,29 @@ export default {
|
||||
this.mappedElementsExpandedIndexes.push(slotData.item);
|
||||
}
|
||||
},
|
||||
inputsReadyToApply(){
|
||||
if (this.selectedMethod === null || this.selectedMethod === undefined){
|
||||
return false;
|
||||
}
|
||||
|
||||
const nativeMethods = this.nativeEdgeMethods.concat(this.nativeFaceMethods)
|
||||
|
||||
if (this.selectedMethod === 'Direct Shape'){
|
||||
return this.selectedCategory !== null
|
||||
}
|
||||
else if (nativeMethods.includes(this.selectedMethod)){
|
||||
return this.selectedFamily !== null &&
|
||||
this.selectedFamilyType !== null &&
|
||||
this.selectedLevel !== null
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
applyMapping(){
|
||||
if (this.selectedMethod === null || this.selectedCategory === null){
|
||||
if (!this.inputsReadyToApply()){
|
||||
this.$eventHub.$emit('error', {
|
||||
text: 'Method and category are not set.\n'
|
||||
text: 'Some inputs are not set to apply mapping.\n'
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -687,6 +782,8 @@ export default {
|
||||
this.$eventHub.$emit('success', {
|
||||
text: 'Mapping Applied.\n'
|
||||
})
|
||||
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Applied' })
|
||||
},
|
||||
clearMapping(){
|
||||
const mapping = {
|
||||
@@ -698,28 +795,53 @@ export default {
|
||||
this.$eventHub.$emit('error', {
|
||||
text: 'Mapping Cleared.\n'
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
sketchup.exec({name: "collect_mapped_entities", data: {}})
|
||||
|
||||
bus.$on('entities-selected', async (selectionParameters) => {
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Clear' })
|
||||
},
|
||||
clearMappingInputs(){
|
||||
this.selectedMethod = null
|
||||
const selectionPars = JSON.parse(selectionParameters)
|
||||
this.enabledMethods = selectionPars.mappingMethods
|
||||
this.availableCategories = selectionPars.categories
|
||||
this.selectedEntities = selectionPars.selection
|
||||
this.allTypes = selectionPars.types
|
||||
this.levels = selectionPars.levels
|
||||
this.selectedLevel = selectionPars.selectedLevel
|
||||
console.log(selectionPars)
|
||||
this.selectedCategory = null
|
||||
this.name = ""
|
||||
this.selectedFamily = null
|
||||
this.selectedFamilyType = null
|
||||
this.selectedLevel = null
|
||||
this.familyTypes = null
|
||||
this.levels = null
|
||||
this.availableMethods = null
|
||||
this.availableCategories = null
|
||||
this.allTypes = null
|
||||
},
|
||||
getDataFromSelection(selectionParameters){
|
||||
this.availableMethods = selectionParameters.mappingMethods
|
||||
this.availableCategories = selectionParameters.categories
|
||||
this.selectedEntities = selectionParameters.selection
|
||||
this.allTypes = selectionParameters.types
|
||||
this.levels = selectionParameters.levels
|
||||
this.selectedLevel = selectionParameters.selectedLevelName
|
||||
},
|
||||
updateStatesFromSelectionData(){
|
||||
this.lastSelectedEntity = this.selectedEntities[this.selectedEntities.length - 1]
|
||||
this.entityMapped = this.isEntitiesMapped(this.selectedEntities)
|
||||
this.definitionMapped = this.isEntityDefinitionsMapped(this.selectedEntities)
|
||||
this.definitionSelected = !this.entityMapped && this.definitionMapped
|
||||
this.selectedEntityCount = this.selectedEntities.length
|
||||
this.entitySelected = this.selectedEntityCount !== 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
sketchup.exec({name: "collect_mapped_entities", data: {}})
|
||||
|
||||
bus.$on('entities-selected', async (selectionParameters) => {
|
||||
// Parse data to json object
|
||||
const selectionPars = JSON.parse(selectionParameters)
|
||||
// Reset mapping inputs with nulls and empties.
|
||||
this.clearMappingInputs()
|
||||
// Get data from selection into objects and arrays. These data basically constructs the dropdowns.
|
||||
this.getDataFromSelection(selectionPars)
|
||||
// Update inner state of the mapper component according to selection data.
|
||||
this.updateStatesFromSelectionData()
|
||||
// Get selection table data.
|
||||
this.getSelectionTableData()
|
||||
// Set mapping input values from selection data.
|
||||
this.setInputValuesFromSelection()
|
||||
})
|
||||
bus.$on('entities-deselected', async () => {
|
||||
@@ -731,7 +853,7 @@ export default {
|
||||
this.mappedEntityCount = mappedEntities.length
|
||||
})
|
||||
bus.$on('set-source-up-to-date', (isUpToDate) => {
|
||||
this.sourceUpToDate = isUpToDate
|
||||
this.sourceState = isUpToDate
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
name: "MappingSource",
|
||||
props: {
|
||||
streamSearchQuery: { type: String, default: null },
|
||||
sourceUpToDate: { type: Boolean },
|
||||
sourceState: { type: String, default: 'Not Set' },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -117,11 +117,13 @@ export default {
|
||||
},
|
||||
result(data) {
|
||||
if (data.data.commitCreated.sourceApplication.includes('Revit')){
|
||||
this.afterCommitCreated()
|
||||
this.$eventHub.$emit('notification', {
|
||||
text: `A new commit was created on Revit!`,
|
||||
})
|
||||
this.$apollo.queries.stream.refetch()
|
||||
if (data.data.commitCreated.branchName === this.selectedBranch.name){
|
||||
this.afterCommitCreated()
|
||||
this.$eventHub.$emit('notification', {
|
||||
text: `A new commit was created on Revit!`,
|
||||
})
|
||||
this.$apollo.queries.stream.refetch()
|
||||
}
|
||||
}
|
||||
},
|
||||
skip() {
|
||||
@@ -161,19 +163,32 @@ export default {
|
||||
mounted() {
|
||||
bus.$on('refresh-source-branch', () => {
|
||||
this.onSourceBranchChanged()
|
||||
bus.$emit('set-source-up-to-date', true)
|
||||
bus.$emit('set-source-up-to-date', 'Set')
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
applySource(){
|
||||
bus.$emit('set-source-up-to-date', 'Set')
|
||||
this.onSourceBranchChanged()
|
||||
this.$eventHub.$emit('success', {
|
||||
text: 'Mapper source applied.\n'
|
||||
})
|
||||
this.$mixpanel.track('MappingsAction', { name: 'Mappings Source Apply' })
|
||||
},
|
||||
clearSource(){
|
||||
sketchup.exec({name:"clear_mapper_source" , data: {}})
|
||||
bus.$emit('set-source-up-to-date', 'Not Set')
|
||||
this.sourceApplied = false
|
||||
this.sourceBranchName = null
|
||||
this.sourceStreamName = null
|
||||
this.sourceBranchId = null
|
||||
this.sourceStreamId = null
|
||||
this.$eventHub.$emit('error', {
|
||||
text: 'Mapper source cleared.\n'
|
||||
})
|
||||
},
|
||||
afterCommitCreated(){
|
||||
bus.$emit('set-source-up-to-date', false)
|
||||
bus.$emit('set-source-up-to-date', 'Outdated')
|
||||
},
|
||||
async onSourceBranchChanged() {
|
||||
const commitRefId = this.selectedBranch.commits.items[0]?.referencedObject
|
||||
|
||||
Reference in New Issue
Block a user