Compare commits

...

110 Commits

Author SHA1 Message Date
Jedd Morgan 3d0117f701 Removed old workflows (#442)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2026-02-06 09:27:17 +03:00
Mucahit Bilal GOKER 08fe6f07cf Merge pull request #450 from specklesystems/bilal/cnx-3067-running-sketchup-when-speckle-folder-is-missing
fix: Make initialization robust when app data directory is missing
2026-02-06 08:08:06 +03:00
bimgeek 37be889932 revert check 2026-02-05 17:57:41 +03:00
Mucahit Bilal GOKER ed124dd288 init fix 2026-02-05 17:12:19 +03:00
Oğuzhan Koral 760d8a033d Treat grouped mesh as sketchup entity (#449)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2026-01-30 10:34:27 +03:00
Oğuzhan Koral 96cd122645 Fix: add definition attributes to block instances (#448)
* wip

* get definition and instance props under properties

* Reordering docs
2026-01-16 15:38:33 +03:00
Oğuzhan Koral 533768eb14 strip out @ from detached props (#447) 2026-01-16 14:22:50 +03:00
Oğuzhan Koral c88d3c632d skip if elevation or units null (#446)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2026-01-16 10:27:38 +03:00
Oğuzhan Koral 72f5185992 feat: do not try to hightlight on no selection (#445) 2026-01-13 10:40:31 +03:00
Oğuzhan Koral b8db07a66b Feat: add account (#443)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
* fix(macos): appdata path

* feat: add account via sqlite

* revert: material manager

* revert: dui url

* doc
2025-10-26 09:08:54 +03:00
Oğuzhan Koral 366b961039 Do not init diff materials (#440)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-10-14 14:02:59 +03:00
Oğuzhan Koral e244a7e2e5 Convert argb to int always to be safe (#439)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-10-14 13:28:52 +03:00
Mucahit Bilal GOKER 9b55764b38 replace logos (#437) 2025-10-03 12:28:26 +03:00
Oğuzhan Koral 4b8012f94b fix(macos): appdata path (#438) 2025-09-17 20:35:49 +03:00
Oğuzhan Koral 9871000d84 no more netlify url (#436)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-07-23 17:47:27 +01:00
kekesidavid 17a056b3b9 fix(sketchup) fix for orphan edges (#435)
* fix for orphan edges

* fix
2025-07-10 13:27:34 +03:00
Oğuzhan Koral a8c5bd573f Try adding object ids to render material proxies (#434)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-06-26 22:12:23 +03:00
Oğuzhan Koral 1d2fe047bf Fix: initializing sketchup connector on large models takes a lot (#433)
* Attach observers to only orphan edges

* Do not try to read entities on load
2025-06-26 19:36:35 +03:00
Jedd Morgan 3465f86605 chore(ci): Replace GitVersion (#431) 2025-06-26 11:58:30 +03:00
Oğuzhan Koral 540e727b73 Iterate sections planes over level proxies (#432) 2025-06-23 18:59:24 +03:00
Oğuzhan Koral 8c576f820c Default to unnamed folder name if name is empty string (#429) 2025-05-22 17:28:38 +03:00
Jedd Morgan df3b673064 refactor(ci): Update workflow to use new consolidated deployment workflow (#428)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
* Updated workflow

* update workflow

* target main
2025-04-25 10:43:27 +01:00
Oğuzhan Koral 69bde5539c Add serverUrl and workspaceSlug to model cards (#427)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-04-21 15:06:19 +03:00
Oğuzhan Koral aa12b7b11b remove unnessary logging (#426) 2025-04-21 14:11:45 +03:00
Oğuzhan Koral e0b3b3cca2 Convert revit data object natively (#425) 2025-04-21 14:08:20 +03:00
Jedd Morgan ea9a5741d7 Update config.yml (#424) 2025-04-21 10:30:19 +03:00
Oğuzhan Koral 1fe1c8d5a8 Fix the source of the issue (#423)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-03-28 16:47:56 +03:00
Oğuzhan Koral ac58560a69 Verbose about menu commands and guard about name (#422)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-03-24 15:32:39 +03:00
Oğuzhan Koral d0b234bf3d delete ruby.yml temp (#421)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-03-19 13:32:09 +03:00
oguzhankoral 981fe05c15 deploy over main 2025-03-19 11:50:17 +03:00
Oğuzhan Koral 918550465b No more beta (#418) 2025-03-19 10:20:46 +03:00
Oğuzhan Koral 963d4f1738 Add remove account and remove models (#417) 2025-03-19 10:16:34 +03:00
oguzhankoral d809732280 Merge branch 'dui3/alpha'
# Conflicts:
#	.circleci/config.yml
2025-03-17 23:16:02 +03:00
oguzhankoral c4e38a11b7 run on ubuntu-22.04 2025-03-17 20:03:42 +03:00
oguzhankoral 7abe215bc2 sorry circleci, have you back for now 2025-03-17 20:01:04 +03:00
oguzhankoral 0f269430bc no more circleci 2025-03-17 19:29:39 +03:00
Oğuzhan Koral b8a298c54b Fix: various papercuts (#409)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
* Do not report converted grouped meshes

* remember last selected account on db
2025-03-10 18:36:58 +03:00
Oğuzhan Koral e1d33cd250 fix the highlight freeze (#408) 2025-03-10 16:18:07 +03:00
Oğuzhan Koral 4563dec9bc Debounce progress update (#407) 2025-03-07 21:07:44 +03:00
Oğuzhan Koral de284083fd add defintiion and layer name to instance proxy (#406)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-03-07 12:19:11 +03:00
Oğuzhan Koral 85ee66ca4d Fix(instances): instance name prop is missing (#405)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
* add name to instances

* set name only if it is not empty
2025-03-07 12:04:16 +03:00
Jedd Morgan 5365dc858e Jedd/cxpla 169 update connector deployment ci to error on publishing zero (#404)
* Update deploy.yml

* Update build.yml
2025-03-05 11:47:56 +03:00
Oğuzhan Koral 69f9544638 get accounts always from sqlite - not from cached state (#403)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-02-27 14:57:28 +03:00
Oğuzhan Koral bf5409cf90 Feat(dui3): add properties (#402)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
* rename sketchup_attributes with properties for send

* receive properties

* handle send receive properties
2025-02-18 22:32:05 +03:00
Oğuzhan Koral bd4f668526 Make selection is default (#401)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-01-16 19:34:16 +03:00
Oğuzhan Koral d21df0c6fd Update build.yml
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-12-20 17:33:55 +03:00
Oğuzhan Koral d808fdaa09 Update build.yml 2024-12-20 17:31:44 +03:00
Oğuzhan Koral b32d23b9d6 Do not check speckle_type from level anymore (#400)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-12-19 20:44:13 +03:00
Oğuzhan Koral d1b8ba95df Fix(arc): CNX-712 civil2skp alignments missing pieces (#399)
* Normalize plane axis always

* measure based fix

* backward compatible arcs without measures
2024-12-13 00:26:44 +03:00
Oğuzhan Koral 5e6825bbdb Feat(dui3): sketchup send batches sequentially (#397)
* feat: send batches in sequence and create commit later

* Remove load tests
2024-12-12 12:26:11 +03:00
Oğuzhan Koral 3e5ba136be Align arcs with new object model (#396) 2024-11-11 14:33:23 +00:00
oguzhankoral 294b49a11c Add debug notes 2024-11-11 12:01:09 +00:00
Oğuzhan Koral 9e0cca447f Rename the menu title as Speckle Beta (#393)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-10-26 23:00:11 +03:00
Oğuzhan Koral bc3f23d8dd Add units to root object on send (#392)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-09-23 19:35:01 +03:00
oguzhankoral 4fcf11eaa8 Fix url 2024-09-19 14:27:13 +03:00
Oğuzhan Koral 1f45902837 Add workspace id to model cards (#391)
Co-authored-by: Oguzhan Koral <oguzhankoral@192.168.1.104>
2024-09-16 16:49:22 +03:00
Oğuzhan Koral bc55543e23 Feat(dui3): add new properties to receiver model card (#390)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
* Add new properties to receiver model card

* Update state correctly from read data at doc init
2024-09-11 15:11:54 +03:00
Oğuzhan Koral c1b8ec7036 Create DUI3Config.db file and objects table if not exists (#389)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-09-06 02:12:12 +03:00
Alan Rynne abe9de1b4a fix: Update gitversion to v6 to align with csharp connectors (#388)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-09-03 12:21:42 +02:00
Alan Rynne 09cc83eb14 fix: Prefix tag trigger with v as GitVersion expects (#387)
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2024-09-03 12:01:15 +02:00
Alan Rynne 8f7b3fce0c Added config for dui3/alpha branch. All versions from this branch will be suffixed with beta (#386) 2024-09-03 11:36:07 +02:00
Oğuzhan Koral f121f1adfe Feat(dui3): performance hunting v1 (#385)
* Get rid of unneccessary from_sketchup check everytime

* Correct the hard edge types
2024-09-02 01:24:52 +03:00
Oğuzhan Koral 522ace443a Fix(dui3): CNX-392 sketchup update configs properly (#384)
* Align old update config logic with new DUI3 needs

* Fix the key casing to snake for SketchUp
2024-08-30 15:51:17 +03:00
Oğuzhan Koral 8f97f59a9a Get is dev mode info from config binding and patch with packager (#383) 2024-08-29 19:18:16 +03:00
Oğuzhan Koral 8e9d98cd55 Check nullability (#382) 2024-08-29 15:51:11 +03:00
Oğuzhan Koral 746230caa0 Rename window title too (#381) 2024-08-29 14:30:18 +03:00
Oğuzhan Koral 03e80c6361 Rename the button names (#380) 2024-08-29 14:26:56 +03:00
Oğuzhan Koral bc547c13db Disable retrieving settings from add_send_model_card (#379) 2024-08-28 17:19:36 +03:00
Oğuzhan Koral 173df6128e Namepace alignment from arcgis commits (#378) 2024-08-26 16:30:48 +03:00
Oğuzhan Koral 666d882ec6 Feat(layers): CNX-352 rvt2skp levels have separate tag (#377)
* Place levels and main instance to related model layers

* Cleanup and renaming

* Do not override layers in model instance

* Extract project-model layer and folder creation

* Set layer for section planes
2024-08-26 11:08:24 +03:00
Alan Rynne 6ea13c4edc fix: Sketchup deploy was trying to pull branch that no longer exist (#376) 2024-08-22 15:11:43 +02:00
oguzhankoral 39bdff1c02 Assign materials to back too by default 2024-08-22 15:34:03 +03:00
Alan Rynne 45fc851722 feat: Adds "public release" input to deploy step if build is tagged (#375) 2024-08-22 13:07:27 +02:00
Oğuzhan Koral ede81f3a7d Feat(dui3): CNX-203 skp create tag folders for project model and document names (#374)
* WIP

* Place objects to correct layers

* Fix the rhino layers

* Place rhino layers to model folder correctly

* Clean model folder first

* Handle revit layers nicely

* Clean the all folders under the model
2024-08-22 13:51:31 +03:00
Oğuzhan Koral bae9f30445 Handle back materials (#373) 2024-08-19 13:12:31 +03:00
Oğuzhan Koral 527cefa3ef Introduce converter error for warnings (#372) 2024-08-19 12:32:28 +03:00
Oğuzhan Koral 830aee116e Re-Fix the specific face problem (#371) 2024-08-16 15:18:19 +03:00
Oğuzhan Koral 243fbea769 Include near faces (#370) 2024-08-16 00:38:24 +03:00
Oğuzhan Koral 9c885258d9 Disable ToNativeV1 (#369) 2024-08-16 00:16:20 +03:00
Oğuzhan Koral 0ad4e15f0a Disable receive definition caching (#368) 2024-08-15 15:32:01 +03:00
Oğuzhan Koral a2ba6823a3 Trigger host app error correctly (#367) 2024-08-14 23:01:39 +03:00
Oğuzhan Koral 3713abd860 Fix(dui3): CNX-291 do not even try to delete "Layer0" (#366)
* Do not try to delete Untagged even if it is changed

* Fix removing active layer with correct condition
2024-08-14 21:00:00 +03:00
Alan Rynne 5ae78fb192 CXPLA-26 Update CI jobs to pass correct version to deploy step. (#365)
* Fix: Add info_version and pass it to deploy step

* fix: Rename build outputs to have clear meaning

* fix: Remove `deploy/` branch exception

* fix: Correct build job outputs + test deploy
2024-08-14 13:58:18 +02:00
Oğuzhan Koral 0b694833fb Implement card settings logic (#364) 2024-08-13 20:09:21 +03:00
Alan Rynne dfd82e6d40 feat: Add GitVersion to sketchup CI run (#363)
* feat: Add GitVersion to sketchup CI run

* fix: Temp trigger from my branch

* feat: Separate build and deploy jobs

* fix: Missing value field on build workflow

* fix: Job names

* fix: Remove on push for build job

* fix: Pull request trigger

* fix: Only trigger on dui3/alpha branch
2024-08-13 19:43:49 +03:00
Oğuzhan Koral 1694786177 Switch layer to Untagged if matches (#362) 2024-08-12 14:54:26 +03:00
Oğuzhan Koral ec72cc1454 Fix(dui3): stringfy application id and proxy object ids (#361)
* Use string for every piece of persistent_id

* Also convert collected persistent_ids to string too

* Correct the url with non-branch version
2024-08-12 11:35:28 +03:00
Oğuzhan Koral 37ba4d9a80 Fix layer type (#360) 2024-08-08 20:13:45 +03:00
Oğuzhan Koral 526e497037 Remove total childen count from everywhere (#359) 2024-08-08 15:42:37 +03:00
Oğuzhan Koral a81a723ba8 Skip definition deletion and do not remove active layer (#358) 2024-08-08 00:26:17 +03:00
Oğuzhan Koral 5976898f07 Feat(dui3): CNX-222 colors in sketchup (#357)
* Unpack color proxies

* Receive layer colors

* Fix applicationId issue on layers

* Consider proxies are null
2024-08-07 23:23:14 +03:00
Oğuzhan Koral 09fec26841 Fix(dui3): CNX-208 skp missing and borked geometry (#356)
* Do not try to assign material if root_render_material_proxies is nil

* Do not try to get color from layer, will need CNX-222

* Fix autocad polycurves and better reporting

* Fix flipped arcs
2024-08-07 18:11:31 +03:00
Oğuzhan Koral 165eb238b5 Face instances to Bilal (#355) 2024-08-07 15:24:48 +03:00
Oğuzhan Koral de305a3508 Force string type check fixes render material issue (#354) 2024-08-07 14:57:47 +03:00
Oğuzhan Koral d124478a92 Unify function name with .net (#353) 2024-08-05 17:56:02 +03:00
Oğuzhan Koral d9acc5b39d Reset dialog location to mid for focused window (#352) 2024-08-04 22:07:01 +03:00
Oğuzhan Koral 5b91a04e1e Feat(dui3): v3 installer build test (#351)
* Create v3-fake.yml

* Run on PR

* Disable patching iss

* Fix typoo

* Rename artifact to sketchup

* Add deployment steps

* Do not name artifact name

* Define which branch to build installer

* Align CI installers with new branch and files

* Get patch installer back

* Remove circleci again

* Rename file and enable tags

* Test enabling PR runs

* Test nested folders

* Test single path dll

* add all things

* try zipping manually first

* don't need sub dir

* rename zip

* Use version from env variables

* Test git version

* More test

* Test

* Revert

* install gitversion

* test

* Use hardcoded version

* Remove pull request trigger

---------

Co-authored-by: Adam Hathcock <adam@speckle.systems>
2024-08-02 15:08:20 +03:00
Oğuzhan Koral d145ce52f7 Sketchup DUI2-DUI3 side by side (#350)
* New sqlite3 libraries for new namespace

* Rename top level module to SpeckleConnector3

* Register extension as v3

* Add new sqlite3 libraries for mac

* Update bundle files for hybrid build mac/intel

* Rename speckle_connector_loader for v3

* Rename file and folder

* Rename loader
2024-07-31 19:26:38 +03:00
Oğuzhan Koral ec598bf4a8 Global toast from top level exception handler (#349)
* Set global notification on handling error

* Add notes
2024-07-27 15:41:06 +03:00
Oğuzhan Koral 568e679e3f Feat(dui3): render materials via proxy (#348)
* Send render materials

* Receive materials from proxy

* Do not set materials to instance and face
2024-07-25 23:52:01 +03:00
Oğuzhan Koral 85cc49f4d9 Temp hack for deep clean (#347) 2024-07-22 20:02:27 +03:00
oguzhankoral 65b07d44ab Tooling around skippy for 2024 debug 2024-07-22 14:40:53 +03:00
oguzhankoral f87bc98169 Doc for sorted_set 2024-07-22 14:03:46 +03:00
oguzhankoral 04270a8abc Upgrade debugger for Ruby 3.2 and SU 2024 2024-07-22 13:14:03 +03:00
Oğuzhan Koral 65fa47c9ac Upgrade xcode to 13.4.1 (#346) 2024-07-20 13:26:15 +03:00
Oğuzhan Koral 9367ea7e17 Layers and colors (#345) 2024-07-18 20:12:41 +02:00
Oğuzhan Koral b7ac9d1fee Receive skp groups as components (#344) 2024-07-18 15:51:29 +02:00
oguzhankoral 20528f72df Merge remote-tracking branch 'origin/development' 2024-03-19 13:32:03 +03:00
oguzhankoral ad9af9bb3d Merge remote-tracking branch 'origin/development' 2024-02-27 12:38:00 +03:00
oguzhankoral 133308141b Merge branch 'development' 2023-11-28 13:57:11 +03:00
344 changed files with 2382 additions and 1598 deletions
Vendored
BIN
View File
Binary file not shown.
+9 -281
View File
@@ -1,289 +1,17 @@
version: 2.1
orbs:
# Using windows for builds
win: circleci/windows@2.4.0
# Upload artifacts to s3
aws-s3: circleci/aws-s3@2.0.0
# Define the jobs we want to run for this project
jobs:
build-ui:
build:
docker:
- image: "circleci/node:16"
- image: cimg/base:2023.03
steps:
- checkout
- run:
command: "npm install"
working_directory: "ui"
- run:
command: "npm run build"
working_directory: "ui"
- persist_to_workspace:
root: ./
paths:
- speckle_connector/vue_ui
build-connector: # Reusable job for basic connectors
executor:
name: win/default # comes with python 3.7.3
shell: powershell.exe
parameters:
slug:
type: string
default: ""
environment:
SSM: 'C:\Program Files\DigiCert\DigiCert One Signing Manager Tools'
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Set Environment Variable
shell: powershell.exe
command: |
$tag = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "2.0.999" } else { $env:CIRCLE_TAG }
$semver = if($tag.Contains('/')) {$tag.Split("/")[0] } else { $tag }
$ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver }
$version = "$($ver).$($env:WORKFLOW_NUM)"
python patch_version.py $semver
environment:
WORKFLOW_NUM: << pipeline.number >>
- unless: # Build installers unsigned on non-tagged builds
condition: << pipeline.git.tag >>
steps:
- run:
name: Build Installer
command: speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\sketchup.iss /Sbyparam=$p
shell: cmd.exe # does not work in powershell
- when: # Setup certificates and build installers signed for tagged builds
condition: << pipeline.git.tag >>
steps:
- run:
name: "Digicert Signing Manager Setup"
command: |
cd C:\
curl.exe -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:$env:SM_API_KEY" -o smtools-windows-x64.msi
msiexec.exe /i smtools-windows-x64.msi /quiet /qn | Wait-Process
- run:
name: "Create Auth & OV Signing Cert"
command: |
cd C:\
echo $env:SM_CLIENT_CERT_FILE_B64 > certificate.txt
certutil -decode certificate.txt certificate.p12
- run:
name: "Sync Certs"
command: |
& $env:SSM\smksp_cert_sync.exe
- run:
name: "Build Installer"
command: speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\sketchup.iss /Sbyparam=$p /DSIGN_INSTALLER /DCODE_SIGNING_CERT_FINGERPRINT=%SM_CODE_SIGNING_CERT_SHA1_HASH%
shell: cmd.exe
- persist_to_workspace:
root: ./
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
steps:
- add_ssh_keys:
fingerprints:
- "03:2e:ee:4f:14:67:2b:88:32:e8:cc:f0:cb:df:92:29"
- run:
name: I know Github as a host
command: |
mkdir ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
- run:
name: Clone
command: git clone git@github.com:specklesystems/speckle-sharp-ci-tools.git speckle-sharp-ci-tools
- run:
name: Checkout branch
command: |
cd speckle-sharp-ci-tools
if [ -z "$CIRCLE_TAG" ]
then
git checkout ${CIRCLE_BRANCH} || git checkout main
else
git checkout ${CIRCLE_TAG} || git checkout main
fi
- persist_to_workspace:
root: ./
paths:
- speckle-sharp-ci-tools
deploy-manager2:
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
parameters:
slug:
type: string
os:
type: string
extension:
type: string
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Install Manager Feed CLI
command: dotnet tool install --global Speckle.Manager.Feed
- run:
name: Upload new version
command: |
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
/root/.dotnet/tools/Speckle.Manager.Feed deploy -s << parameters.slug >> -v ${SEMVER} -u https://releases.speckle.dev/installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.<< parameters.extension >> -o << parameters.os >> -f speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.<< parameters.extension >>
- run: echo "so long and thanks for all the fish"
# Orchestrate our job run sequence
workflows:
build-and-deploy:
build_and_test:
when:
false
jobs:
- get-ci-tools:
filters:
tags:
only: /.*/
- build-ui:
filters:
tags:
only: /.*/
- build-connector:
slug: sketchup
requires:
- get-ci-tools
- build-ui
filters:
tags:
only: /.*/
context: digicert-keylocker
- 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:
- 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\/.*/
- build
+64
View File
@@ -0,0 +1,64 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Build
on:
pull_request:
workflow_call:
outputs:
semver:
description: "The full SemVer 2.0 version of this build, e.g. '3.0.0-alpha.1234' (note: no 'v'-prefix)"
value: ${{ jobs.build.outputs.semver }}
file_version:
description: "The file info version, e.g. '3.0.0.1234'"
value: ${{ jobs.build.outputs.file_version }}
jobs:
build:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.set-version.outputs.semver }}
file_version: ${{ steps.set-version.outputs.file-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- id: set-version
name: Set version to output
shell: bash
run: |
TAG=${{ github.ref_name }}
if [[ "${{ github.ref }}" != refs/tags/* ]]; then
TAG="v3.0.99.${{ github.run_number }}"
fi
SEMVER="${TAG#v}"
FILE_VERSION=$(echo "$TAG" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
FILE_VERSION="$FILE_VERSION.${{ github.run_number }}"
echo "semver=$SEMVER" >> "$GITHUB_OUTPUT"
echo "file-version=$FILE_VERSION" >> "$GITHUB_OUTPUT"
echo $SEMVER
echo $FILE_VERSION
- name: Set connector version
run: |
python patch_version.py ${{steps.set-version.outputs.semver}}
- uses: montudor/action-zip@v1
with:
args: zip -q -r sketchup.zip vendor speckle_connector_3/ speckle_connector_3.rb
- name: ⬆️ Upload artifacts
uses: actions/upload-artifact@v4
with:
name: output-${{steps.set-version.outputs.semver}}
path: sketchup.zip
retention-days: 1
if-no-files-found: error
compression-level: 0 # no compression
-78
View File
@@ -1,78 +0,0 @@
name: Update issue Status
on:
issues:
types: [closed]
jobs:
update_issue:
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ORGANIZATION: specklesystems
PROJECT_NUMBER: 9
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
echo "$PROJECT_ID"
echo "$STATUS_FIELD_ID"
echo 'DONE_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .settings | fromjson | .options[] | select(.name== "Done") | .id' project_data.json) >> $GITHUB_ENV
echo "$DONE_ID"
- name: Add Issue to project #it's already in the project, but we do this to get its node id!
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $id:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $id}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f id=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
- name: Update Status
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $status:ID!, $id:ID!, $value:String!) {
set_status: updateProjectNextItemField(
input: {
projectId: $project
itemId: $id
fieldId: $status
value: $value
}
) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f status=$STATUS_FIELD_ID -f id=$ITEM_ID -f value=${{ env.DONE_ID }}
+42
View File
@@ -0,0 +1,42 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Build and deploy
on:
push:
branches: ["main", "installer-test/**"]
tags: ["v3.*.*"] # Manual delivery on every 3.x tag
jobs:
build:
uses: ./.github/workflows/build.yml
deploy-installers:
runs-on: ubuntu-latest
needs: build
env:
IS_PUBLIC_RELEASE: ${{ github.ref_type == 'tag' }}
steps:
- name: 🔫 Trigger Build Installer(s)
uses: the-actions-org/workflow-dispatch@v4.0.0
with:
workflow: Build Installers
repo: specklesystems/connector-installers
token: ${{ secrets.CONNECTORS_GH_TOKEN }}
inputs: '{
"run_id": "${{ github.run_id }}",
"semver": "${{ needs.build.outputs.semver }}",
"file_version": "${{ needs.build.outputs.file_version }}",
"repo": "${{ github.repository }}",
"is_public_release": ${{ env.IS_PUBLIC_RELEASE }}
}'
ref: main
wait-for-completion: true
wait-for-completion-interval: 10s
wait-for-completion-timeout: 10m
display-workflow-run-url: true
display-workflow-run-url-interval: 10s
- uses: geekyeggo/delete-artifact@v5
with:
name: output-*
-50
View File
@@ -1,50 +0,0 @@
name: Move new issues into Project
on:
issues:
types: [opened]
jobs:
track_issue:
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ORGANIZATION: specklesystems
PROJECT_NUMBER: 9
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
- name: Add Issue to project
env:
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $id:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $id}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f id=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
-38
View File
@@ -1,38 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: Ruby
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7']
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake
+2 -2
View File
@@ -10,8 +10,8 @@
settings.json
# vue app build dist folder
speckle_connector/vue_ui
speckle_connector/html
speckle_connector_3/vue_ui
speckle_connector_3/html
# speckle-sharp-ci-tools
/speckle-sharp-ci-tools
+1 -1
View File
@@ -18,7 +18,7 @@ AllCops:
- '_tools/su_attributes/**/*.rb'
- '_sqlite3/**/*.rb'
- 'ui/**/*'
- 'speckle_connector/src/ext/**/*.rb'
- 'speckle_connector_3/src/ext/**/*.rb'
- 'vendor/bundle/**/*'
- 'tests/**/*.rb'
SketchUp:
+1 -1
View File
@@ -1,6 +1,6 @@
require_paths:
- "C:/Program Files/SketchUp/SketchUp 2021/Tools"
- speckle_connector
- speckle_connector_3
require:
- sketchup-api-stubs
+3 -1
View File
@@ -24,6 +24,8 @@ group :development do
gem 'rubycritic', '~> 4.3', '>= 4.3.3', require: false
# Auto completions for SketchUp API.
gem 'sketchup-api-stubs'
# Runtime dependency of skippy for Ruby 3.2. Have it!
gem 'sorted_set', '~> 1.0'
# Aid with common SketchUp extension tasks.
gem 'skippy', '~> 0.4.1.a'
gem 'skippy', '~> 0.5.2.a'
end
+13 -5
View File
@@ -26,7 +26,7 @@ GEM
path_expander (~> 1.0)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.8)
git (1.18.0)
git (1.19.1)
addressable (~> 2.8)
rchardet (~> 1.8)
ice_nine (0.11.2)
@@ -51,6 +51,7 @@ GEM
public_suffix (5.0.1)
rainbow (3.1.1)
rake (13.0.6)
rbtree (0.4.6)
rchardet (1.8.0)
reek (6.1.1)
kwalify (~> 0.7.0)
@@ -89,6 +90,7 @@ GEM
simplecov (>= 0.17.0)
tty-which (~> 0.4.0)
virtus (~> 1.0)
set (1.1.0)
sexp_processor (4.16.1)
simplecov (0.21.2)
docile (~> 1.1)
@@ -97,11 +99,15 @@ GEM
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sketchup-api-stubs (0.7.8)
skippy (0.4.3.a)
skippy (0.5.2.a)
git (~> 1.3)
naturally (~> 2.1)
thor (~> 0.19)
thor (0.20.3)
sorted_set (~> 1.0)
thor (>= 0.19, < 2.0)
sorted_set (1.0.3)
rbtree
set (~> 1.0)
thor (1.3.1)
thread_safe (0.3.6)
tty-which (0.4.2)
unicode-display_width (1.8.0)
@@ -112,6 +118,7 @@ GEM
equalizer (~> 0.0, >= 0.0.9)
PLATFORMS
x64-mingw-ucrt
x64-mingw32
x64-unknown
x86_64-linux
@@ -127,7 +134,8 @@ DEPENDENCIES
rubocop-sketchup
rubycritic (~> 4.3, >= 4.3.3)
sketchup-api-stubs
skippy (~> 0.4.1.a)
skippy (~> 0.5.2.a)
sorted_set (~> 1.0)
BUNDLED WITH
2.3.25
+11
View File
@@ -0,0 +1,11 @@
workflow: GitFlow/v1
next-version: 3.0.0
mode: ManualDeployment
branches:
main:
label: rc
develop:
regex: ^dui3/alpha$
label: beta
unknown:
increment: None
+18 -4
View File
@@ -49,9 +49,9 @@ This repo is split into three parts:
### 1. **Speckle Connector extension**
Includes the `ruby` source files to run extension on SketchUp environment. SketchUp Extensions are composed of
a **.rb** file as entry and **folder** that .rb file refers to. In our case entry file is `speckle_connector.rb`
a **.rb** file as entry and **folder** that .rb file refers to. In our case entry file is `speckle_connector_3.rb`
that responsible to register Speckle Connector extension to SketchUp and also it shows address to where extension
will start to read extension. Source folder is `speckle_connector`.
will start to read extension. Source folder is `speckle_connector_3`.
### 2. **User Interface**
@@ -64,7 +64,7 @@ This repo is split into three parts:
we use extensions as native part of the source `ruby` code.
After building `sqlite3.sln` file, compiled `sqlite3.so` (for Windows) and `sqlite3.bundle` (for OSX) dynamic library files are created
by solution to place them into source code into `speckle_connector/src/ext`. Building this project should be only
by solution to place them into source code into `speckle_connector_3/src/ext`. Building this project should be only
happen when SketchUp starts to support newer Ruby versions (currently it is `2.7`).
## Contribution Guide
@@ -115,9 +115,23 @@ You can now open up the repo in VS Code or you can use JetBrains' tools RubyMine
If you will use VS Code, make sure you've installed the Ruby extension for VS Code.
#### RubyMine
To debug:
- Add configuration as **'Ruby remote debug'**
- Remote host: localhost
- Remote port: 7000
- Remote root folder: <repo_path>
- Local port: 26162
- Local root folder: <repo_path>
- Run below script
bundle exec skippy sketchup:debug 2024
- When sketchup opened, click Debug button on RubyMine
### Loading the Speckle Connector Plugin
1. Find already prepared `speckle_connector_loader.rb` file on the `_tools`
1. Find already prepared `speckle_connector_3_loader.rb` file on the `_tools`
folder.
2. Copy this Ruby file into your SketchUp Plugins directory. You will likely find this at:
`C:\Users\{YOU}\AppData\Roaming\SketchUp\SketchUp 20XX\SketchUp\Plugins`
+3 -3
View File
@@ -32,12 +32,12 @@ end
# Glob pattern to match source files. Defaults to FileList['.'].
ruby_critic_paths = FileList[
'speckle_connector/**/*.rb',
'speckle_connector.rb',
'speckle_connector_3/**/*.rb',
'speckle_connector_3.rb',
'tests/**/*.rb'] -
FileList[
'_tools/**/*.rb',
'speckle_connector/src/ext/**/*.rb',
'speckle_connector_3/src/ext/**/*.rb',
]
# for local
+15
View File
@@ -0,0 +1,15 @@
# This is for automated pre-debugger configuration.
# We run skippy first, then activate debugger.
# The purpose of this file to wait till skp is live
# To establish a configuration
# 1. Create 'Run External Tool' before lunch step
# 2. Program -> C:\Ruby32-x64\bin\ruby.exe or whatever
# 3. Arguments -> C:\Users\KORAL\Documents\Git\Speckle\speckle-sketchup\_tools\debugger\bundle_exec_2024.rb or whatever
# 4. Working directory -> C:\Users\KORAL\Documents\Git\Speckle\speckle-sketchup or whatever
# Add a delay of 10 seconds, it is arbitrary, do not hesitate to change for what works best for you
sleep(10)
# Execute the original command
exec('bundle exec skippy sketchup:debug 2024')
+1 -1
View File
@@ -24,7 +24,7 @@ module JF_RubyToolbar
def self.load_toolbar
@last_dir = "#{$LOAD_PATH[0]}/"
@last_dir = @last_dir.gsub('/', '\\\\\\\\')
@last_dir = File.join($JF_RUBYTOOLBAR, 'speckle_connector')
@last_dir = File.join($JF_RUBYTOOLBAR, 'speckle_connector_3')
curdir = File.dirname __FILE__
# create toolbar
@@ -10,7 +10,7 @@
# Create a link to Plugins folder with this command
# rubocop:disable Layout/LineLength
# New-Item -ItemType SymbolicLink -Path '~\AppData\Roaming\SketchUp\SketchUp 2022\SketchUp\Plugins\speckle_connector_loader.rb' -Target ~\Git\Speckle\speckle-sketchup\_tools\speckle_connector_loader.rb
# New-Item -ItemType SymbolicLink -Path '~\AppData\Roaming\SketchUp\SketchUp 2022\SketchUp\Plugins\speckle_connector_3_loader.rb' -Target ~\Git\Speckle\speckle-sketchup\_tools\speckle_connector_3_loader.rb
# rubocop:enable Layout/LineLength
SKETCHUP_CONSOLE.show # if you want to show Ruby console on startup
@@ -32,7 +32,7 @@ $LOAD_PATH << File.join(speckle_path, '_tools')
$JF_RUBYTOOLBAR = speckle_path
# rubocop:enable Style/GlobalVars
files = %w[speckle_connector jf_RubyPanel su_attributes]
files = %w[speckle_connector_3 jf_RubyPanel su_attributes]
files.each do |ruby_file|
puts "Loading #{ruby_file}"
+8 -2
View File
@@ -4,7 +4,7 @@ import sys
def patch_connector(tag):
"""Patches the connector version within the connector file"""
rb_file = "speckle_connector.rb"
rb_file = "speckle_connector_3.rb"
with open(rb_file, "r") as file:
lines = file.readlines()
@@ -15,6 +15,12 @@ def patch_connector(tag):
print(f"Patched connector version number in {rb_file}")
break
for (index, line) in enumerate(lines):
if 'DEV_MODE = ' in line:
lines[index] = f' DEV_MODE = false\n'
print(f"Patched dev mode to false in {rb_file}")
break
with open(rb_file, "w") as file:
file.writelines(lines)
@@ -45,7 +51,7 @@ def main():
print(f"Patching version: {tag}")
patch_connector(tag)
patch_installer(tag)
# patch_installer(tag)
if __name__ == "__main__":
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

@@ -1,44 +0,0 @@
# frozen_string_literal: true
require 'JSON'
require_relative '../ext/sqlite3'
require_relative '../constants/path_constants'
module SpeckleConnector
# Accounts to communicate with models on user's account.
module Accounts
# Load accounts from user's app data.
def self.load_accounts
db_path = SPECKLE_ACCOUNTS_DB_PATH
unless File.exist?(db_path)
raise(
IOError,
"No Accounts db found. Please read the guide for different options for adding your account:\n
https://speckle.guide/user/manager.html#adding-accounts"
)
end
db = Sqlite3::Database.new(db_path)
rows = db.exec('SELECT * FROM objects')
db.close
rows.map { |row| JSON.parse(row[1]) }
end
def self.get_account_by_id(id)
accounts = load_accounts
accounts.select { |acc| acc['id'] == id }[0]
end
# Default account on the user computer.
def self.default_account
accounts = load_accounts
accounts.select { |acc| acc['isDefault'] }[0] || accounts[0]
end
# Try to get local server account for debug/test purposes.
def self.try_get_local_server_account
accounts = load_accounts
accounts.select { |acc| acc['serverInfo']['url'].include?('localhost') }[0] || nil
end
end
end
@@ -1,77 +0,0 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../accounts/accounts'
require_relative '../../convertors/units'
require_relative '../../convertors/to_speckle_v2'
require_relative '../../operations/send'
require_relative '../../sketchup_model/definitions/definition_manager'
module SpeckleConnector
module Actions
# Send to server.
class Send < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, model_card_id)
# Set active path always to model to be safe always. Later we can address it
state.sketchup_state.sketchup_model.active_path = nil
model_card = state.speckle_state.send_cards[model_card_id]
unless model_card.send_filter.selected_object_ids.any?
resolve_js_script = "sendBinding.receiveResponse('#{resolve_id}')"
state = state.with_add_queue_js_command('resolveSend', resolve_js_script)
args = {
modelCardId: model_card_id,
error: 'No objects were found. Please update your send filter!'
}
js_script = "sendBinding.emit('setModelError', #{args.to_json})"
return state.with_add_queue_js_command('setModelsError', js_script)
end
entities = state.sketchup_state.sketchup_model.entities.select do |e|
model_card.send_filter.selected_object_ids.any?(e.persistent_id)
end
unpacked_entities = SketchupModel::Definitions::DefinitionManager
.new(Converters::SKETCHUP_UNITS[state.sketchup_state.length_units])
.unpack_entities(entities)
account = Accounts.get_account_by_id(model_card.account_id)
converter = Converters::ToSpeckleV2.new(state, unpacked_entities, model_card)
new_speckle_state, base = converter.convert_entities_to_base_blocks_poc
base[:instanceDefinitionProxies] = unpacked_entities.instance_definition_proxies
id, total_children_count, batches, refs = converter.serialize(base, state.user_state.preferences)
new_speckle_state = new_speckle_state.with_object_references(model_card.project_id, refs)
new_speckle_state = new_speckle_state.with_empty_changed_entity_persistent_ids
new_speckle_state = new_speckle_state.with_empty_changed_entity_ids
puts("converted #{base.count} objects for stream #{model_card.project_id}")
state = state.with_speckle_state(new_speckle_state)
resolve_js_script = "sendBinding.receiveResponse('#{resolve_id}')"
state = state.with_add_queue_js_command('send', resolve_js_script)
args = {
modelCardId: model_card_id,
projectId: model_card.project_id,
modelId: model_card.model_id,
token: account['token'],
serverUrl: account['serverInfo']['url'],
accountId: model_card.account_id,
message: model_card.message,
sendConversionResults: converter.conversion_results,
sendObject: {
id: id,
totalChildrenCount: total_children_count,
batches: batches
}
}
js_script = "sendBinding.emit('sendViaBrowser', #{args.to_json})"
state.with_add_queue_js_command('sendViaBrowser', js_script)
end
end
end
end
@@ -1,19 +0,0 @@
# frozen_string_literal: true
require_relative 'card'
module SpeckleConnector
module Cards
# Send card for sketchup connector to communicate speckle.
class SendCardMultipleFilters < Card
# @return [Hash{String=>Filter}] filters of the card.
attr_reader :filters
def initialize(card_id, account_id, project_id, model_id, filters)
super(card_id, account_id, project_id, model_id)
@filters = filters
self[:filters] = filters
end
end
end
end
@@ -1,9 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
APP_OBSERVER = 'SpeckleConnector::Observers::AppObserver'
ENTITIES_OBSERVER = 'SpeckleConnector::Observers::EntitiesObserver'
ENTITY_OBSERVER = 'SpeckleConnector::Observers::EntityObserver'
MODEL_OBSERVER = 'SpeckleConnector::Observers::ModelObserver'
SELECTION_OBSERVER = 'SpeckleConnector::Observers::SelectionObserver'
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,44 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
module SketchupModel
# Query operations in sketchup model.
module Query
# Queries for layer and it's parents.
class Layer
class << self
# @param layer [Sketchup::Layer] layer to get folder path of the layer
# @return [Array<Sketchup::Folder>] path of the layer
def path(layer)
parent_folders = []
folder = layer.folder
until folder.nil?
parent_folders.append(folder)
folder = folder.folder
end
parent_folders.reverse
end
# @param entity [Sketchup::Entity] entity to find path.
def entity_path(entity, separation = '::')
path = path(entity.layer)
full_path = path.append(entity.layer)
full_path_string = ''
full_path.each_with_index do |layer, i|
full_path_string += layer.display_name
full_path_string += separation unless i == full_path.length - 1
end
full_path_string
end
# @param string_layer_path [String] string layer path to split.
def entity_layer_from_path(string_layer_path, separation = '::')
return string_layer_path if string_layer_path.nil?
string_layer_path.split(separation).last
end
end
end
end
end
end
@@ -1,107 +0,0 @@
# frozen_string_literal: true
require_relative '../base'
require_relative '../other/color'
module SpeckleConnector
module SpeckleObjects
module Relations
# Sketchup layer (tag) tree relation.
class Layer < Base
SPECKLE_TYPE = 'Speckle.Core.Models.Collection'
# rubocop:disable Metrics/ParameterLists
def initialize(name:, visible:, is_folder:, full_path: nil, line_style: nil, color: nil, layers_and_folders: [],
application_id: nil)
super(
speckle_type: SPECKLE_TYPE,
total_children_count: 0,
application_id: application_id,
id: nil
)
self[:name] = name
self[:color] = color
self[:visible] = visible
self[:is_folder] = is_folder
self[:full_path] = full_path unless full_path.nil?
self[:line_style] = line_style unless line_style.nil?
self[:collectionType] = 'layer'
self[:elements] = layers_and_folders if layers_and_folders.any?
end
# rubocop:enable Metrics/ParameterLists
# @param speckle_layer [Object] speckle layer object.
# @param folder [Sketchup::Layers, Sketchup::LayerFolder] folder to create layers in it.
# @param sketchup_model [Sketchup::Model] sketchup active model.
def self.to_native_layer(speckle_layer, folder, sketchup_model)
layer = sketchup_model.layers.add_layer(speckle_layer[:name])
layer.visible = speckle_layer[:visible] unless speckle_layer[:visible].nil?
layer.color = SpeckleObjects::Other::Color.to_native(speckle_layer[:color]) if speckle_layer[:color]
if speckle_layer[:line_style]
line_style = sketchup_model.line_styles.find { |ls| ls.name == speckle_layer[:line_style] }
layer.line_style = line_style unless line_style.nil?
end
folder.add_layer(layer) if folder.is_a?(Sketchup::LayerFolder)
end
# Flat layer conversion.
def self.to_native_flat_layers(layers_relation, sketchup_model)
speckle_layers = layers_relation[:elements]
elements_to_layers(speckle_layers, sketchup_model)
end
# Converts elements to layers with it's full path.
def self.elements_to_layers(elements, sketchup_model)
elements.each do |element|
element[:name] = element[:full_path]
to_native_layer(element, sketchup_model.layers, sketchup_model)
elements_to_layers(element[:elements], sketchup_model) unless element[:elements].nil?
end
end
# Nested layer conversion with folders.
def self.to_native_layer_folder(layers_relation, folder, sketchup_model)
speckle_layers = layers_relation[:elements].select { |layer_or_fol| layer_or_fol[:elements].nil? }
speckle_layers.each do |speckle_layer|
to_native_layer(speckle_layer, folder, sketchup_model)
end
speckle_folders = layers_relation[:elements].reject { |layer_or_fol| layer_or_fol[:elements].nil? }
speckle_folders.each do |speckle_folder|
sub_folder = folder.add_folder(speckle_folder[:name])
sub_folder.visible = speckle_folder[:visible] unless speckle_folder[:visible].nil?
to_native_layer_folder(speckle_folder, sub_folder, sketchup_model)
end
end
# @param folder [Sketchup::LayerFolder] sketchup layer folder that might contains other folders and layers.
def self.from_folder(folder)
layers = folder.layers.collect { |layer| from_layer(layer) }
sub_folders = folder.folders.collect { |sub_folder| from_folder(sub_folder) }
Layer.new(
name: folder.display_name,
visible: folder.visible?,
is_folder: true,
layers_and_folders: layers + sub_folders,
application_id: folder.persistent_id
)
end
# @param layer [Sketchup::Layer] sketchup layer (tag) that objects can be assigned..
def self.from_layer(layer)
Layer.new(
name: layer.display_name,
visible: layer.visible?,
is_folder: false,
line_style: layer.line_style.nil? ? nil : layer.line_style.name,
color: SpeckleObjects::Other::Color.to_speckle(layer.color),
application_id: layer.persistent_id
)
end
end
end
end
end
@@ -1,19 +0,0 @@
# frozen_string_literal: true
require_relative 'binding'
require_relative '../../actions/get_accounts'
module SpeckleConnector
module Ui
ACCOUNTS_BINDING_NAME = 'accountsBinding'
# Binding that provided for DUI.
class AccountsBinding < Binding
def commands
@commands ||= {
getAccounts: Commands::ActionCommand.new(@app, self, Actions::GetAccounts)
}.freeze
end
end
end
end
@@ -1,21 +0,0 @@
# frozen_string_literal: true
require_relative 'binding'
require_relative '../../actions/config_actions/get_config'
require_relative '../../actions/config_actions/update_config'
module SpeckleConnector
module Ui
CONFIG_BINDING_NAME = 'configBinding'
# Config binding that provided for DUI.
class ConfigBinding < Binding
def commands
@commands ||= {
getConfig: Commands::ActionCommand.new(@app, self, Actions::GetConfig),
updateConfig: Commands::ActionCommand.new(@app, self, Actions::UpdateConfig)
}.freeze
end
end
end
end
@@ -4,7 +4,7 @@ require 'sketchup'
require 'extensions'
# Speckle connector module to enable multiplayer mode ON!
module SpeckleConnector
module SpeckleConnector3
# Version - patched by CI
CONNECTOR_VERSION = '0.0.0'
@@ -23,11 +23,11 @@ module SpeckleConnector
PATH = File.join(PATH_ROOT, folder_name).freeze
# Run from localhost or from build files
DEV_MODE = false
DEV_MODE = true
puts("Loading Speckle Connector v#{CONNECTOR_VERSION} from #{DEV_MODE ? 'dev' : 'build'}")
unless file_loaded?(__FILE__)
ex = SketchupExtension.new('Speckle SketchUp', File.join(PATH, 'bootstrap'))
ex = SketchupExtension.new('Speckle SketchUp v3', File.join(PATH, 'bootstrap'))
ex.description = 'Speckle Connector for SketchUp'
ex.version = CONNECTOR_VERSION
ex.copyright = 'AEC Systems Ltd.'
BIN
View File
Binary file not shown.
@@ -2,7 +2,7 @@
require 'sketchup'
require 'pathname'
require 'speckle_connector/debug'
require 'speckle_connector_3/debug'
require_relative 'src/log/log'
require_relative 'src/ui/sketchup_ui'
require_relative 'src/ui/ui_controller'
@@ -13,7 +13,7 @@ require_relative 'src/states/initial_state'
require_relative 'src/commands/speckle_menu_commands'
# Speckle Connector on SketchUp to enable Multiplayer mode ON!
module SpeckleConnector
module SpeckleConnector3
SKETCHUP_VERSION = Sketchup.version.to_i
dir = __dir__.dup
@@ -24,9 +24,9 @@ module SpeckleConnector
sketchup_ui = Ui::SketchupUi.new
ui_controller = Ui::UiController.new(sketchup_ui)
menu_commands = Commands::MenuCommandHandler.new
user_state = SpeckleConnector::States::UserState.new({})
initial_state = SpeckleConnector::States::InitialState.new(user_state)
app = SpeckleConnector::App::SpeckleConnectorApp.new(menu_commands, initial_state, ui_controller)
user_state = SpeckleConnector3::States::UserState.new({})
initial_state = SpeckleConnector3::States::InitialState.new(user_state)
app = SpeckleConnector3::App::SpeckleConnectorApp.new(menu_commands, initial_state, ui_controller)
# Add menu commands to SketchUp and Speckle application
Commands::SpeckleMenuCommands.add_initial_commands!(app)
app
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Speckle connector module to enable multiplayer mode ON!
module SpeckleConnector
module SpeckleConnector3
# from thomthom
# https://github.com/thomthom/true-bend/blob/master/src/tt_truebend/debug.rb

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 665 B

After

Width:  |  Height:  |  Size: 665 B

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.
@@ -0,0 +1,103 @@
# frozen_string_literal: true
require 'JSON'
require 'fileutils'
require_relative '../ext/sqlite3'
require_relative '../constants/path_constants'
require_relative '../preferences/preferences'
module SpeckleConnector3
# Accounts to communicate with models on user's account.
module Accounts
# Load accounts from user's app data.
def self.load_accounts
db_path = SPECKLE_ACCOUNTS_DB_PATH
unless File.exist?(db_path)
# Ensure parent directory exists before creating the database file
FileUtils.mkdir_p(File.dirname(db_path))
File.new(SPECKLE_ACCOUNTS_DB_PATH, "w")
db = Sqlite3::Database.new(SPECKLE_ACCOUNTS_DB_PATH)
Preferences.create_objects_table(db)
db.close
return []
end
db = Sqlite3::Database.new(db_path)
rows = db.exec('SELECT * FROM objects')
db.close
rows.map { |row| JSON.parse(row[1]) }
end
def self.add_account(account_id, account)
unless File.exist?(SPECKLE_ACCOUNTS_DB_PATH)
# Ensure parent directory exists before creating the database file
FileUtils.mkdir_p(File.dirname(SPECKLE_ACCOUNTS_DB_PATH))
File.new(SPECKLE_ACCOUNTS_DB_PATH, "w")
db = Sqlite3::Database.new(SPECKLE_ACCOUNTS_DB_PATH)
create_objects_table(db)
db.close
end
db = Sqlite3::Database.new(SPECKLE_ACCOUNTS_DB_PATH)
account_json = JSON.generate(account)
sql_query = "INSERT OR REPLACE INTO objects (hash, content) VALUES ('#{account_id}', '#{account_json}')"
begin
db.exec(sql_query)
puts "Account with hash #{account_id} has been added/updated."
rescue StandardError => e
puts "An error occurred while adding the account: #{e}"
ensure
db.close
end
end
# Creates the 'objects' table in the database if it doesn't already exist.
# @param db [Sqlite3::Database] the SQLite3 database instance.
def self.create_objects_table(db)
db.exec <<-SQL
CREATE TABLE IF NOT EXISTS objects (
hash TEXT PRIMARY KEY,
content TEXT
);
SQL
end
def self.remove_account(account_id)
db_path = SPECKLE_ACCOUNTS_DB_PATH
unless File.exist?(db_path)
raise(
IOError,
"No Accounts db found. Please read the guide for different options for adding your account:\n
https://speckle.guide/user/manager.html#adding-accounts"
)
end
db = Sqlite3::Database.new(db_path)
begin
db.exec("DELETE FROM objects WHERE hash = '#{account_id}'")
puts "Account with hash #{account_id} has been removed."
rescue StandardError => e
puts "An error occurred: #{e}"
ensure
db.close
end
end
def self.get_account_by_id(id)
accounts = load_accounts
accounts.select { |acc| acc['id'] == id }[0]
end
# Default account on the user computer.
def self.default_account
accounts = load_accounts
accounts.select { |acc| acc['isDefault'] }[0] || accounts[0]
end
# Try to get local server account for debug/test purposes.
def self.try_get_local_server_account
accounts = load_accounts
accounts.select { |acc| acc['serverInfo']['url'].include?('localhost') }[0] || nil
end
end
end
@@ -0,0 +1,20 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../accounts/accounts'
require_relative '../load_saved_streams'
module SpeckleConnector3
module Actions
# Action to add account to local Account db.
class AddAccount < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, account_id, account)
SpeckleConnector3::Accounts.add_account(account_id, account)
js_script = "accountsBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('addAccount', js_script)
end
end
end
end
@@ -1,10 +1,10 @@
# frozen_string_literal: true
require_relative 'action'
require_relative '../accounts/accounts'
require_relative 'load_saved_streams'
require_relative '../action'
require_relative '../../accounts/accounts'
require_relative '../load_saved_streams'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to initialize local accounts from database.
class GetAccounts < Action
@@ -12,7 +12,7 @@ module SpeckleConnector
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id)
puts 'Initialisation of Speckle accounts requested by plugin'
accounts_data = state.speckle_state.accounts
accounts_data = SpeckleConnector3::Accounts.load_accounts
js_script = "accountsBinding.receiveResponse('#{resolve_id}', #{accounts_data.to_json})"
state.with_add_queue_js_command('getAccounts', js_script)
end
@@ -0,0 +1,20 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../accounts/accounts'
require_relative '../load_saved_streams'
module SpeckleConnector3
module Actions
# Action to remove account from database.
class RemoveAccount < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, account_id)
SpeckleConnector3::Accounts.remove_account(account_id)
js_script = "accountsBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('removeAccount', js_script)
end
end
end
end
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module SpeckleConnector
module SpeckleConnector3
module Actions
# State changer object.
class Action
@@ -3,7 +3,7 @@
require_relative 'action'
require_relative 'deactivate_diffing'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Deactivate diffing for stream.
class ActivateDiffing < Action
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Adds material to speckle state and Sketchup.
class AddMaterial < Action
@@ -5,7 +5,7 @@ require_relative 'mapped_entities_updated'
require_relative 'events/selection_event_action'
require_relative '../sketchup_model/dictionary/speckle_schema_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Apply mappings for selected entities.
class ApplyMappings < Action
@@ -37,7 +37,7 @@ module SpeckleConnector
end
# Collect entities from entity ids that comes from UI as list
entities_to_map = entities.select { |e| @entities_to_map.include?(e.persistent_id) }
entities_to_map = entities.select { |e| @entities_to_map.include?(e.persistent_id.to_s) }
# Switch to definitions if all entities are component instance and UI flag shows that
if entities_to_map.all? { |e| e.is_a?(Sketchup::ComponentInstance) } && @is_definition
@@ -10,7 +10,7 @@ require_relative '../../filters/send/selection_filter'
require_relative '../../filters/send_filters'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to add send card.
class AddModel < Action
@@ -8,7 +8,7 @@ require_relative '../../filters/send/selection_filter'
require_relative '../../filters/send_filters'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to add receive model card.
class AddReceiveModelCard < Action
@@ -17,20 +17,28 @@ module SpeckleConnector
def self.update_state(state, resolve_id, data)
model_card_id = data['modelCardId']
account_id = data['accountId']
server_url = data['serverUrl']
workspace_id = data['workspaceId']
workspace_slug = data['workspaceSlug']
project_id = data['projectId']
model_id = data['modelId']
project_name = data['projectName']
model_name = data['modelName']
expired = data['expired']
selected_version_id = data['selectedVersionId']
selected_version_source_app = data['selectedVersionSourceApp']
selected_version_user_id = data['selectedVersionUserId']
latest_version_id = data['latestVersionId']
latest_version_source_app = data['latestVersionSourceApp']
latest_version_user_id = data['latestVersionUserId']
has_dismissed_update_warning = data['hasDismissedUpdateWarning']
baked_object_ids = data['bakedObjectIds'].nil? ? nil : data['bakedObjectIds'].values
receive_card = Cards::ReceiveCard.new(model_card_id, account_id,
receive_card = Cards::ReceiveCard.new(model_card_id, account_id, server_url, workspace_id, workspace_slug,
project_id, model_id,
project_name, model_name,
selected_version_id, latest_version_id,
selected_version_id, selected_version_source_app, selected_version_user_id,
latest_version_id, latest_version_source_app, latest_version_user_id,
has_dismissed_update_warning, expired, baked_object_ids)
SketchupModel::Dictionary::ModelCardDictionaryHandler
.save_receive_card_to_model(receive_card, state.sketchup_state.sketchup_model)
@@ -6,9 +6,10 @@ require_relative '../../cards/receive_card'
require_relative '../../filters/send/everything_filter'
require_relative '../../filters/send/selection_filter'
require_relative '../../filters/send_filters'
require_relative '../../settings/card_settings'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to add send model card.
class AddSendModelCard < Action
@@ -16,17 +17,21 @@ module SpeckleConnector
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, data)
send_filter = Filters::SendFilters.get_filter_from_ui_data(data['sendFilter'])
# settings = Settings::CardSetting.get_setting_from_ui_data(data['settings'])
# Init card and add to the state
send_card = Cards::SendCard.new(
data['modelCardId'],
data['accountId'],
data['serverUrl'],
data['workspaceId'],
data['workspaceSlug'],
data['projectId'],
data['projectName'],
data['modelId'],
data['modelName'],
data['latestCreatedVersionId'],
send_filter,
{}
data['settings']
)
SketchupModel::Dictionary::ModelCardDictionaryHandler
@@ -2,7 +2,7 @@
require_relative '../action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Get connector version.
class GetConnectorVersion < Action
@@ -4,7 +4,7 @@ require_relative '../action'
require_relative '../../filters/send_filters'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Gets document state.
class GetDocumentState < Action
@@ -17,16 +17,20 @@ module SpeckleConnector
# TODO: CONVERTER_V2: Extract into new actions
send_cards = send_cards_hash.collect do |id, card|
filter = Filters::SendFilters.get_filter_from_document(card['sendFilter'])
settings = Settings::CardSetting.get_filter_from_document(card['sendSettings'])
send_card = Cards::SendCard.new(
id,
card['account_id'],
card['server_url'],
card['workspace_id'],
card['workspace_slug'],
card['project_id'],
card['project_name'],
card['model_id'],
card['model_name'],
card['latest_created_version_id'],
filter,
{}
settings
)
new_speckle_state = state.speckle_state.with_send_card(send_card)
@@ -34,9 +38,13 @@ module SpeckleConnector
{
modelCardId: send_card.model_card_id,
accountId: send_card.account_id,
serverUrl: send_card.server_url,
workspaceId: send_card.workspace_id,
workspaceSlug: send_card.workspace_slug,
projectId: send_card.project_id,
modelId: send_card.model_id,
sendFilter: send_card.send_filter,
settings: send_card.send_settings,
latestCreatedVersionId: send_card.latest_created_version_id,
typeDiscriminator: send_card.type_discriminator
}
@@ -47,9 +55,11 @@ module SpeckleConnector
# TODO: CONVERTER_V2: Extract into new actions
receive_cards = receive_cards_hash.collect do |id, card|
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['project_id'], card['model_id'],
receive_card = Cards::ReceiveCard.new(id, card['account_id'], card['server_url'], card['workspace_id'], card['workspace_slug'], card['project_id'], card['model_id'],
card['project_name'], card['model_name'], card['selected_version_id'],
card['latest_version_id'], card['has_dismissed_update_warning'],
card['selected_version_source_app'], card['selected_version_user_id'],
card['latest_version_id'], card['latest_version_source_app'],
card['latest_version_user_id'], card['has_dismissed_update_warning'],
card['expired'], card['baked_object_ids'])
new_speckle_state = state.speckle_state.with_receive_card(receive_card)
@@ -57,12 +67,19 @@ module SpeckleConnector
{
modelCardId: receive_card.model_card_id,
accountId: receive_card.account_id,
serverUrl: receive_card.server_url,
workspaceId: receive_card.workspace_id,
workspaceSlug: receive_card.workspace_slug,
projectId: receive_card.project_id,
modelId: receive_card.model_id,
projectName: receive_card.project_name,
modelName: receive_card.model_name,
selectedVersionId: receive_card.selected_version_id,
selectedVersionSourceApp: receive_card.selected_version_source_app,
selectedVersionUserId: receive_card.selected_version_user_id,
latestVersionId: receive_card.latest_version_id,
latestVersionSourceApp: receive_card.latest_version_source_app,
latestVersionUserId: receive_card.latest_version_user_id,
hasDismissedUpdateWarning: receive_card.has_dismissed_update_warning,
expired: receive_card.expired,
bakedObjectIds: receive_card.baked_object_ids,
@@ -3,7 +3,7 @@
require_relative '../action'
require_relative '../../filters/send_filters'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to get send filter.
class GetSendFilters < Action
@@ -0,0 +1,24 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../settings/card_settings'
module SpeckleConnector3
module Actions
# Action to get send settings.
class GetSendSettings < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id)
# NOTE: below code is tested and works!
# default_settings = [
# Settings::CardSetting.new(id: "includeAttributes", title: "Include Attributes", type: "boolean", value: true),
# Settings::CardSetting.new(id: "test", title: "Test", type: "string", value: "a", enum: %w[a b c])
# ]
default_settings = []
js_script = "sendBinding.receiveResponse('#{resolve_id}', #{default_settings.to_json})"
state.with_add_queue_js_command('getSendSettings', js_script)
end
end
end
end
@@ -2,7 +2,7 @@
require_relative '../action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Get source app name.
class GetSourceAppName < Action
@@ -2,7 +2,7 @@
require_relative '../action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Get source app version.
class GetSourceAppVersion < Action
@@ -3,7 +3,7 @@
require_relative '../action'
require_relative '../../sketchup_model/query/entity'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to add send card.
class HighlightModel < Action
@@ -4,7 +4,7 @@ require_relative '../action'
require_relative '../../sketchup_model/query/entity'
require_relative '../../sketchup_model/utils/view_utils'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to add send card.
class HighlightObjects < Action
@@ -8,7 +8,7 @@ require_relative '../../filters/send/selection_filter'
require_relative '../../filters/send_filters'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to remove send card.
class RemoveModel < Action
@@ -0,0 +1,34 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../cards/send_card'
require_relative '../../cards/receive_card'
require_relative '../../filters/send/everything_filter'
require_relative '../../filters/send/selection_filter'
require_relative '../../filters/send_filters'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector3
module Actions
# Action to remove cards.
class RemoveModels < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, data)
data.each do |model_card|
SketchupModel::Dictionary::ModelCardDictionaryHandler.remove_card_dict(state.sketchup_state.sketchup_model, model_card)
new_speckle_state = if model_card['typeDiscriminator'] == 'ReceiverModelCard'
state.speckle_state.without_receive_card(model_card['id'])
else
state.speckle_state.without_send_card(model_card['id'])
end
state = state.with_speckle_state(new_speckle_state)
end
# Resolve promise
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('removeModels', js_script)
end
end
end
end
@@ -3,7 +3,7 @@
require_relative '../action'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to update send filter.
class UpdateSendFilter < Action
@@ -3,7 +3,7 @@
require_relative 'action'
require_relative '../sketchup_model/dictionary/speckle_entity_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Clear mapper source.
class ClearMapperSource < Action
@@ -5,7 +5,7 @@ require_relative 'mapped_entities_updated'
require_relative 'events/selection_event_action'
require_relative '../sketchup_model/dictionary/speckle_schema_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Clear mappings for selected entities.
class ClearMappings < Action
@@ -28,7 +28,7 @@ module SpeckleConnector
end
# Collect entities from entity ids that comes from UI as list
entities_to_map = entities.select { |e| @entities_to_map.include?(e.persistent_id) }
entities_to_map = entities.select { |e| @entities_to_map.include?(e.persistent_id.to_s) }
# Switch to definitions if all entities are component instance and UI flag shows that
if entities_to_map.all? { |e| e.is_a?(Sketchup::ComponentInstance) } && @is_definition
@@ -5,7 +5,7 @@ require_relative 'mapped_entities_updated'
require_relative 'events/selection_event_action'
require_relative '../sketchup_model/dictionary/speckle_schema_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Clear mappings for selected entities from mapped elements table.
class ClearMappingsFromTable < Action
@@ -20,7 +20,7 @@ module SpeckleConnector
# Store speckle state to update with mapped entities.
speckle_state = state.speckle_state
flat_entities.each do |entity|
next unless entity_ids.include?(entity.persistent_id)
next unless entity_ids.include?(entity.persistent_id.to_s)
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.remove_dictionary(entity)
speckle_state = speckle_state.with_removed_mapped_entity(entity)
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Clear queue from state.
class ClearQueue < Action
@@ -4,7 +4,7 @@ require_relative 'action'
require_relative '../ext/sqlite3'
require_relative '../constants/path_constants'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to collect preferences from database to UI.
class CollectPreferences < Action
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to collect versions from sketchup and connector to track user's version by mixpanel.
class CollectVersions < Action
@@ -11,7 +11,7 @@ module SpeckleConnector
def self.update_state(state, _resolve_id, _data)
versions = {
sketchup: Sketchup.version.to_i,
speckle: SpeckleConnector::CONNECTOR_VERSION
speckle: SpeckleConnector3::CONNECTOR_VERSION
}
state.with_add_queue('collectVersions', versions.to_json, [])
end
@@ -2,7 +2,7 @@
require_relative '../action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to get config.
class GetConfig < Action
@@ -12,14 +12,7 @@ module SpeckleConnector
# Previously it was stored in user state
# config = state.user_state.preferences.to_json
config = {
global: {
},
connectors: {
sketchup: {
darkTheme: state.user_state.user_preferences[:dark_theme]
}
}
darkTheme: state.user_state.user_preferences[:dark_theme]
}
js_script = "configBinding.receiveResponse('#{resolve_id}', #{config.to_json})"
state.with_add_queue_js_command('getConfig', js_script)
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require_relative '../action'
module SpeckleConnector3
module Actions
# Action to get is dev mode.
class GetIsDevMode < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id)
js_script = "configBinding.receiveResponse('#{resolve_id}', #{DEV_MODE})"
state.with_add_queue_js_command('getIsDevMode', js_script)
end
end
end
end
@@ -0,0 +1,21 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../preferences/preferences'
module SpeckleConnector3
module Actions
class GetUserSelectedAccountId < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id)
user_selected_account_id = Preferences.get_user_selected_account_id
accountsConfig = {
userSelectedAccountId: user_selected_account_id
}
js_script = "configBinding.receiveResponse('#{resolve_id}', #{accountsConfig.to_json})"
state.with_add_queue_js_command('getUserSelectedAccountId', js_script)
end
end
end
end
@@ -0,0 +1,18 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../preferences/preferences'
module SpeckleConnector3
module Actions
class SetUserSelectedAccountId < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, account_id)
Preferences.set_user_selected_account_id(account_id)
js_script = "configBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('setUserSelectedAccountId', js_script)
end
end
end
end
@@ -3,7 +3,7 @@
require_relative '../action'
require_relative '../user_preferences_updated'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to update config.
class UpdateConfig < Action
@@ -15,7 +15,7 @@ module SpeckleConnector
# @return [States::State] the new updated state object
def self.update_state(state, resolve_id, config)
config.each do |key, value|
state = Actions::UserPreferencesUpdated.new('configSketchup', KEY_VALUES[key], value).update_state(state)
state = Actions::UserPreferencesUpdated.new('Sketchup', KEY_VALUES[key], value).update_state(state)
end
js_script = "configBinding.receiveResponse('#{resolve_id}')"
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to update connected state of application.
class Connected < Action
@@ -6,7 +6,7 @@ require_relative '../actions/save_stream'
require_relative '../actions/queue_send'
require_relative '../convertors/converter'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Create stream.
class CreateStream < Action
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Deactivate diffing.
class DeactivateDiffing < Action
@@ -5,7 +5,7 @@ require_relative 'on_document_changed'
require_relative '../load_sketchup_model'
require_relative '../collect_preferences'
module SpeckleConnector
module SpeckleConnector3
module Actions
module Events
# Handle events that are triggered by the {AppObserver}.
@@ -6,7 +6,7 @@ require_relative '../../sketchup_model/utils/face_utils'
require_relative '../../constants/dict_constants'
require_relative '../../sketchup_model/query/path'
module SpeckleConnector
module SpeckleConnector3
module Actions
module Events
# Event actions related to entities.
@@ -21,12 +21,13 @@ module SpeckleConnector
modified_entities.each { |entity| entity.delete_attribute(SPECKLE_BASE_OBJECT) }
# All parent ids on current active path
parent_ids = PATH.parents_with_definitions(state.sketchup_state.sketchup_model).collect(&:persistent_id)
parent_ids = PATH.parents_with_definitions(state.sketchup_state.sketchup_model).collect(&:persistent_id).collect(&:to_s)
# All instances that changed potentially because of potential definition update
path_instance_ids = PATH.instances(state.sketchup_state.sketchup_model).collect(&:persistent_id)
path_instance_ids = PATH.instances(state.sketchup_state.sketchup_model).collect(&:persistent_id).collect(&:to_s)
wrapped_entity_ids = wrapped_entity_ids(modified_entities)
ids_to_check = parent_ids + wrapped_entity_ids + path_instance_ids
ids_to_check = parent_ids + wrapped_entity_ids + path_instance_ids +
modified_entities.collect(&:persistent_id).collect(&:to_s) # NOTE: It fixes the same weird face problems. Ideally the push-pull result should hit the OnElementModified but for some cases we found the edge here......
state = EntitiesEventAction.run_expiration_checks(state, ids_to_check) if ids_to_check.any?
attach_edge_entity_observer(modified_entities.grep(Sketchup::Edge), state.speckle_state.observers[ENTITY_OBSERVER])
@@ -36,7 +37,7 @@ module SpeckleConnector
def self.wrapped_entity_ids(modified_entities)
wrapped_entity_ids = []
modified_entities.select { |e| e.respond_to?(:definition) }.each do |c|
wrapped_entity_ids += c.definition.entities.collect(&:persistent_id)
wrapped_entity_ids += c.definition.entities.collect(&:persistent_id).collect(&:to_s)
end
wrapped_entity_ids
end
@@ -59,19 +60,22 @@ module SpeckleConnector
def self.update_state(state, event_data)
modified_entities = event_data.collect { |data| data[1] }.to_a
definition_faces = get_definition_faces(modified_entities)
modified_entity_ids = modified_entities.collect(&:persistent_id) + definition_faces.collect(&:persistent_id)
near_faces = get_near_faces(modified_entities)
modified_persistent_ids = modified_entities.collect(&:persistent_id).collect(&:to_s) +
definition_faces.collect(&:persistent_id).collect(&:to_s) +
near_faces.collect(&:persistent_id).collect(&:to_s)
parent_ids = PATH.parents_with_definitions(state.sketchup_state.sketchup_model).collect(&:persistent_id)
parent_ids = PATH.parents_with_definitions(state.sketchup_state.sketchup_model).collect(&:persistent_id).collect(&:to_s)
path_instance_ids = PATH.instances(state.sketchup_state.sketchup_model).collect(&:persistent_id)
modified_entity_ids += parent_ids + path_instance_ids
state = EntitiesEventAction.run_expiration_checks(state, modified_entity_ids)
path_instance_ids = PATH.instances(state.sketchup_state.sketchup_model).collect(&:persistent_id).collect(&:to_s)
modified_persistent_ids += parent_ids + path_instance_ids
state = EntitiesEventAction.run_expiration_checks(state, modified_persistent_ids)
# if modified_entity.is_a?(Sketchup::Face)
# path = state.sketchup_state.sketchup_model.active_path
# modified_faces = SketchupModel::Utils::FaceUtils.near_faces(modified_entity.edges)
# path_objects = path.nil? ? [] : path + path.collect(&:definition)
# parent_ids = path_objects.collect(&:persistent_id)
# ids_to_invalidate = modified_faces.collect(&:persistent_id) + parent_ids
# parent_ids = path_objects.collect(&:persistent_id).collect(&:to_s)
# ids_to_invalidate = modified_faces.collect(&:persistent_id).collect(&:to_s) + parent_ids
# entities_to_invalidate = speckle_entities_to_invalidate(speckle_state, ids_to_invalidate)
# new_speckle_state = invalidate_speckle_entities(speckle_state, entities_to_invalidate)
# # This is the place we can send information to UI for diffing check
@@ -86,9 +90,11 @@ module SpeckleConnector
def self.get_near_faces(modified_entities)
near_faces = []
modified_entities.each do |modified_entity|
next unless modified_entity.is_a?(Sketchup::Face)
near_faces += SketchupModel::Utils::FaceUtils.near_faces(modified_entity.edges)
if modified_entity.is_a?(Sketchup::Face)
near_faces += SketchupModel::Utils::FaceUtils.near_faces(modified_entity.edges)
elsif modified_entity.is_a?(Sketchup::Edge)
near_faces += modified_entity.faces
end
end
near_faces
end
@@ -124,7 +130,7 @@ module SpeckleConnector
class OnElementRemoved
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, event_data)
modified_entity_ids = event_data.collect { |data| data[1] }.to_a
modified_entity_ids = event_data.collect { |data| data[1] }.to_a.collect(&:to_s)
new_speckle_state = state.speckle_state.with_changed_entity_ids(modified_entity_ids)
state = state.with_speckle_state(new_speckle_state)
Actions::SendCardExpirationCheck.update_state(state)
@@ -132,9 +138,9 @@ module SpeckleConnector
end
# @param state [States::State] the current state of the SpeckleConnector Application
# @param changed_entity_ids [Array<Integer> | Array<String>] list of changed entity ids
def self.run_expiration_checks(state, changed_entity_ids)
new_speckle_state = state.speckle_state.with_changed_entity_persistent_ids(changed_entity_ids)
# @param changed_persistent_ids [Array<String>] list of changed persistent ids
def self.run_expiration_checks(state, changed_persistent_ids)
new_speckle_state = state.speckle_state.with_changed_entity_persistent_ids(changed_persistent_ids)
state = state.with_speckle_state(new_speckle_state)
Actions::SendCardExpirationCheck.update_state(state)
end
@@ -4,7 +4,7 @@ require_relative 'event_action'
require_relative '../../constants/dict_constants'
require_relative '../../sketchup_model/query/path'
module SpeckleConnector
module SpeckleConnector3
module Actions
module Events
PATH = SketchupModel::Query::Path
@@ -27,11 +27,11 @@ module SpeckleConnector
end
end
parent_ids = PATH.parents_with_definitions(state.sketchup_state.sketchup_model).collect(&:persistent_id)
path_instance_ids = PATH.instances(state.sketchup_state.sketchup_model).collect(&:persistent_id)
parent_ids = PATH.parents_with_definitions(state.sketchup_state.sketchup_model).collect(&:persistent_id).collect(&:to_s)
path_instance_ids = PATH.instances(state.sketchup_state.sketchup_model).collect(&:persistent_id).collect(&:to_s)
edges.uniq!
edge_ids = edges.collect(&:persistent_id)
edge_ids = edges.collect(&:persistent_id).collect(&:to_s)
new_speckle_state = state.speckle_state.with_changed_entity_persistent_ids(edge_ids + parent_ids + path_instance_ids)
state.with_speckle_state(new_speckle_state)
end
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module SpeckleConnector
module SpeckleConnector3
module Actions
# This module contains actions that are performed to handle events triggered by observers in Sketchup.
module Events
@@ -3,7 +3,7 @@
require_relative 'event_action'
require_relative '../load_sketchup_model'
module SpeckleConnector
module SpeckleConnector3
module Actions
module Events
# Handle events that are triggered by the {ModelObserver}.
@@ -26,7 +26,8 @@ module SpeckleConnector
unless path.nil?
new_path_entities = path[-1].definition.entities
new_path_entities.add_observer(observers[ENTITIES_OBSERVER])
edges = new_path_entities.grep(Sketchup::Edge)
# attach observers to only orphan edges since face edges can be detected via face changes.
edges = new_path_entities.grep(Sketchup::Edge).filter { |edge| edge.faces.none? }
edges.each do |edge|
edge.add_observer(observers[ENTITY_OBSERVER])
edge.start.add_observer(observers[ENTITY_OBSERVER])
@@ -1,6 +1,6 @@
# frozen_string_literal: true
module SpeckleConnector
module SpeckleConnector3
module Actions
# Triggers whenever document has changed.
class OnDocumentChanged < Action
@@ -8,7 +8,7 @@ require_relative '../../sketchup_model/reader/speckle_entities_reader'
require_relative '../../sketchup_model/reader/mapper_reader'
require_relative '../../sketchup_model/query/entity'
module SpeckleConnector
module SpeckleConnector3
module Actions
module Events
# Update selected speckle objects when the selection changes for mapper tool.
@@ -20,8 +20,8 @@ module SpeckleConnector
# POC: Not happy with it. We log also entity.entityID property since
# onElementRemoved observer only return them! :/ Reconsider this in BETA!
selected_object_ids = state.sketchup_state.sketchup_model.selection.collect(&:persistent_id) +
state.sketchup_state.sketchup_model.selection.collect(&:entityID)
selected_object_ids = state.sketchup_state.sketchup_model.selection.collect(&:persistent_id).collect(&:to_s) +
state.sketchup_state.sketchup_model.selection.collect(&:entityID).collect(&:to_s)
summary = "Selected #{selected_object_ids.length / 2} objects." # POC: OFFF. I'll fix it
selection_info = UiData::Sketchup::SelectionInfo.new(selected_object_ids, summary)
js_script = "selectionBinding.emit('setSelection', #{selection_info.to_json})"
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Get document info.
class GetDocumentInfo < Action
@@ -1,10 +1,14 @@
# frozen_string_literal: true
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to return error message to UI.
# It is "TopLevelExceptionHandler" equivalent of C#.
class HandleError < Action
# @param error [String] error
# @return [StandardError] error
attr_reader :error
# @param error [StandardError] error
# @param view_name [String] name of the view (binding)
# @param action [Action] action that error happened
# @param parameters [Array<String>] arguments
@@ -19,11 +23,14 @@ module SpeckleConnector
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def update_state(state)
error_message = "Error: #{@error}\nBinding: #{@view_name}\nAction:#{@action}\nArgs: #{@args}\n"
error = {
error: error_message
# TODO: Log here when it is ready!!!
host_app_error = {
message: error.message,
error: error,
stackTrace: error.backtrace
}
js_error_script = "#{@view_name}.receiveResponse('#{@args.first}', #{error.to_json})"
js_error_script = "#{@view_name}.receiveResponse('#{@args.first}', #{host_app_error.to_json})"
state.with_add_queue_js_command("error_#{@view_name}", js_error_script)
end
end
@@ -4,7 +4,7 @@ require_relative 'action'
require_relative 'events/selection_event_action'
require_relative '../sketchup_model/dictionary/speckle_schema_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Hide entities that selected from mapped elements table.
class HideMappingsFromTable < Action
@@ -19,7 +19,7 @@ module SpeckleConnector
# Store speckle state to update with mapped entities.
flat_entities.each do |entity|
next unless entity_ids.include?(entity.persistent_id)
next unless entity_ids.include?(entity.persistent_id.to_s)
if entity.is_a?(Sketchup::ComponentDefinition)
entity.instances.each do |instance|
@@ -4,7 +4,7 @@ require_relative 'action'
require_relative '../accounts/accounts'
require_relative 'load_saved_streams'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to initialize local accounts from database.
class InitLocalAccounts < Action
@@ -4,9 +4,9 @@ require_relative 'action'
require_relative 'add_material'
require_relative '../constants/mat_constants'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to initialize materials
# Action to initialize materials (legacy for diff colors)
class InitializeMaterials < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
@@ -9,16 +9,16 @@ require_relative '../preferences/preferences'
require_relative '../constants/observer_constants'
require_relative '../ext/worker'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Initialization of the real state of the speckle.
class InitializeSpeckle < Action
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, observers, instant_message_sender)
worker = SpeckleConnector::Worker.new([])
worker = SpeckleConnector3::Worker.new([])
attach_app_observer!(observers[APP_OBSERVER])
accounts = SpeckleConnector::Accounts.load_accounts
accounts = SpeckleConnector3::Accounts.load_accounts
speckle_state = States::SpeckleState.new(accounts, observers, {}, {})
# This should be the only point that `Sketchup_active_model` passed to application state.
sketchup_state = States::SketchupState.new(Sketchup.active_model)
@@ -4,7 +4,7 @@ require_relative 'action'
require_relative 'events/selection_event_action'
require_relative '../sketchup_model/dictionary/speckle_schema_dictionary_handler'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Isolate entities that selected from mapped elements table.
class IsolateMappingsFromTable < Action
@@ -38,13 +38,13 @@ module SpeckleConnector
faces_or_edges_ids = faces_or_edges.collect { |e| e['entityId'] }
face_edge_flat_entities.select { |e| faces_or_edges_ids.include?(e.persistent_id) }.each do |entity|
face_edge_flat_entities.select { |e| faces_or_edges_ids.include?(e.persistent_id.to_s) }.each do |entity|
entity.hidden = false
end
comps_or_groups_ids = comps_or_groups.collect { |e| e['entityId'] }
comp_flat_entities.select { |e| comps_or_groups_ids.include?(e.persistent_id) }.each do |entity|
comp_flat_entities.select { |e| comps_or_groups_ids.include?(e.persistent_id.to_s) }.each do |entity|
if entity.is_a?(Sketchup::ComponentDefinition)
entity.instances.each do |instance|
instance.hidden = false
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Action to load saved streams.
class LoadSavedStreams < Action

Some files were not shown because too many files have changed in this diff Show More