Compare commits

...

370 Commits

Author SHA1 Message Date
Jedd Morgan 903cecc107 Update deploy.yml
Build and deploy / build (push) Has been cancelled
Build and deploy / deploy-installers (push) Has been cancelled
2025-07-09 10:20:14 +01: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
Oğuzhan Koral f20b26045c Align collections and proxies (#342) 2024-07-18 01:10:03 +02:00
Oğuzhan Koral 4bcbc5131b Fix missing objects in definition proxy (#341) 2024-07-16 16:21:47 +02:00
Oğuzhan Koral eeea2d7c8d Grouped meshes by layer and material (#339)
* POC grouped meshes for perf

* Better group mesh

* Add doc fix minor

* Consider back material for meshes

* Remove unused grouped meshes functions

* Remove unnecessary line
2024-07-16 12:57:19 +02:00
Oğuzhan Koral 68e9468294 Fix progress update and some performance (#338)
* Fix send conversion status

* Do not add non-orphan edges to flat atomic objects (~3x performance gain)
2024-07-10 18:55:18 +03:00
Oğuzhan Koral 694da73b77 Fix(blocks): update max depth of children (#337)
* Temp fix

* Update max depth of children
2024-07-09 13:59:16 +03:00
Oğuzhan Koral 15657bf0ec Feat (dui3): New blocks (#336)
* Add proxy objects

* Rename materials and definitions

* Add DefinitionManager

* Fix minor

* Tweak in converter

* Fix units

* Converter v2

* Split converter and converter_v2

* Sort arguments for converters

* Change inner terminology to FE2 for native converter v2

* Simplify arguments

* Remove one click send

* Convert definition proxies in advance then instance proxies

* Yey

* Accept uppercase Units too
2024-06-27 23:09:46 +03:00
oguzhankoral 78c6898ff0 Fix baked object ids 2024-06-05 21:47:09 +03:00
oguzhankoral 836e97a57c Flat stack trace from array to string 2024-06-05 15:11:33 +03:00
oguzhankoral 7f708108f2 Pass error message into hash to serialize 2024-06-05 15:02:53 +03:00
oguzhankoral 2d3e282150 Remove receive result -store only baked object ids 2024-06-05 14:44:01 +03:00
oguzhankoral 75b933ef0a Add conversion_result class and align for send receive 2024-06-05 14:33:16 +03:00
oguzhankoral c19799f081 Send conversion results 2024-06-03 10:37:03 +03:00
oguzhankoral 848ed922b5 Merge coplanar faces from after_get_objects 2024-05-22 11:13:37 +03:00
oguzhankoral 16e96b69a4 Set active path always to model before send 2024-05-13 18:24:36 +03:00
oguzhankoral fbdd7ee7b6 Include parents too onChangeEntity 2024-05-13 18:13:37 +03:00
oguzhankoral d3df5fceec Handle entity paths elegantly 2024-05-13 14:15:43 +03:00
oguzhankoral 948925d156 Ignore cache for grouped meshes since it breaks the object structure 2024-05-13 12:35:26 +03:00
oguzhankoral 7ab6b1b167 Do not group meshes with object referenced meshes 2024-05-13 12:23:25 +03:00
oguzhankoral ca3a109bc8 Fix non-selected update infinity json error 2024-05-13 11:11:22 +03:00
oguzhankoral ebe9551e72 Add 2024 support for DUI3 Mac 2024-05-10 10:46:31 +03:00
oguzhankoral d2836189c3 Add 2024 support for DUI3 2024-05-08 19:17:06 +03:00
oguzhankoral 3703963ec8 Merge branch 'oguzhan/worker-thread-poc' into oguzhan/dui3 2024-05-08 14:35:11 +03:00
oguzhankoral 02ca8e3a59 Do instance message send via worker 2024-05-08 02:34:32 +03:00
oguzhankoral 7c73658fa5 Remove TT dependency 2024-05-08 02:20:40 +03:00
oguzhankoral e03b448618 Enable progress bar while converting from selected entities 2024-05-08 01:33:19 +03:00
oguzhankoral c8d635752b Implement instant_message_sender over worker 2024-05-08 00:59:09 +03:00
oguzhankoral df9a5600d9 Fallback to ModelCollection always if collectionType not set 2024-05-07 23:35:17 +03:00
oguzhankoral dd730ea517 Fix typo 2024-05-07 23:18:46 +03:00
oguzhankoral 5bbfe1be59 Disable old UI button 2024-05-07 21:50:23 +03:00
oguzhankoral dd04bd8792 Rename DUI3 with New UI 2024-05-07 14:48:04 +03:00
oguzhankoral 20bc1f41f0 Fix typo on clearing cache on document switch 2024-05-07 14:25:24 +03:00
oguzhankoral 9e838734c0 Resize speckle icons
Co-authored-by: name <mucahitbgoker@gmail.com>
2024-05-07 14:18:01 +03:00
oguzhankoral 17aeca5e70 Clear cache on document switch 2024-05-07 13:46:02 +03:00
Mucahit Bilal GOKER 98852d8c22 Updated connector icons (#329) 2024-05-07 13:38:02 +03:00
oguzhankoral 674d9cd37d Track also session based ids
This was needed because of onElementRemoved only provides `entityID` instead `persistent_id`......
2024-05-07 12:55:55 +03:00
oguzhankoral c35f9c22ae Extract run expiration checks 2024-05-07 11:01:24 +03:00
oguzhankoral e5f861c0dc Invalidate sub elements of component if created 2024-05-07 10:39:22 +03:00
oguzhankoral 7a31143ef4 Highlight and remember received objects 2024-05-06 15:46:41 +03:00
oguzhankoral 9daa0e4059 Do not send if nothing selected 2024-05-06 12:40:54 +03:00
oguzhankoral eaedeb4f8b Implement getConnectorVersion 2024-05-06 12:13:10 +03:00
oguzhankoral bd2f1d2777 Add missing latest_version_id and has_dismissed_update_warning for receive card 2024-04-30 15:29:30 +03:00
oguzhankoral 52e43bac2d Make elements backward compatible 2024-04-29 10:11:23 +03:00
oguzhankoral daef503970 Wrap DUI3 receive into sketchup operation 2024-04-29 10:10:53 +03:00
oguzhankoral 4d0ba3cd13 Remove placeholder everything and tag send filters 2024-04-29 09:30:34 +03:00
oguzhankoral bd111a2106 Lowercase the app name 2024-04-22 11:40:39 +03:00
oguzhankoral 22daade5d2 Add EntityObserver for Edge and Vertex change detection 2024-03-25 14:24:17 +03:00
oguzhankoral a39d72a59d Change detections for entities 2024-03-25 14:24:06 +03:00
oguzhankoral 3a2e523589 Do not iterate closure table if nil 2024-03-22 12:26:25 +03:00
oguzhankoral 8bd27c6ad1 ObjectReference for previously converted objects 2024-03-21 20:13:11 +03:00
oguzhankoral 4c20cf67c8 Serializer adjustments for ObjectReference
- Previous state and sketchup entity pollution on serializer cleared up
2024-03-21 14:13:01 +03:00
oguzhankoral 337da3d523 Add option for netlify ui url 2024-03-19 14:55:41 +03:00
oguzhankoral 3050803e68 Send according to filter and expiration 2024-03-19 14:28:30 +03:00
oguzhankoral beb803fc63 Read/write cards correctly 2024-03-19 14:28:29 +03:00
oguzhankoral b056bcae2c Remove unnecessary sourceApplication 2024-03-19 14:28:29 +03:00
oguzhankoral 6a2c297640 Fix renames 2024-03-19 14:28:29 +03:00
oguzhankoral 8b3127eda4 Fix selection 2024-03-19 14:28:29 +03:00
oguzhankoral b63d51ab1d Align boilerplate config 2024-03-19 14:28:29 +03:00
oguzhankoral 3b2dfd27d6 Fix changed property for modelCardId 2024-03-19 14:28:29 +03:00
oguzhankoral b8753195df Solve post-conflicts with dev 2024-03-19 14:28:29 +03:00
oguzhankoral e76eb113a5 Zoom selection for highlight 2024-03-19 14:28:29 +03:00
oguzhankoral d285e10565 Update sqlite3 submodule hash ref 2024-03-19 14:28:29 +03:00
oguzhankoral 66803f9036 Highlight model for send cards 2024-03-19 14:28:29 +03:00
oguzhankoral d7cff48374 Remove cards from model 2024-03-19 14:28:29 +03:00
oguzhankoral d66ed0566b Add action name to error message for commands 2024-03-19 14:28:29 +03:00
oguzhankoral fde2b3bf0f First successful receive 2024-03-19 14:28:29 +03:00
oguzhankoral dcc8270cc6 Send progressbar with Sketchup.status_text
Thanks to library of thomthom
2024-03-19 14:28:29 +03:00
oguzhankoral 23b6ca7552 Send model card id via sendViaBrowserArgs 2024-03-19 14:28:29 +03:00
oguzhankoral 437173e6a4 Get source app version via base bindings 2024-03-19 14:28:29 +03:00
oguzhankoral 1274facbed Send message from sender card 2024-03-19 14:28:29 +03:00
oguzhankoral 180fc2ca59 Correct send data 2024-03-19 14:28:28 +03:00
oguzhankoral 187cf8f55e Real send via DUI3 2024-03-19 14:28:28 +03:00
oguzhankoral dd8868b2a2 Trigger sendersExpired when objects modified 2024-03-19 14:28:28 +03:00
oguzhankoral 921e8ea1a8 Use AddModel action for updateModel command 2024-03-19 14:28:28 +03:00
oguzhankoral 54e8782e12 Place binding classes into folder 2024-03-19 14:28:28 +03:00
oguzhankoral 9e690dd304 Enable error catch for command 2024-03-19 14:28:28 +03:00
oguzhankoral 373b42041b Update model card 2024-03-19 14:28:28 +03:00
oguzhankoral 30ead47fb9 Add type discriminator 2024-03-19 14:28:28 +03:00
oguzhankoral 2dc7206f17 Reorganize send bindings 2024-03-19 14:28:28 +03:00
oguzhankoral ab7594bd23 Split account binding from base 2024-03-19 14:28:28 +03:00
oguzhankoral 710a22aea7 Align with Dim's works 2024-03-19 14:28:28 +03:00
oguzhankoral 2c7c801efc WIP: selection bindings - add cards to model 2024-03-19 14:28:28 +03:00
oguzhankoral 41ebe058e7 WIP: filters 2024-03-19 14:28:28 +03:00
oguzhankoral 288c71b3e0 Convert tag colors to hex 2024-03-19 14:28:28 +03:00
oguzhankoral d7a8afcb31 Get default filters 2024-03-19 14:28:28 +03:00
oguzhankoral a1d120ee22 Get model state and send filter for sketchup 2024-03-19 14:28:28 +03:00
oguzhankoral b58d6d0d82 WIP: connector configs 2024-03-19 14:28:28 +03:00
oguzhankoral 5ab65391ca Implement config_binding 2024-03-19 14:28:28 +03:00
oguzhankoral 2b40d58996 Introduce ruby traverse_and_construct 2024-03-19 14:28:28 +03:00
oguzhankoral 96129388ec Send-Receive operations test via ruby 2024-03-19 14:28:25 +03:00
oguzhankoral 6f6058a2d1 Remove test bridge.js 2024-03-19 14:27:56 +03:00
oguzhankoral 063ef91613 Unit test for send operation 2024-03-19 14:27:56 +03:00
oguzhankoral 5233072099 Enable collect preferences 2024-03-19 14:27:56 +03:00
oguzhankoral cd063b0e8a Emit only documentChanged instead of passing data 2024-03-19 14:27:56 +03:00
oguzhankoral 719d796e20 Rename views to bindings 2024-03-19 14:27:56 +03:00
oguzhankoral 9767bf5261 Report errors to UI 2024-03-19 14:27:56 +03:00
oguzhankoral a9998bf12d Resolve triggerEvent 2024-03-19 14:27:56 +03:00
oguzhankoral 2b7dc899e1 Implement test bindings 2024-03-19 14:27:56 +03:00
oguzhankoral cbc3f51d4c Create random sketchup binding 2024-03-19 14:27:56 +03:00
oguzhankoral ff1c8c1bfe Implement on_document_changed action 2024-03-19 14:27:56 +03:00
oguzhankoral 6d4222bb1a Add command for get document info 2024-03-19 14:27:56 +03:00
oguzhankoral 7692a6f258 Remove get_commands action and command 2024-03-19 14:27:56 +03:00
oguzhankoral ed8e6b00c6 Apply same dialog-view relationship to legacy UI 2024-03-19 14:27:56 +03:00
oguzhankoral 85db9570dd Control views via dialog 2024-03-19 14:27:56 +03:00
oguzhankoral be174b9cce Remove unnecssary init from view 2024-03-19 14:27:56 +03:00
oguzhankoral f0099090b4 Collect command names from related view for SketchupBridge 2024-03-19 14:27:56 +03:00
oguzhankoral b72bdfcbf0 Pass view to commands 2024-03-19 14:27:53 +03:00
oguzhankoral e1f5addddc Send messages to correct view/binding 2024-03-19 14:23:06 +03:00
oguzhankoral 87d3145317 Solve missing resolve_id arguments for commands and actions 2024-03-19 14:23:06 +03:00
oguzhankoral 84fc89cbbe Run legacy and dui3 at the same time 2024-03-19 14:23:06 +03:00
oguzhankoral fbbddd8365 Pass resolve id from arguments 2024-03-19 14:23:06 +03:00
oguzhankoral dcfb787563 Replace Bridge with inhouse resolve_id solution 2024-03-19 14:23:06 +03:00
oguzhankoral 6822b2db9b Pass serialized accounts data as json object 2024-03-19 14:23:06 +03:00
oguzhankoral d89b3772de Pass correct request id for getAccounts 2024-03-19 14:23:06 +03:00
oguzhankoral e4a4eb0455 Request id temp hack 2024-03-19 14:23:06 +03:00
oguzhankoral 759efa7da3 Add get commands 2024-03-19 14:23:06 +03:00
oguzhankoral bf1c271784 Add bridge sample 2024-03-19 14:23:06 +03:00
oguzhankoral 9754893181 Check correct dui3 id ui controller 2024-03-19 14:23:06 +03:00
oguzhankoral 5b05182a1c Add new dialog for dui3 2024-03-19 14:23:00 +03:00
oguzhankoral 20528f72df Merge remote-tracking branch 'origin/development' 2024-03-19 13:32:03 +03:00
Alan Rynne 7de08d9f24 fix: Use correct digicert context + pass fingerprint to ISS compiler (#328)
* fix: Use correct digicert context + pass fingerprint to ISS compiler

* Update config.yml

* Update config.yml

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
2024-03-14 11:27:45 +00:00
Oğuzhan Koral d047f5e6d2 Chore (URL): CNX-9018 Do not add model from multi model urls
- warn user and return
- otherwise add
2024-02-29 15:13:44 +03:00
Oğuzhan Koral 71071f817c Make FE2 terminology default (#326) 2024-02-27 17:09:38 +03:00
oguzhankoral ad9af9bb3d Merge remote-tracking branch 'origin/development' 2024-02-27 12:38:00 +03:00
Oğuzhan Koral c7c864b8c0 Feat (CI): Update CI for digicert (#325)
* Update CI for digicert

* Checkout speckle-sharp-ci-tools branch if exist
2024-02-27 12:36:25 +03:00
Oğuzhan Koral 67d4862f6b Fix (Mapper): CNX-9027 mapped edges don't send at all (#324)
* Separate native revit object definitions

* Add types for native revit objects

* Pass speckle_state to line conversion

* Remove mapper functions from model collections

* Use dictionary pattern matching for mapping conversions

* Remove unnecessary argument from Mapper.to_speckle
2024-02-21 16:59:40 +03:00
Oğuzhan Koral 6a16327c30 Fix (Cache): CNX-8976 bug on initialization on clear setup (#323)
* Call sketchup functions before mount

* Change default to app.speckle.systems

* Use account id instead uuid to get selected account before
2024-02-20 23:54:15 +03:00
Oğuzhan Koral 060b1b8f41 Fix (Attributes): Fix typos 2024-02-15 16:43:32 +03:00
Oğuzhan Koral da2e228293 Fix (FE2): CNX-8877 bug access error by fe2 model url (#321)
* Disable reload

* Enrich selected account info and fix same user id issue

* Trigger sketchup only saved stream not exists

* Fix activeAccount

* Increase number of branches limit to 100

* Check regex match
2024-02-13 16:36:35 +03:00
Oğuzhan Koral ab7397bf55 Feat (FE2): CNX-8702 fe2 urls (#320)
* Recreate ApolloProvider whenever account switches

- It is a force-push of reload page whenever user switches account. It doesn't hurt

* Fix FE2 urls and streamWrapper flag argument
2024-02-03 02:36:41 +03:00
Oğuzhan Koral f79547f781 Reset UI location to center of SketchUp (#319) 2024-01-31 23:00:46 +03:00
Oğuzhan Koral 2152f1c90e Feat (Mapper): CNX-8309 Family instances (#318)
* Implement New Revit Family option

* Filter family types for 'Family Instance'

* Adjust available mapping methods according to selection

* Set hard coded categories just once and source families when source set/updated

* Implement family instance mapping

* Pass group selection info if only group selected

* Exclude definitions from conversion escape

- Previously we were using definition mappings only for direct shape conversions but now they can live in instances

* Add direct shape option to components back

* Calculate rotation of family instance

* Fix transformation matrix

* Use insertion point for instances

* Set inputs for mapped definition
2024-01-08 18:40:55 +03:00
Oğuzhan Koral 503fb4d246 Feat (GIS): support line element 2023-12-01 01:46:53 +03:00
oguzhankoral 2befefa752 Extract utils for line and polygon element 2023-11-30 15:07:31 +03:00
oguzhankoral 85e64c5076 Add line element support 2023-11-30 00:36:47 +03:00
Oğuzhan Koral 60523dc994 Fix (Collections): Support gis collections and none unit 2023-11-29 16:06:58 +03:00
oguzhankoral 6d780bf350 Rename GisLayerCollection as generic 2023-11-29 16:06:37 +03:00
oguzhankoral eec02a1f84 Support none unit 2023-11-29 15:58:26 +03:00
oguzhankoral ace2fe6fe3 WIP: Convert from 'meters' to 'm' 2023-11-29 13:26:53 +03:00
oguzhankoral 188794af8d Add support for vector layer 2023-11-29 13:26:53 +03:00
Oğuzhan Koral 92a941a944 Fix (Instancing): correct id of definition for speckle entity 2023-11-29 13:25:51 +03:00
oguzhankoral 0e1ddf2b11 Tweak definition speckle entity checks 2023-11-29 13:15:07 +03:00
Oğuzhan Koral b57fa010d1 Fix (Config): Reset configs if configSketchup somehow corrupted 2023-11-28 22:38:56 +03:00
oguzhankoral f816452b78 Reset configs if configSketchup somehow corrupted 2023-11-28 22:36:03 +03:00
oguzhankoral 133308141b Merge branch 'development' 2023-11-28 13:57:11 +03:00
Oğuzhan Koral 120083bb31 Feat (Performance): receive performance improvements 2023-11-28 13:54:36 +03:00
oguzhankoral a5bb5c4686 Remove logging 2023-11-28 13:31:19 +03:00
oguzhankoral e5e2729f0a Wrap receive into sketchup operation for performance improvement 2023-11-28 11:57:17 +03:00
oguzhankoral ba8b902f48 Merge coplanar faces at the end of the operation 2023-11-28 11:23:30 +03:00
oguzhankoral 2d67815ae6 Remove unused lines 2023-11-27 23:36:10 +03:00
oguzhankoral ec0c9066d2 Merge coplanar faces remove scoping and check normals first 2023-11-27 21:44:15 +03:00
Oğuzhan Koral 58ae858077 Update dev with changes in main 2023-11-13 19:45:20 +03:00
Oğuzhan Koral 613e7938b3 Fix (Scene): missing views from Revit 2023-11-13 14:35:09 +03:00
oguzhankoral e07ff1a445 Fix missing views from Revit
- Previously it was assuming views arrive in elements of collection
2023-11-13 14:15:32 +03:00
Oğuzhan Koral de7dd34ea2 Feat (FE2): Support fe2 terminology and urls 2023-11-13 12:03:19 +03:00
oguzhankoral 0552f695f9 Update FE2 terms for Mapper Tool 2023-11-10 16:49:51 +03:00
oguzhankoral b8d4f3d946 Parse FE2 urls to add projects via ADD BY ID OR URL 2023-11-10 15:52:06 +03:00
oguzhankoral fa112a70b1 Switch to FE2 as user preferences 2023-11-10 15:13:58 +03:00
oguzhankoral 97309ebb88 Merge remote-tracking branch 'origin/development' 2023-09-19 08:31:29 +03:00
Oğuzhan Koral 556ddc0b6f Feat (deploy): Mac support 🍎 2023-09-11 10:40:08 +03:00
Oğuzhan Koral a0dde690ea Fix intendation 2023-09-08 18:17:59 +03:00
Oğuzhan Koral a76dab5be6 Remove mac suffix from deploy manager 2023-09-08 18:16:15 +03:00
Oğuzhan Koral 2d10bc5bbf Deploy manager for mac 2023-09-08 18:13:15 +03:00
Oğuzhan Koral 4042632e0b Fix (Revit): Support curtain walls from revit 2023-09-08 13:37:07 +03:00
oguzhankoral 7ccf83e1a4 Consider speckle id for revit definition 2023-09-08 13:17:16 +03:00
oguzhankoral 019cd0756f Convert revit walls to native instead with display value 2023-09-08 13:16:50 +03:00
József L. Kiss 0e5f9f80be CI integration of mac build (#301)
* patcher

* patch-version

* fix 1

* fix 2

* patch_version

* revert

* mac installer

* slname

* checkout

* powershell

* SEMVER

* python

* installername

* git checkout

* cd speckle-sharp-ci-tools

* zip

* zip location

* white space

* remove checktou

---------

Co-authored-by: József L. Kiss <>
2023-09-07 17:05:02 +03:00
József L. Kiss fc6767860a Add release version of sqlit3 bundle 2023-08-17 13:05:13 +02:00
oguzhankoral 5b5b4be7b2 Mac AppData folder 2023-08-16 17:22:25 +03:00
oguzhankoral 45351d082e Add sqlite3_27.bundle for mac 2023-08-16 16:30:43 +03:00
Oğuzhan Koral 22ccd07491 Release 2.15 2023-07-25 14:48:22 +03:00
Oğuzhan Koral 2cf9ee647b Fix (Mapper): Add offset parameter to walls 2023-07-25 14:26:21 +03:00
oguzhankoral efb567824b Add offset parameter to walls 2023-07-12 13:01:16 +03:00
Oğuzhan Koral f0aac39486 Chore (Mixpanel): tracking for mapper actions 2023-07-06 10:03:08 +03:00
oguzhankoral f278055805 Correct mappings set and applied 2023-07-03 12:27:23 +03:00
oguzhankoral 6f2e36fd11 Add mixpanel tracking for mapper 2023-07-03 12:03:37 +03:00
Oğuzhan Koral 119d80ffc8 Fix (Mapper): Definition mapping 2023-06-29 22:42:36 +03:00
oguzhankoral 771c3df864 Fix definition mapping 2023-06-29 22:39:31 +03:00
Oğuzhan Koral 7d1963e458 Feat (Mapper): Revit and default wall support 2023-06-26 12:23:52 +03:00
oguzhankoral dde85972b3 Add default wall 2023-06-26 12:20:32 +03:00
oguzhankoral 5e061da910 Correct tooltips according to source state 2023-06-26 11:49:34 +03:00
oguzhankoral 46bea345de RevitWall from baseline 2023-06-26 11:33:09 +03:00
Oğuzhan Koral bc53462ad6 Chore (Mapper): Rename Floor with RevitFloor 2023-06-26 10:47:50 +03:00
oguzhankoral 884df40a1d Rename Floor with RevitFloor 2023-06-26 10:45:40 +03:00
Oğuzhan Koral b23168c067 Fix (Mapper): evaluate mapping source family data 2023-06-26 10:07:48 +03:00
oguzhankoral 5568212f15 Correct type names from source 2023-06-25 20:48:16 +03:00
oguzhankoral 79db79d799 Remove braces from mapper 2023-06-25 20:47:54 +03:00
oguzhankoral 18a4008efd Set selected level name string instead of object 2023-06-25 20:20:17 +03:00
oguzhankoral 83e4abd1ee Update family types when family updated 2023-06-23 18:37:47 +03:00
oguzhankoral 243bcfba72 Make dropdowns functional 2023-06-23 18:33:39 +03:00
Oğuzhan Koral af2c8c560f Feat (Mapper): mapper method by selection and floor creation 2023-06-22 17:27:49 +03:00
oguzhankoral 6a37f3871c Add new types as constants 2023-06-22 17:18:00 +03:00
oguzhankoral 759a388448 Register levels as speckle entity 2023-06-22 17:17:47 +03:00
oguzhankoral 360e89d7ce Separate default floor with native floor 2023-06-22 17:17:23 +03:00
oguzhankoral 64655a3284 Pass speckle state to speckle conversions to detect levels 2023-06-22 17:16:47 +03:00
oguzhankoral c58356bde8 Rename with_mapper_selection_queue with better one 2023-06-22 17:16:06 +03:00
oguzhankoral f74117632d Pass stream id to level object to create it as speckle entity 2023-06-22 17:15:23 +03:00
oguzhankoral 5f2b8b8e2b Parse family type level info from command to action 2023-06-22 17:15:00 +03:00
oguzhankoral f0ce7481fd Register clear mapper source action to commands 2023-06-22 17:14:38 +03:00
oguzhankoral 6e7a5c6140 Apply and clear mapping source by buttons instead of auto-apply 2023-06-22 17:13:52 +03:00
oguzhankoral 079c18ee19 Apply mappings also for family, type and level 2023-06-22 17:13:25 +03:00
oguzhankoral 26ef6a3815 Add clearing mapper source action 2023-06-22 17:12:18 +03:00
oguzhankoral cf6dcefe6c Separate mapper data collection from Sketchup selection 2023-06-22 17:11:41 +03:00
oguzhankoral 35590eb979 Add revit parameter object 2023-06-22 17:11:07 +03:00
oguzhankoral 583a8b8a76 Separate mapper related read functions 2023-06-20 08:18:08 +03:00
Oğuzhan Koral c6e8a664de Feat (Mapper): Fetch mapper source 2023-06-19 15:10:43 +03:00
oguzhankoral 24a5e0a579 Update levels geometrically when we have new commit 2023-06-19 12:57:48 +03:00
oguzhankoral a242c197fb Store mapper source in ruby state 2023-06-16 23:10:50 +03:00
oguzhankoral 08bdd23149 Add state for mapper 2023-06-16 21:57:13 +03:00
oguzhankoral c5b35b2d98 Notify user when selected source has new update 2023-06-16 16:23:27 +03:00
oguzhankoral 5407fecd1f Fetch source branch last commit and pass to ruby 2023-06-15 16:10:10 +03:00
oguzhankoral 12d2821d26 Add mapping source selection 2023-06-15 12:09:39 +03:00
Oğuzhan Koral 2e6d58e6a3 Feat (Mapper): mapping for default floor 2023-06-14 22:20:21 +03:00
oguzhankoral 0f0c0fd5ae Check material nil 2023-06-14 16:50:04 +03:00
oguzhankoral ef9ec1c223 Send floors with global coordinates as flat list 2023-06-14 01:11:37 +03:00
oguzhankoral f4387bae30 Send @SpeckleSchema as detached property 2023-06-13 11:50:35 +03:00
oguzhankoral 49b238a23a Extract mapped elements on selection 2023-06-13 11:49:24 +03:00
oguzhankoral 4b75c01b28 Convert sketchup faces to built elements' floor 2023-06-12 13:36:09 +03:00
Oğuzhan Koral e7f641046b Fix (Send): Do not send hidden geometries in components 2023-06-09 15:26:16 +03:00
oguzhankoral 9aaabe0fab Do not send hidden geometries in components 2023-06-09 15:24:40 +03:00
Oğuzhan Koral b6e4b711bf Feat (Edge): support rhino curve types 2023-06-09 11:19:57 +03:00
oguzhankoral 58fcfd210b Support arc and circle 2023-06-09 11:12:04 +03:00
oguzhankoral 5868b9c234 Support polycurves as displayValues 2023-06-09 09:55:52 +03:00
Oğuzhan Koral 0dc6d9cf9d Fix (DisplayValue): Use name of display value first 2023-06-08 23:42:05 +03:00
oguzhankoral 67f50cf2fd If displayValue has name use it 2023-06-08 23:39:54 +03:00
Oğuzhan Koral 8b26a4d49a Chore (DisplayValue): Better component names for displayValues 2023-06-08 23:15:07 +03:00
oguzhankoral a1d0bb0aa1 Instance name as speckle_type only 2023-06-08 23:08:25 +03:00
oguzhankoral bfe08560b1 Use speckle type instead def 2023-06-08 22:31:28 +03:00
Oğuzhan Koral ac3ac24272 Fix (Scene): Orthogonal view receiving as zoomed in 2023-06-08 14:39:07 +03:00
oguzhankoral 03e7191d0e Remove unnecessary lines on to_native 2023-06-08 14:36:39 +03:00
oguzhankoral b3a42f8723 Extract camera creation fuction to fix rubocop warnings 2023-06-08 14:34:18 +03:00
oguzhankoral 9c4b740300 Send 35mm focal length if camera is orthogonal 2023-06-08 14:27:05 +03:00
oguzhankoral 2a12bdadf2 Set camera height for isometric views 2023-06-08 14:14:34 +03:00
Oğuzhan Koral c90e8ad4d2 Feat (Face): extrudable brep faces 2023-06-08 12:23:21 +03:00
oguzhankoral 4a52c51c86 Rename returning single faces as ngon 2023-06-08 12:19:09 +03:00
oguzhankoral 0efc817ddc Remove remaining orphan edges after clean up 2023-06-07 13:06:16 +03:00
oguzhankoral fee54fc98c Do not smooth and soft single faces 2023-06-07 13:05:58 +03:00
oguzhankoral 210f751396 Return added entities too from conversion 2023-06-07 13:05:35 +03:00
Oğuzhan Koral 2e2bc3fe29 Feat (Layers): support flat layers 2023-06-06 13:35:05 +03:00
oguzhankoral a6f05f86d1 Document layer strategies 2023-06-06 13:33:37 +03:00
oguzhankoral fc144e4848 Convert layers as flat list from Rhino 2023-06-06 11:43:22 +03:00
oguzhankoral cef9531428 Log function to help write texts to local file 2023-06-06 11:42:54 +03:00
oguzhankoral abd4faefbf Move speckle entity creation from speckle object to SpeckleEntity class 2023-06-06 08:17:31 +03:00
Oğuzhan Koral 966f7aaed5 Fix (Collection): fix blender receive 2023-05-29 18:12:02 +03:00
oguzhankoral 51b59fa995 Fix typo on including string 2023-05-29 18:09:48 +03:00
oguzhankoral 0b713736bd Include also detached @elements props to displayValue 2023-05-29 18:06:05 +03:00
oguzhankoral 9e33581c66 Accept also detached @displayValue props 2023-05-29 18:05:29 +03:00
oguzhankoral b97792b596 Check only collection is model or not 2023-05-29 18:04:56 +03:00
Matteo Cominetti c0746f8eff Merge pull request #270 from specklesystems/oguzhan/hash-only-hostname-of-server-url 2023-05-25 18:17:37 +01:00
oguzhankoral a826a9d692 Hash hostname of the serverUrl 2023-05-25 20:09:32 +03:00
Oğuzhan Koral 6d04203d37 Feat (Collections): Eliminate relations for layer info 2023-05-24 15:57:47 +03:00
oguzhankoral 33b2ed8a94 Fix performance penalty 2023-05-24 14:38:27 +03:00
oguzhankoral 4f16da7ad0 Do not extract relations if from revit 2023-05-24 01:16:51 +03:00
oguzhankoral 36f92c7655 Add network object support 2023-05-24 01:00:06 +03:00
oguzhankoral 1d4f5a759e Eliminate relations for model collections 2023-05-23 23:31:02 +03:00
oguzhankoral 28af9bc811 Enable rescue block for to_native 2023-05-23 12:07:48 +03:00
oguzhankoral cf04cd4094 Check view up and direction parallel or not 2023-05-23 11:50:08 +03:00
oguzhankoral 23e9efb28a Pass layer prop through to_native methods 2023-05-23 11:49:51 +03:00
Oğuzhan Koral 57322df29c Fix (Layer): Do not send line_style if none 2023-05-22 13:57:23 +03:00
oguzhankoral fff82d34c6 Do not send line_style if none 2023-05-22 13:56:10 +03:00
Oğuzhan Koral 7211860c21 Chore (Layer): Support line styles for layers 2023-05-22 11:46:52 +03:00
oguzhankoral 9fc69044f8 Support line styles for layers 2023-05-22 11:42:51 +03:00
Oğuzhan Koral 76467c3e81 Fix (Blocks): Eliminate nil block geometries 2023-05-19 19:36:28 +03:00
oguzhankoral 4cfc04e2f3 Eliminate nil block geometries 2023-05-19 19:13:15 +03:00
Oğuzhan Koral 6bfc7771d0 Fix (Face): Merge coplanar doesn't work some cases 2023-05-19 12:26:24 +03:00
oguzhankoral 7055135257 Return nil if layer path nil 2023-05-19 12:20:55 +03:00
Oğuzhan Koral 85312cf20d Fix (Mapper): inconsistency on mapped elements table state 2023-05-16 13:36:27 +03:00
oguzhankoral 4051cae5b0 Clear cached element and category selection when mapped elements updated 2023-05-16 13:27:02 +03:00
oguzhankoral c64bb6dedf Include instances for button reactions
- Clear, Isolate, Hide, Select
2023-05-16 13:25:41 +03:00
Oğuzhan Koral 7bb17ae0db Fix (Collections): Add layer property to objects as full path 2023-05-16 08:39:06 +03:00
oguzhankoral 3244eb9b15 Add layer property to objects as full path
This is for receiving on Rhino
2023-05-16 08:33:42 +03:00
Oğuzhan Koral 6e173847ba Fix (Performance): Smooth only non-planar quad meshes 2023-05-15 13:53:56 +03:00
oguzhankoral 8cbc1f763d Smooth only non-planar quad meshes 2023-05-15 13:40:31 +03:00
Oğuzhan Koral 2d45abeb28 Release 2.14.0
Merging 2.13 hotfixes into dev branch
2023-05-15 13:17:54 +03:00
oguzhankoral 2fd0ad77bc Fix or disable rubocop issues 2023-05-15 13:14:32 +03:00
oguzhankoral 53c1167831 Remove orthogonality checks 2023-05-15 13:04:22 +03:00
oguzhankoral 48d4a1d7bb Add plane_utils to calculate planarity of 4 points for quad meshes 2023-05-15 13:04:19 +03:00
oguzhankoral 4bbbba6e89 Split all quad meshes 2023-05-15 13:03:22 +03:00
oguzhankoral 0a13575325 Disable rubocop for to_native 2023-05-15 13:02:12 +03:00
368 changed files with 11154 additions and 2249 deletions
Vendored
BIN
View File
Binary file not shown.
+9 -154
View File
@@ -1,162 +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: cmd.exe
parameters:
slug:
type: string
default: ""
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Create Innosetup signing cert
shell: powershell.exe
command: |
echo $env:PFX_B64 > "speckle-sharp-ci-tools\SignTool\AEC Systems Ltd.txt"
certutil -decode "speckle-sharp-ci-tools\SignTool\AEC Systems Ltd.txt" "speckle-sharp-ci-tools\SignTool\AEC Systems Ltd.pfx"
- 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 >>
- 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
#- run:
# name: Patch
# shell: powershell.exe
# command:
# | # If no tag, use 0.0.0.1 and don't make any YML (for testing only!)
# $tag = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "0.0.0" } else { $env:CIRCLE_TAG }
# $semver = if($tag.Contains('/')) {$tag.Split("/")[1] } else { $tag }
# $ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver }
# $channel = if($semver.Contains('-')) {$semver.Split("-")[1] } else { "latest" }
# $version = "$($ver).$($env:CIRCLE_BUILD_NUM)"
# New-Item -Force "speckle-sharp-ci-tools/Installers/sketchup/$channel.yml" -ItemType File -Value "version: $semver"
# echo $version
# python patch_version.py $semver
# speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\sketchup.iss
- 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
- persist_to_workspace:
root: ./
paths:
- speckle-sharp-ci-tools
- 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: innosetup
- 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\/.*/
- 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
+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: jrm/installer-warnings
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-*
-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.4 KiB

@@ -1,31 +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
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.default_account
accounts = load_accounts
accounts.select { |acc| acc['isDefault'] }[0] || accounts[0]
end
end
end
@@ -1,84 +0,0 @@
# frozen_string_literal: true
require_relative 'event_action'
require_relative '../../sketchup_model/utils/face_utils'
require_relative '../../constants/dict_constants'
module SpeckleConnector
module Actions
module Events
# Event actions related to entities.
class EntitiesEventAction < EventAction
# Event action when element added.
class OnElementAdded
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, event_data)
modified_entities = event_data.to_a.collect { |e| e[1] }
# do not copy speckle base object specific attributes, because they are entity specific
modified_entities.each { |entity| entity.delete_attribute(SPECKLE_BASE_OBJECT) }
state
end
end
# Event action when element modified.
class OnElementModified
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, event_data)
speckle_state = state.speckle_state
modified_entity = event_data[0][1]
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
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
diffing = state.user_state.preferences[:user][:diffing]
new_speckle_state = new_speckle_state.with_invalid_streams_queue if diffing
return state.with_speckle_state(new_speckle_state)
end
state
end
# @param speckle_state [States::SpeckleState] the current state of the Speckle
def self.speckle_entities_to_invalidate(speckle_state, ids)
speckle_state.speckle_entities.to_h.select { |id, _| ids.include?(id) }
end
# @param speckle_state [States::SpeckleState] the current state of the Speckle
def self.invalidate_speckle_entities(speckle_state, entities_to_invalidate)
speckle_entities = speckle_state.speckle_entities
entities_to_invalidate.each do |id, speckle_entity|
edited_speckle_entity = speckle_entity.with_invalid
speckle_entities = speckle_entities.put(id, edited_speckle_entity)
end
speckle_state.with_speckle_entities(speckle_entities)
end
end
# Event action when element removed.
class OnElementRemoved
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, _event_data)
# TODO: Do state updates when element removed
state
end
end
# Handlers that are used to handle specific events
ACTIONS = {
onElementRemoved: OnElementRemoved,
onElementAdded: OnElementAdded,
onElementModified: OnElementModified
}.freeze
def self.actions
ACTIONS
end
end
end
end
end
@@ -1,33 +0,0 @@
# frozen_string_literal: true
require_relative 'event_action'
require_relative '../../mapping/category/revit_category'
require_relative '../../sketchup_model/reader/speckle_entities_reader'
require_relative '../../sketchup_model/query/entity'
module SpeckleConnector
module Actions
module Events
# Update selected speckle objects when the selection changes for mapping tool.
class SelectionEventAction < EventAction
# @param state [States::State] the current state of Speckle application.
# @return [States::State] the new updated state object
def self.update_state(state, event_data)
return state unless event_data&.any?
sketchup_selection = state.sketchup_state.sketchup_model.selection
selection = {
selection: SketchupModel::Reader::SpeckleEntitiesReader.entities_schema_details(sketchup_selection),
mappingMethods: [
'Direct Shape'
],
categories: Mapping::Category::RevitCategory.to_a
}
selection = { selection: [], mappingMethods: [], categories: [] } if sketchup_selection.none?
state.with_selection_queue(selection)
end
end
end
end
end
@@ -1,45 +0,0 @@
# frozen_string_literal: true
require_relative 'action'
require_relative '../accounts/accounts'
require_relative '../actions/create_stream'
require_relative '../actions/queue_send'
require_relative '../convertors/to_speckle'
module SpeckleConnector
module Actions
# Sends to speckle.
class OneClickSend < 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)
puts 'send to speckle'
default_account = Accounts.default_account
if default_account.nil?
puts 'No local account found. Please refer to speckle.guide for more information.'
return state
end
sketchup_model = state.sketchup_state.sketchup_model
to_convert = sketchup_model.selection.count > 0 ? sketchup_model.selection : sketchup_model.entities
first_saved_stream = first_saved_stream(sketchup_model)
action = if first_saved_stream.nil?
Actions::CreateStream.new
else
Actions::QueueSend.new(first_saved_stream, convert_to_speckle(sketchup_model, to_convert))
end
action.update_state(state)
end
def self.first_saved_stream(model)
(saved_streams = model.attribute_dictionary('speckle', true)['streams']) or []
saved_streams.nil? || saved_streams.empty? ? nil : saved_streams[0]
end
def self.convert_to_speckle(sketchup_model, to_convert)
converter = Converters::ToSpeckle.new(sketchup_model)
to_convert.map { |entity| converter.convert(entity) }
end
end
end
end
-42
View File
@@ -1,42 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
module Commands
# Base command schema to wrap common operations for all commands.
class Command
# @return [App::SpeckleConnectorApp] the main app object
attr_reader :app
# @return [Ui::View] view object holds dialog and it's state
attr_reader :view
# @@param app [App::SpeckleConnectorApp] the main app object
def initialize(app)
@app = app
@view = app.ui_controller.user_interfaces[Ui::SPECKLE_UI_ID]
end
def run(*parameters)
# Run here common operations that same for each command.
with_observers_disabled do
_run(*parameters)
end
end
private
def with_observers_disabled(&block)
observer_handler = @app.observer_handler
if observer_handler
observer_handler.with_observers_disabled(&block)
else
block.call
end
end
def _run(*_parameters)
raise NotImplementedError, 'Implement in subclass'
end
end
end
end
@@ -1,15 +0,0 @@
# frozen_string_literal: true
require_relative 'command'
module SpeckleConnector
module Commands
# Run this command when the UI is ready to get data
class DialogReady < Command
# Update the selected user interface
def _run(_data)
view.update_view(app.state)
end
end
end
end
@@ -1,58 +0,0 @@
# frozen_string_literal: true
require_relative 'menu_command_handler'
require_relative 'action_command'
require_relative 'initialize_speckle'
require_relative '../actions/one_click_send'
module SpeckleConnector
module Commands
# Speckle menu commands that adds them to Sketchup menu and toolbar.
class SpeckleMenuCommands
CMD_INITIALIZE_SPECKLE = :initialize_speckle
CMD_SEND_TO_SPECKLE = :send_to_speckle
CMD_RECEIVE_FROM_SPECKLE = :receive_from_speckle
# Add initial set of commands to Speckle application object and to Sketchup menu and toolbar
# @param app [App::SpeckleConnectorApp] the application object
def self.add_initial_commands!(app)
commands = app.menu_commands
ui_controller = app.ui_controller
sketchup_ui = ui_controller.sketchup_ui
speckle_menu = sketchup_ui.speckle_menu
speckle_toolbar = sketchup_ui.speckle_toolbar
commands[CMD_INITIALIZE_SPECKLE] = initialize_speckle_command(app)
commands.add_to_menu!(CMD_INITIALIZE_SPECKLE, speckle_menu)
commands.add_to_toolbar!(CMD_INITIALIZE_SPECKLE, speckle_toolbar)
# commands[CMD_SEND_TO_SPECKLE] = send_command(app)
# commands.add_to_menu!(CMD_SEND_TO_SPECKLE, speckle_menu)
# commands.add_to_toolbar!(CMD_SEND_TO_SPECKLE, speckle_toolbar)
end
def self.initialize_speckle_command(app)
cmd = MenuCommandHandler.sketchup_command(
InitializeSpeckle.new(app), 'Initialize Speckle'
)
cmd.tooltip = 'Launch Connector'
cmd.status_bar_text = 'Opens the Speckle Connector window'
cmd.small_icon = '../../img/s2logo.png'
cmd.large_icon = '../../img/s2logo.png'
cmd
end
def self.send_command(app)
cmd = MenuCommandHandler.sketchup_command(
ActionCommand.new(app, Actions::OneClickSend), 'Send to Speckle'
)
cmd.tooltip = 'Send to Speckle'
cmd.status_bar_text = 'Send to Speckle'
cmd.small_icon = '../../img/Sender.png'
cmd.large_icon = '../../img/Sender.png'
cmd.set_validation_proc { MenuCommandHandler.speckle_started(app) }
cmd
end
end
end
end
@@ -1,8 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
APP_OBSERVER = 'SpeckleConnector::Observers::AppObserver'
ENTITIES_OBSERVER = 'SpeckleConnector::Observers::EntitiesObserver'
MODEL_OBSERVER = 'SpeckleConnector::Observers::ModelObserver'
SELECTION_OBSERVER = 'SpeckleConnector::Observers::SelectionObserver'
end
@@ -1,23 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
BASE_OBJECT = 'Base'
OBJECTS_GIS_POLYGONELEMENT = 'Objects.GIS.PolygonElement'
OBJECTS_BUILTELEMENTS_VIEW3D = 'Objects.BuiltElements.View:Objects.BuiltElements.View3D'
OBJECTS_BUILTELEMENTS_REVIT_DIRECTSHAPE = 'Objects.BuiltElements.Revit.DirectShape'
OBJECTS_BUILTELEMENTS_REVIT_LEVEL = 'Objects.BuiltElements.Level:Objects.BuiltElements.Revit.RevitLevel'
OBJECTS_GEOMETRY_LINE = 'Objects.Geometry.Line'
OBJECTS_GEOMETRY_POLYLINE = 'Objects.Geometry.Polyline'
OBJECTS_GEOMETRY_MESH = 'Objects.Geometry.Mesh'
OBJECTS_GEOMETRY_BREP = 'Objects.Geometry.Brep'
OBJECTS_OTHER_BLOCKINSTANCE = 'Objects.Other.BlockInstance'
OBJECTS_OTHER_BLOCKINSTANCE_FULL = 'Objects.Other.Instance:Objects.Other.BlockInstance'
OBJECTS_OTHER_INSTANCE = 'Objects.Other.Instance:Objects.Other.Instance'
OBJECTS_OTHER_REVIT_REVITINSTANCE = 'Objects.Other.Revit.RevitInstance'
OBJECTS_OTHER_BLOCKDEFINITION = 'Objects.Other.BlockDefinition'
OBJECTS_OTHER_RENDERMATERIAL = 'Objects.Other.RenderMaterial'
end
@@ -1,127 +0,0 @@
# frozen_string_literal: true
require_relative 'converter'
require_relative 'base_object_serializer'
require_relative '../speckle_objects/base'
require_relative '../speckle_objects/geometry/line'
require_relative '../speckle_objects/geometry/length'
require_relative '../speckle_objects/geometry/mesh'
require_relative '../speckle_objects/other/block_instance'
require_relative '../speckle_objects/other/block_definition'
require_relative '../speckle_objects/other/rendering_options'
require_relative '../speckle_objects/built_elements/view3d'
require_relative '../speckle_objects/built_elements/revit/direct_shape'
require_relative '../speckle_objects/relations/layers'
require_relative '../speckle_objects/speckle/core/models/model_collection'
require_relative '../constants/path_constants'
require_relative '../sketchup_model/reader/speckle_entities_reader'
require_relative '../sketchup_model/query/entity'
module SpeckleConnector
module Converters
# Converts sketchup entities to speckle objects.
class ToSpeckle < Converter
MODEL_COLLECTION = SpeckleObjects::Speckle::Core::Models::ModelCollection
DIRECT_SHAPE = SpeckleObjects::BuiltElements::Revit::DirectShape
SPECKLE_ENTITIES_READER = SketchupModel::Reader::SpeckleEntitiesReader
VIEW3D = SpeckleObjects::BuiltElements::View3d
# Convert selected objects by putting them into related array that grouped by layer.
# @return [Hash{Symbol=>Array}] layers -which only have objects- to hold it's objects under the base object.
def convert_selection_to_base(preferences)
convert = method(:convert)
new_speckle_state, model_collection = MODEL_COLLECTION.from_sketchup_model(sketchup_model, speckle_state,
@units, preferences, &convert)
# send only layers that have any object
model_collection[:layers_relation] = SpeckleObjects::Relations::Layers.from_model(sketchup_model)
return new_speckle_state, model_collection
end
# Serialized and traversed information to send batches.
# @param base_and_entity [SpeckleObjects::Base] base object to serialize.
# @return [String, Integer, Array<Object>] base id, total_children_count of base and batches
def serialize(base_and_entity, speckle_state, preferences)
serializer = SpeckleConnector::Converters::BaseObjectSerializer.new(speckle_state, stream_id, preferences)
t = Time.now.to_f
id = serializer.serialize(base_and_entity)
batches = serializer.batch_objects
# write_to_speckle_folder(id, batches)
puts "Generating traversed object elapsed #{Time.now.to_f - t} s"
base_total_children_count = serializer.total_children_count(id)
return id, base_total_children_count, batches, serializer.speckle_state
end
def write_to_speckle_folder(id, batches)
folder_path = "#{HOME_PATH}/Speckle"
file_path = "#{folder_path}/#{id}.json"
FileUtils.mkdir_p(folder_path) unless File.exist?(folder_path)
File.write(file_path, batches.first)
end
# @param entity [Sketchup::Entity] sketchup entity to convert Speckle.
# @param speckle_state [States::SpeckleState] the current speckle state of the {States::State}
# @param parent [Symbol, String] parent of the Sketchup Entity to be converted.
def convert(entity, preferences, speckle_state, parent = :base)
convert = method(:convert)
unless SketchupModel::Reader::SpeckleEntitiesReader.mapped_with_schema?(entity)
return from_native_to_speckle(entity, preferences, speckle_state, parent, &convert)
end
return speckle_state, nil
end
def from_mapped_to_speckle(entity, path, preferences)
direct_shape = SpeckleObjects::BuiltElements::Revit::DirectShape
.from_entity(entity, path, @units, preferences)
return [direct_shape, [entity]]
end
# rubocop:disable Metrics/MethodLength
def from_native_to_speckle(entity, preferences, speckle_state, parent, &convert)
if entity.is_a?(Sketchup::Edge)
line = SpeckleObjects::Geometry::Line.from_edge(entity, @units, preferences[:model]).to_h
return speckle_state, [line, [entity]]
end
if entity.is_a?(Sketchup::Face)
mesh = SpeckleObjects::Geometry::Mesh.from_face(face: entity, units: @units,
model_preferences: preferences[:model])
return speckle_state, [mesh, [entity]]
end
if entity.is_a?(Sketchup::Group)
new_speckle_state, block_instance = SpeckleObjects::Other::BlockInstance.from_group(
entity, @units, preferences, speckle_state, &convert
)
speckle_state = new_speckle_state
return speckle_state, [block_instance, [entity]]
end
if entity.is_a?(Sketchup::ComponentInstance)
new_speckle_state, block_instance = SpeckleObjects::Other::BlockInstance.from_component_instance(
entity, @units, preferences, speckle_state, &convert
)
speckle_state = new_speckle_state
return speckle_state, [block_instance, [entity]]
end
if entity.is_a?(Sketchup::ComponentDefinition)
# Local caching
return speckle_state, [definitions[entity.guid], [entity]] if definitions.key?(entity.guid)
new_speckle_state, block_definition = SpeckleObjects::Other::BlockDefinition.from_definition(
entity, @units, preferences, speckle_state, parent, &convert
)
definitions[entity.guid] = block_definition
speckle_state = new_speckle_state
return speckle_state, [block_definition, [entity]]
end
return speckle_state, nil
end
# rubocop:enable Metrics/MethodLength
end
end
end
Binary file not shown.
@@ -1,47 +0,0 @@
# frozen_string_literal: true
require_relative '../../constants/dict_constants'
module SpeckleConnector
# Operations related to {SketchupModel}.
module SketchupModel
# Definitions to store for entities.
class Definitions
def self.from_sketchup_model(model)
definitions = model.definitions
definitions = definitions.select do |definition|
!definition.attribute_dictionaries.nil? &&
definition.attribute_dictionaries.any? { |dict| dict.name == SPECKLE_BASE_OBJECT }
end
Definitions.new(definitions)
end
def add_definition(definition)
old_definition = @definitions_by_guid[definition.guid]
return self if definition == old_definition
new_definitions = @definitions.append(definition)
Definitions.new(new_definitions)
end
def initialize(definitions = [])
@definitions = definitions
@definitions_by_name = definitions.collect do |definition|
[definition.name, definition]
end.to_h.freeze
@definitions_by_guid = definitions.collect do |definition|
[definition.guid, definition]
end.to_h.freeze
freeze
end
def by_guid(guid)
@definitions_by_guid[guid]
end
def by_name(name)
@definitions_by_name[name]
end
end
end
end
@@ -1,55 +0,0 @@
# frozen_string_literal: true
require_relative '../../constants/mat_constants'
module SpeckleConnector
# Operations related to {SketchupModel}.
module SketchupModel
# Materials to store for entities.
class Materials
def self.from_sketchup_model(model)
materials = model.materials
materials = materials.select do |material|
!material.attribute_dictionaries.nil? &&
material.attribute_dictionaries.any? { |dict| dict.name == MAT_DICTIONARY }
end
mat_hash = materials.collect { |material| [material.get_attribute(MAT_DICTIONARY, MAT_ID), material] }.to_h
Materials.new(mat_hash)
end
def initialize(material_hash = {})
@materials_by_id = material_hash.freeze
@id_by_materials = material_hash.collect { |id, material| [material, id] }.to_h.freeze
freeze
end
def add_material(id, material)
old_material = @materials_by_id[id.to_sym]
return self if material == old_material
new_material_hash = @materials_by_id.merge({ id.to_sym => material })
Materials.new(new_material_hash)
end
def by_id(id)
@materials_by_id[id.to_sym]
end
def material_id(material)
@id_by_materials[material]
end
def add_speckle_material
@materials_by_id[MAT_ADD]
end
def edit_speckle_material
@materials_by_id[MAT_EDIT]
end
def remove_speckle_material
@materials_by_id[MAT_REMOVE]
end
end
end
end
@@ -1,25 +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
end
end
end
end
end
@@ -1,123 +0,0 @@
# frozen_string_literal: true
require_relative '../dictionary/speckle_schema_dictionary_handler'
require_relative '../../speckle_entities/speckle_entity'
require_relative '../../mapping/category/revit_category'
require_relative '../../constants/dict_constants'
module SpeckleConnector
# Operations related to {SketchupModel}.
module SketchupModel
# Reader model for sketchup model.
module Reader
# Reader module for speckle entities.
module SpeckleEntitiesReader
# @param entities [Sketchup::Entities] entities to collect speckle entities.
# @return [Hash{String=>Sketchup::Entity}] speckle entities with persistent id.
def self.read(entities)
speckle_entities = {}
entities.each do |entity|
speckle_entities[entity.persistent_id] = read_speckle_entity(entity) if speckle_entity?(entity)
next unless entity.is_a?(Sketchup::Group) || entity.is_a?(Sketchup::ComponentInstance)
if speckle_entity?(entity.definition)
speckle_entities[entity.definition.persistent_id] = read_speckle_entity(entity.definition)
end
definition_speckle_entities = read(entity.definition.entities)
speckle_entities = speckle_entities.merge(definition_speckle_entities)
end
speckle_entities
end
# @param entities [Sketchup::Entities] entities to collect mapped entities.
# @return [Hash{String=>Sketchup::Entity}] mapped entities with persistent id.
def self.read_mapped_entities(entities)
mapped_entities = {}
Query::Entity.flat_entities(entities).each do |entity|
mapped_entities[entity.persistent_id] = entity if mapped_with_schema?(entity)
end
mapped_entities
end
# @param entity [Sketchup::Entity] sketchup entity to read from attribute dictionary.
def self.read_speckle_entity(entity)
dict = entity.attribute_dictionaries.to_a.find { |d| d.name == SPECKLE_BASE_OBJECT }
speckle_id = dict[:speckle_id]
application_id = dict[:application_id]
speckle_type = dict[:speckle_type]
children = dict[:children]
valid_stream_ids = dict[:valid_stream_ids]
invalid_stream_ids = dict[:invalid_stream_ids]
SpeckleEntities::SpeckleEntity.new(entity, speckle_id, application_id, speckle_type, children,
valid_stream_ids, invalid_stream_ids)
end
# @param entity [Sketchup::Entity] sketchup entity to check if it was speckle entity once.
def self.speckle_entity?(entity)
return false if entity.attribute_dictionaries.nil?
return false if entity.attribute_dictionaries.to_a.empty?
entity.attribute_dictionaries.to_a.any? { |dict| dict.name == SPECKLE_BASE_OBJECT }
end
# @param entity [Sketchup::Entity] sketchup entity to check whether mapped with speckle schema or not.
def self.mapped_with_schema?(entity)
is_entity_mapped = !Dictionary::SpeckleSchemaDictionaryHandler.attribute_dictionary(entity).nil?
return is_entity_mapped if is_entity_mapped
return is_entity_mapped unless entity.is_a?(Sketchup::ComponentInstance)
!Dictionary::SpeckleSchemaDictionaryHandler.attribute_dictionary(entity.definition).nil?
end
def self.get_schema(entity)
Dictionary::SpeckleSchemaDictionaryHandler.speckle_schema_to_speckle(entity)
end
def self.entities_schema_details(entities)
entities.collect do |entity|
entity_selection_details = entity_selection_details(entity)
if entity.is_a?(Sketchup::ComponentInstance)
entity_selection_details = entity_selection_details.merge(
{ definition: entity_selection_details(entity.definition) }
)
end
entity_selection_details
end
end
def self.entity_selection_details(entity)
sanitized_type = entity.class.name.split('::').last.gsub(/(?<=[a-z])(?=[A-Z])/, ' ').split
is_definition = entity.is_a?(Sketchup::ComponentDefinition)
entity_type = is_definition ? sanitized_type.last : sanitized_type.first
speckle_schema = get_schema(entity)
{
name: speckle_schema['name'],
entityName: entity.respond_to?(:name) ? entity.name : '',
entityId: entity.persistent_id,
entityType: entity_type,
schema: speckle_schema,
numberOfInstances: is_definition ? entity.instances.length : 1
}
end
def self.mapped_entity_details(entities)
reverse_category_dictionary = Mapping::Category::RevitCategory.reverse_dictionary
entities.collect do |entity|
speckle_schema = get_schema(entity)
{
name: speckle_schema['name'],
category: speckle_schema['category'],
categoryName: reverse_category_dictionary[speckle_schema['category']],
method: speckle_schema['method'],
entityName: entity.respond_to?(:name) ? entity.name : '',
entityId: entity.persistent_id,
entityType: entity.class.name.split('::').last.gsub(/(?<=[a-z])(?=[A-Z])/, ' ').split.first,
schema: speckle_schema,
definitionSchema: entity.respond_to?(:definition) ? get_schema(entity.definition) : nil
}
end
end
end
end
end
end
@@ -1,18 +0,0 @@
# frozen_string_literal: true
require_relative '../../convertors/units'
module SpeckleConnector
module SpeckleObjects
# Geometric objects to convert speckle.
module Geometry
def self.length_to_speckle(length, units)
length.__send__("to_#{SpeckleConnector::Converters::SKETCHUP_UNIT_STRINGS[units]}")
end
def self.length_to_native(length, units)
length.__send__(SpeckleConnector::Converters::SKETCHUP_UNIT_STRINGS[units])
end
end
end
end
@@ -1,104 +0,0 @@
# frozen_string_literal: true
require_relative 'length'
require_relative 'point'
require_relative 'bounding_box'
require_relative '../base'
require_relative '../primitive/interval'
require_relative '../../sketchup_model/dictionary/base_dictionary_handler'
require_relative '../../sketchup_model/dictionary/speckle_schema_dictionary_handler'
module SpeckleConnector
module SpeckleObjects
module Geometry
# Line object definition for Speckle.
class Line < Base
SPECKLE_TYPE = 'Objects.Geometry.Line'
# @param start_pt [Geometry::Point] start point speckle object of the speckle line.
# @param end_pt [Geometry::Point] end point speckle object of the speckle line.
# @param domain [Primitive::Interval] interval speckle object of the speckle line -represents domain.
# @param units [String] units of the speckle line.
# @param application_id [String, nil] entity id of the {Sketchup::Edge} that represents to the speckle line.
# rubocop:disable Metrics/ParameterLists
def initialize(start_pt:, end_pt:, domain:, units:, layer:,
sketchup_attributes: {}, speckle_schema: {}, application_id: nil)
super(
speckle_type: 'Objects.Geometry.Line',
total_children_count: 0,
application_id: application_id,
id: nil
)
self[:start] = start_pt
self[:end] = end_pt
self[:domain] = domain
self[:units] = units
self[:layer] = layer unless layer.nil?
self[:SpeckleSchema] = speckle_schema if speckle_schema.any?
self[:sketchup_attributes] = sketchup_attributes if sketchup_attributes.any?
end
# rubocop:enable Metrics/ParameterLists
# @param edge [Sketchup::Edge] edge to convert line.
def self.from_edge(edge, units, model_preferences)
dictionaries = SketchupModel::Dictionary::BaseDictionaryHandler
.attribute_dictionaries_to_speckle(edge, model_preferences)
att = dictionaries.any? ? { dictionaries: dictionaries } : {}
speckle_schema = SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.speckle_schema_to_speckle(edge)
start_pt = Geometry::Point.from_vertex(edge.start.position, units)
end_pt = Geometry::Point.from_vertex(edge.end.position, units)
domain = Primitive::Interval.from_numeric(0, Float(edge.length), units)
Line.new(
start_pt: start_pt,
end_pt: end_pt,
domain: domain,
units: units,
layer: edge.layer.display_name,
sketchup_attributes: att,
speckle_schema: speckle_schema,
application_id: edge.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.
# @param entities [Sketchup::Entities] entities collection to add {Sketchup::Edge} into it.
# rubocop:disable Metrics/AbcSize
def self.to_native(state, line, entities, &_convert_to_native)
if line.key?('value')
values = line['value']
points = values.each_slice(3).to_a.map { |pt| Point.to_native(pt[0], pt[1], pt[2], line['units']) }
points.push(points[0]) if line['closed']
edges = entities.add_edges(*points)
else
start_pt = Point.to_native(line['start']['x'], line['start']['y'], line['start']['z'], line['units'])
end_pt = Point.to_native(line['end']['x'], line['end']['y'], line['end']['z'], line['units'])
edges = entities.add_edges(start_pt, end_pt)
end
line_layer = state.sketchup_state.sketchup_model.layers.to_a.find { |l| l.display_name == line['layer'] }
edges.each do |edge|
edge.layer = line_layer unless line_layer.nil?
unless line['sketchup_attributes'].nil?
SketchupModel::Dictionary::BaseDictionaryHandler
.attribute_dictionaries_to_native(edge, line['sketchup_attributes']['dictionaries'])
end
end
return state, edges
end
# rubocop:enable Metrics/AbcSize
def self.test_line(start_point, end_point, units)
domain = Primitive::Interval.from_numeric(0, 5, units)
Line.new(
start_pt: start_point,
end_pt: end_point,
domain: domain,
application_id: '',
units: units
)
end
end
end
end
end
@@ -1,25 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
module SpeckleObjects
module Others
# Color object transformations between sketchup and speckle.
class Color
# @param color [Sketchup::Color] color to convert speckle object
def self.to_speckle(color)
{
red: color.red,
green: color.green,
blue: color.blue,
alpha: color.alpha
}
end
def self.to_native(speckle_color)
Sketchup::Color.new(speckle_color['red'], speckle_color['green'],
speckle_color['blue'], speckle_color['alpha'])
end
end
end
end
end
@@ -1,79 +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'
def initialize(name:, visible:, is_folder:, 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[:collectionType] = 'layer'
self[:elements] = layers_and_folders if layers_and_folders.any?
end
# @param speckle_layer [Object] speckle layer object.
# @param folder [Sketchup::Layers, Sketchup::LayerFolder] folder to create layers in it.
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::Others::Color.to_native(speckle_layer['color']) if speckle_layer['color']
folder.add_layer(layer) if folder.is_a?(Sketchup::LayerFolder)
end
def self.to_native_layer_folder(speckle_layer_folder, folder, sketchup_model)
speckle_layers = speckle_layer_folder['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 = speckle_layer_folder['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,
color: SpeckleObjects::Others::Color.to_speckle(layer.color),
application_id: layer.persistent_id
)
end
end
end
end
end
@@ -1,52 +0,0 @@
# frozen_string_literal: true
require_relative 'layer'
require_relative '../base'
module SpeckleConnector
module SpeckleObjects
module Relations
# Sketchup layers (tag) tree relation. The difference between Layer is, this is the top object that holds
# properties for all layers or folders, i.e. active layer.
class Layers < Base
SPECKLE_TYPE = 'Speckle.Core.Models.Collection'
def initialize(active:, layers:)
super(
speckle_type: SPECKLE_TYPE,
total_children_count: 0,
application_id: nil,
id: nil
)
self[:active_layer] = active
self[:elements] = layers
end
def self.to_native(layers_relation, sketchup_model)
folder = sketchup_model.layers
SpeckleObjects::Relations::Layer.to_native_layer_folder(layers_relation, folder, sketchup_model)
active_layer = folder.to_a.find { |layer| layer.display_name == layers_relation['active_layer'] }
sketchup_model.active_layer = active_layer unless active_layer.nil?
end
def self.from_model(sketchup_model)
# init with headless layers
headless_layers = sketchup_model.layers.layers.collect do |layer|
SpeckleObjects::Relations::Layer.from_layer(layer)
end
folders = sketchup_model.layers.folders.collect do |folder|
SpeckleObjects::Relations::Layer.from_folder(folder)
end
Layers.new(
active: sketchup_model.active_layer.display_name,
layers: headless_layers + folders
)
end
end
end
end
end
@@ -1,69 +0,0 @@
# frozen_string_literal: true
require_relative 'collection'
require_relative 'layer_collection'
require_relative '../../../built_elements/view3d'
require_relative '../../../built_elements/revit/direct_shape'
module SpeckleConnector
module SpeckleObjects
module Speckle
module Core
module Models
# ModelCollection object that collect other speckle objects under it's elements.
class ModelCollection < Collection
DIRECT_SHAPE = SpeckleObjects::BuiltElements::Revit::DirectShape
VIEW3D = SpeckleObjects::BuiltElements::View3d
def initialize(name:, active_layer:, elements: [], application_id: nil)
super(
name: name,
collection_type: 'sketchup model',
elements: elements,
application_id: application_id
)
self[:active_layer] = active_layer
end
def self.from_sketchup_model(sketchup_model, speckle_state, units, preferences, &convert)
model_collection = ModelCollection.new(
name: 'Sketchup Model', active_layer: sketchup_model.active_layer.display_name,
application_id: sketchup_model.guid
)
# Direct shapes will pass directly to elements which are already flattened with all children
model_collection[:elements] += collect_direct_shapes(sketchup_model, units, preferences)
# Views will pass directly to elements since they don't have any relation with layers and geometries.
model_collection[:elements] += VIEW3D.from_model(sketchup_model, units) if sketchup_model.pages.any?
# Add layer collections.
model_collection[:elements] += LayerCollection.create_layer_collections(sketchup_model)
sketchup_model.selection.each do |entity|
layer_collection = LayerCollection.get_or_create_layer_collection(entity.layer, model_collection)
new_speckle_state, converted_object_with_entity = convert.call(entity, preferences, speckle_state)
speckle_state = new_speckle_state
unless converted_object_with_entity.nil?
layer_collection[:elements] = [] if layer_collection[:elements].nil?
layer_collection[:elements].append(converted_object_with_entity)
end
end
return speckle_state, model_collection
end
def self.collect_direct_shapes(sketchup_model, units, preferences)
DIRECT_SHAPE.direct_shapes_on_selection(sketchup_model).collect do |entities|
entity = entities[0]
path = entities[1..-1]
direct_shape = DIRECT_SHAPE.from_entity(entity, path, units, preferences)
[direct_shape, [entity]]
end
end
end
end
end
end
end
end
@@ -1,132 +0,0 @@
# frozen_string_literal: true
require_relative '../immutable/immutable'
require_relative '../callbacks/callback_message'
require_relative '../speckle_entities/speckle_entity'
module SpeckleConnector
module States
# State of the speckle on ruby.
class SpeckleState
include Immutable::ImmutableUtils
# @return [ImmutableHash{Integer=>SpeckleEntities::SpeckleEntity}] persistent_id of the sketchup entity and
# corresponding speckle entity
attr_reader :speckle_entities
# @return [ImmutableHash{Integer=>Sketchup::Entity}] persistent_id of the sketchup entity and itself
attr_reader :mapped_entities
# @return [Array] accounts on appdata.
attr_reader :accounts
# @return [Hash{Class => Observer}] the observer objects that are used to attach to objects in Sketchup to collect
# events that are triggered from Sketchup
attr_reader :observers
# @return [Hash] queue to send to server.
attr_reader :message_queue
# @return [Hash] stream queue to send to server.
attr_reader :stream_queue
# @return [Relations::ManyToOneRelation] relations between objects.
attr_accessor :relation
# TODO: Do cashing later
# @return [ImmutableHash{String=>SpeckleObjects::Other::RenderMaterial}] converted render materials
attr_accessor :render_materials
# TODO: Do cashing later
# @return [ImmutableHash{String=>SpeckleObjects::Other::BlockDefinition}] converted component definitions
attr_accessor :definitions
def initialize(accounts, observers, queue, stream_queue)
@accounts = accounts
@observers = observers
@message_queue = queue
@stream_queue = stream_queue
@speckle_entities = Immutable::EmptyHash
@mapped_entities = Immutable::EmptyHash
@render_materials = Immutable::EmptyHash
@definitions = Immutable::EmptyHash
@relation = Relations::ManyToOneRelation.new
end
# @param callback_name [String] name of the callback command
# @param stream_id [String] id of the stream
# @param parameters [Array<String>] parameters of the callback method call
def with_add_queue(callback_name, stream_id, parameters)
next_queue_message = Callbacks::CallbackMessage.serialize(callback_name, stream_id, parameters)
new_queue = message_queue.merge({ "#{callback_name}": next_queue_message })
with(:@message_queue => new_queue)
end
def with_mapped_entities_queue(mapped_entities)
new_queue = message_queue.merge({ "mappedEntitiesUpdated":
"mappedEntitiesUpdated(#{JSON.generate(mapped_entities)})" })
with(:@message_queue => new_queue)
end
def with_selection_queue(selection_parameters)
new_queue = message_queue.merge({ "entitySelected":
"entitySelected(#{JSON.generate(selection_parameters)})" })
with(:@message_queue => new_queue)
end
def with_deselection_queue
new_queue = message_queue.merge({ "entitiesDeselected": 'entitiesDeselected()' })
with(:@message_queue => new_queue)
end
def with_invalid_streams_queue
new_queue = message_queue.merge({ "updateInvalidStreams":
"updateInvalidStreams(#{JSON.generate(invalid_streams)})" })
with(:@message_queue => new_queue)
end
def with_empty_invalid_streams_queue
new_queue = message_queue.merge({ "updateInvalidStreams":
"updateInvalidStreams(#{JSON.generate([])})" })
with(:@message_queue => new_queue)
end
def with_accounts(new_accounts)
with(:@accounts => new_accounts)
end
def with_mapped_entity(entity)
new_mapped_entities = mapped_entities.put(entity.persistent_id, entity)
with_mapped_entities(new_mapped_entities)
end
def with_removed_mapped_entity(entity)
new_mapped_entities = mapped_entities.delete(entity.persistent_id)
with_mapped_entities(new_mapped_entities)
end
def with_speckle_entity(traversed_entity)
new_speckle_entities = speckle_entities.put(traversed_entity.application_id, traversed_entity)
with_speckle_entities(new_speckle_entities)
end
def with_speckle_entities(new_speckle_entities)
with(:@speckle_entities => new_speckle_entities)
end
def with_mapped_entities(new_mapped_entities)
with(:@mapped_entities => new_mapped_entities)
end
def with_relation(new_relation)
with(:@relation => new_relation)
end
def invalid_streams
speckle_entities.collect do |_id, speckle_entity|
speckle_entity.invalid_stream_ids
end.reduce([], :concat).uniq
end
end
end
end
-12
View File
@@ -1,12 +0,0 @@
# frozen_string_literal: true
module SpeckleConnector
module Ui
# The abstract class for view to send data to a user interface.
class View
def update_view(_state)
raise NotImplementedError, 'Implement in a subclass'
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,8 @@
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'
require_relative 'src/commands/menu_command_handler'
@@ -12,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
@@ -23,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: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.
@@ -0,0 +1,66 @@
# frozen_string_literal: true
require 'JSON'
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)
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.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,21 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../accounts/accounts'
require_relative '../load_saved_streams'
module SpeckleConnector3
module Actions
# Action to initialize local accounts from database.
class GetAccounts < 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)
puts 'Initialisation of Speckle accounts requested by plugin'
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
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 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
@@ -15,7 +15,7 @@ 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)
state = DeactivateDiffing.update_state(state, {})
state = DeactivateDiffing.update_state(state, nil, {})
puts "Diffing activated for #{@stream_id}"
speckle_entities = state.speckle_state.speckle_entities
invalid_speckle_entities = speckle_entities.select do |_id, entity|
@@ -2,7 +2,7 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Adds material to speckle state and Sketchup.
class AddMaterial < Action
@@ -5,16 +5,20 @@ 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
def initialize(entities_to_map, method, category, name, is_definition)
def initialize(entities_to_map, method, category, family,
family_type, level, name, is_definition)
super()
@entities_to_map = entities_to_map
@method = method
@category = category
@name = name
@family = family
@family_type = family_type
@level = level
@is_definition = is_definition
end
@@ -33,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
@@ -51,6 +55,9 @@ module SpeckleConnector
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.set_attribute(entity, :category, @category)
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.set_attribute(entity, :name, name)
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.set_attribute(entity, :method, @method)
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.set_attribute(entity, :family, @family)
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.set_attribute(entity, :family_type, @family_type)
SketchupModel::Dictionary::SpeckleSchemaDictionaryHandler.set_attribute(entity, :level, @level)
speckle_state = speckle_state.with_mapped_entity(entity)
end
@@ -0,0 +1,28 @@
# frozen_string_literal: true
require_relative 'add_send_model_card'
require_relative 'add_receive_model_card'
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 add send card.
class AddModel < 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)
if data['typeDiscriminator'] == 'SenderModelCard'
Actions::AddSendModelCard.update_state(state, resolve_id, data)
else
Actions::AddReceiveModelCard.update_state(state, resolve_id, data)
end
end
end
end
end
@@ -0,0 +1,52 @@
# 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 add receive model card.
class AddReceiveModelCard < 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)
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, server_url, workspace_id, workspace_slug,
project_id, model_id,
project_name, model_name,
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)
new_speckle_state = state.speckle_state.with_receive_card(receive_card)
state = state.with_speckle_state(new_speckle_state)
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
return state.with_add_queue_js_command('addReceiveCard', js_script)
end
end
end
end
@@ -0,0 +1,48 @@
# 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 '../../settings/card_settings'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector3
module Actions
# Action to add send model card.
class AddSendModelCard < 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)
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
.save_send_card_to_model(send_card, state.sketchup_state.sketchup_model)
new_speckle_state = state.speckle_state.with_send_card(send_card)
state = state.with_speckle_state(new_speckle_state)
# Resolve promise
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('addSendCard', js_script)
end
end
end
end
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require_relative '../action'
module SpeckleConnector3
module Actions
# Get connector version.
class GetConnectorVersion < 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_command = "baseBinding.receiveResponse('#{resolve_id}', '#{CONNECTOR_VERSION}')"
state.with_add_queue_js_command('getConnectorVersion', js_command)
end
end
end
end
@@ -0,0 +1,97 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../filters/send_filters'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector3
module Actions
# Gets document state.
class GetDocumentState < 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)
send_cards_hash = SketchupModel::Dictionary::ModelCardDictionaryHandler
.get_send_cards_from_dict(state.sketchup_state.sketchup_model)
# 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)
state = state.with_speckle_state(new_speckle_state)
{
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
}
end
receive_cards_hash = SketchupModel::Dictionary::ModelCardDictionaryHandler
.get_receive_cards_from_dict(state.sketchup_state.sketchup_model)
# 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['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['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)
state = state.with_speckle_state(new_speckle_state)
{
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,
typeDiscriminator: receive_card.type_discriminator
}
end
model_state = { models: send_cards + receive_cards }
js_script = "baseBinding.receiveResponse('#{resolve_id}', #{model_state.to_json})"
state.with_add_queue_js_command('getDocumentState', js_script)
end
end
end
end
@@ -0,0 +1,19 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../filters/send_filters'
module SpeckleConnector3
module Actions
# Action to get send filter.
class GetSendFilters < 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)
default_filters = Filters::SendFilters.get_default(state.sketchup_state.sketchup_model)
js_script = "sendBinding.receiveResponse('#{resolve_id}', #{default_filters.to_json})"
state.with_add_queue_js_command('getSendFilter', js_script)
end
end
end
end
@@ -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
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require_relative '../action'
module SpeckleConnector3
module Actions
# Get source app name.
class GetSourceAppName < 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_command = "baseBinding.receiveResponse('#{resolve_id}', 'sketchup')"
state.with_add_queue_js_command('getSourceAppName', js_command)
end
end
end
end
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require_relative '../action'
module SpeckleConnector3
module Actions
# Get source app version.
class GetSourceAppVersion < 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_command = "baseBinding.receiveResponse('#{resolve_id}', #{SKETCHUP_VERSION})"
state.with_add_queue_js_command('getSourceAppVersion', js_command)
end
end
end
end
@@ -0,0 +1,31 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../sketchup_model/query/entity'
module SpeckleConnector3
module Actions
# Action to add send card.
class HighlightModel < 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)
receiver_card = state.speckle_state.receive_cards[model_card_id]
sender_card = state.speckle_state.send_cards[model_card_id]
card = receiver_card || sender_card
objects_to_highlight = if card.type_discriminator == 'ReceiverModelCard'
state.speckle_state.receive_cards[model_card_id].baked_object_ids
else
state.speckle_state.send_cards[model_card_id].send_filter.selected_object_ids
end
SketchupModel::Utils::ViewUtils.highlight_entities(state.sketchup_state.sketchup_model, objects_to_highlight)
# Resolve promise
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('highlightModel', js_script)
end
end
end
end
@@ -0,0 +1,20 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../sketchup_model/query/entity'
require_relative '../../sketchup_model/utils/view_utils'
module SpeckleConnector3
module Actions
# Action to add send card.
class HighlightObjects < Action
def self.update_state(state, resolve_id, object_ids)
SketchupModel::Utils::ViewUtils.highlight_entities(state.sketchup_state.sketchup_model, object_ids)
# Resolve promise
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('highlightObjects', js_script)
end
end
end
end
@@ -0,0 +1,31 @@
# 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 send card.
class RemoveModel < 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)
SketchupModel::Dictionary::ModelCardDictionaryHandler.remove_card_dict(state.sketchup_state.sketchup_model, data)
new_speckle_state = if data['typeDiscriminator'] == 'ReceiverModelCard'
state.speckle_state.without_receive_card(data['id'])
else
state.speckle_state.without_send_card(data['id'])
end
state = state.with_speckle_state(new_speckle_state)
# Resolve promise
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('removeModel', js_script)
end
end
end
end
@@ -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
@@ -0,0 +1,20 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
module SpeckleConnector3
module Actions
# Action to update send filter.
class UpdateSendFilter < 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, value)
SketchupModel::Dictionary::ModelCardDictionaryHandler.update_filter(state.sketchup_state.sketchup_model, data, value)
js_script = "sendBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('updateSendFilter', js_script)
end
end
end
end
@@ -0,0 +1,31 @@
# frozen_string_literal: true
require_relative 'action'
require_relative '../sketchup_model/dictionary/speckle_entity_dictionary_handler'
module SpeckleConnector3
module Actions
# Clear mapper source.
class ClearMapperSource < 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)
new_speckle_state = state.speckle_state.with_removed_mapper_source
erase_levels(state)
state.with_speckle_state(new_speckle_state)
end
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
def self.erase_levels(state)
levels = state.sketchup_state.sketchup_model.definitions.select do |definition|
SketchupModel::Dictionary::SpeckleEntityDictionaryHandler.get_attribute(definition, :speckle_type) ==
OBJECTS_BUILTELEMENTS_REVIT_LEVEL
end
levels.each do |level|
level.entities.clear!
level.instances.each(&:erase!)
end
end
end
end
end
@@ -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,13 +5,13 @@ 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
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, data)
def self.update_state(state, _resolve_id, data)
# Flat entities to clear mappings
flat_entities = SketchupModel::Query::Entity.flat_entities(state.sketchup_state.sketchup_model.entities)
@@ -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,13 +4,13 @@ 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
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, _data)
def self.update_state(state, _resolve_id, _data)
state.with_add_queue('collectPreferences', state.user_state.preferences.to_json, [])
end
end
@@ -2,16 +2,16 @@
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
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
# @return [States::State] the new updated state object
def self.update_state(state, _data)
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
@@ -0,0 +1,22 @@
# frozen_string_literal: true
require_relative '../action'
module SpeckleConnector3
module Actions
# Action to get config.
class GetConfig < 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)
# Previously it was stored in user state
# config = state.user_state.preferences.to_json
config = {
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)
end
end
end
end
@@ -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
@@ -0,0 +1,26 @@
# frozen_string_literal: true
require_relative '../action'
require_relative '../user_preferences_updated'
module SpeckleConnector3
module Actions
# Action to update config.
class UpdateConfig < Action
KEY_VALUES = {
'darkTheme' => 'dark_theme'
}.freeze
# @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, config)
config.each do |key, value|
state = Actions::UserPreferencesUpdated.new('Sketchup', KEY_VALUES[key], value).update_state(state)
end
js_script = "configBinding.receiveResponse('#{resolve_id}')"
state.with_add_queue_js_command('updateConfig', js_script)
end
end
end
end
@@ -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,13 +2,13 @@
require_relative 'action'
module SpeckleConnector
module SpeckleConnector3
module Actions
# Deactivate diffing.
class DeactivateDiffing < 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, _data)
def self.update_state(state, _resolve_id, _data)
puts 'Diffing deactivated!'
speckle_entities = state.speckle_state.speckle_entities
diffing_activated_speckle_entities = speckle_entities.reject do |_id, entity|
@@ -1,10 +1,11 @@
# frozen_string_literal: true
require_relative 'event_action'
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}.
@@ -25,7 +26,8 @@ module SpeckleConnector
# Action to let UI to render itself with new preferences state
# TODO: Later UI should be updated if any stream is invalid after
# we collected speckle_entities appropriately
CollectPreferences.update_state(new_state, {})
new_state = CollectPreferences.update_state(new_state, nil, {})
OnDocumentChanged.update_state(new_state)
end
end
@@ -0,0 +1,161 @@
# frozen_string_literal: true
require_relative 'event_action'
require_relative '../../actions/send_actions/send_card_expiration_check'
require_relative '../../sketchup_model/utils/face_utils'
require_relative '../../constants/dict_constants'
require_relative '../../sketchup_model/query/path'
module SpeckleConnector3
module Actions
module Events
# Event actions related to entities.
class EntitiesEventAction < EventAction
PATH = SketchupModel::Query::Path
# Event action when element added.
class OnElementAdded
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, event_data)
modified_entities = event_data.to_a.collect { |e| e[1] }
# do not copy speckle base object specific attributes, because they are entity specific
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).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).collect(&:to_s)
wrapped_entity_ids = wrapped_entity_ids(modified_entities)
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])
state
end
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).collect(&:to_s)
end
wrapped_entity_ids
end
# It is needed for attaching EntityObserver to newly added edges to track them with a hacky way.
# This hacky way is because of limitation on Sketchup API that observer cannot catch changes on Edges
# with EntitiesObserver.
def self.attach_edge_entity_observer(edges, observer)
edges.each do |edge|
edge.add_observer(observer)
edge.start.add_observer(observer)
edge.end.add_observer(observer)
end
end
end
# Event action when element modified.
class OnElementModified
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, event_data)
modified_entities = event_data.collect { |data| data[1] }.to_a
definition_faces = get_definition_faces(modified_entities)
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).collect(&:to_s)
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).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
# diffing = state.user_state.preferences[:user][:diffing]
# new_speckle_state = new_speckle_state.with_invalid_streams_queue if diffing
# return state.with_speckle_state(new_speckle_state)
# end
state
end
def self.get_near_faces(modified_entities)
near_faces = []
modified_entities.each do |modified_entity|
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
def self.get_definition_faces(modified_entities)
definition_faces = []
modified_entities.each do |modified_entity|
next unless modified_entity.is_a?(Sketchup::Face)
next unless modified_entity.parent.is_a?(Sketchup::ComponentDefinition)
definition_faces += modified_entity.parent.entities.grep(Sketchup::Face)
end
definition_faces
end
# @param speckle_state [States::SpeckleState] the current state of the Speckle
def self.speckle_entities_to_invalidate(speckle_state, ids)
speckle_state.speckle_entities.to_h.select { |id, _| ids.include?(id) }
end
# @param speckle_state [States::SpeckleState] the current state of the Speckle
def self.invalidate_speckle_entities(speckle_state, entities_to_invalidate)
speckle_entities = speckle_state.speckle_entities
entities_to_invalidate.each do |id, speckle_entity|
edited_speckle_entity = speckle_entity.with_invalid
speckle_entities = speckle_entities.put(id, edited_speckle_entity)
end
speckle_state.with_speckle_entities(speckle_entities)
end
end
# Event action when element removed.
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.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)
end
end
# @param state [States::State] the current state of the SpeckleConnector Application
# @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
# Handlers that are used to handle specific events
ACTIONS = {
onElementRemoved: OnElementRemoved,
onElementAdded: OnElementAdded,
onElementModified: OnElementModified
}.freeze
def self.actions
ACTIONS
end
end
end
end
end
@@ -0,0 +1,51 @@
# frozen_string_literal: true
require_relative 'event_action'
require_relative '../../constants/dict_constants'
require_relative '../../sketchup_model/query/path'
module SpeckleConnector3
module Actions
module Events
PATH = SketchupModel::Query::Path
# Event actions related to entities.
class EntityEventAction < EventAction
# Event action when entity modified/changed.
# PS: this handler action only triggers for edges and it's vertices since we attach EntityObserver to
# only edge and vertex entities. This is a limitation of the Sketchup API that can't handles edges with
# EntitiesObserver.
class OnChangeEntity
# @param state [States::State] the current state of the SpeckleConnector Application
def self.update_state(state, event_data)
edges = []
event_data.each do |event_d|
event_d.each do |d|
next if d.deleted?
edges.append(d) if d.is_a?(Sketchup::Edge)
edges += d.edges if d.is_a?(Sketchup::Vertex) && d.edges
end
end
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).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
end
# Handlers that are used to handle specific events
ACTIONS = {
onChangeEntity: OnChangeEntity
}.freeze
def self.actions
ACTIONS
end
end
end
end
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}.
@@ -18,12 +18,22 @@ module SpeckleConnector
sketchup_state = state.sketchup_state
active_path = sketchup_state.sketchup_model.active_path
observers = state.speckle_state.observers
update_object_observers(active_path, observers)
update_entity_observers(active_path, observers)
return state
end
def self.update_object_observers(path, observers)
path[-1].definition.entities.add_observer(observers[ENTITIES_OBSERVER]) unless path.nil?
def self.update_entity_observers(path, observers)
unless path.nil?
new_path_entities = path[-1].definition.entities
new_path_entities.add_observer(observers[ENTITIES_OBSERVER])
# 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])
edge.end.add_observer(observers[ENTITY_OBSERVER])
end
end
end
end
@@ -0,0 +1,15 @@
# frozen_string_literal: true
module SpeckleConnector3
module Actions
# Triggers whenever document has changed.
class OnDocumentChanged < 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)
js_command = "baseBinding.emit('documentChanged')"
state.with_add_queue_js_command('documentChanged', js_command)
end
end
end
end
@@ -0,0 +1,37 @@
# frozen_string_literal: true
require_relative 'event_action'
require_relative '../mapper_selection_changed'
require_relative '../selection_actions/get_selection'
require_relative '../../mapper/category/revit_category'
require_relative '../../sketchup_model/reader/speckle_entities_reader'
require_relative '../../sketchup_model/reader/mapper_reader'
require_relative '../../sketchup_model/query/entity'
module SpeckleConnector3
module Actions
module Events
# Update selected speckle objects when the selection changes for mapper tool.
class SelectionEventAction < EventAction
# @param state [States::State] the current state of Speckle application.
# @return [States::State] the new updated state object
def self.update_state(state, event_data)
return state unless event_data&.any?
# 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).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})"
state.with_add_queue_js_command('setSelection', js_script)
# Collect and return mapper selection info.
# Later we can add more selection info for different scopes.
# MapperSelectionChanged.new(sketchup_selection).update_state(state)
end
end
end
end
end

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