architwin 1.18.5 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2164 -185
- package/bundle/sdk.d.ts +2 -0
- package/lib/architwin.d.ts +6 -1
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/card.js +16 -13
- package/lib/atwinui/components/toolbar/generalSettingsMenuPane.js +14 -0
- package/lib/atwinui/components/toolbar/i18n.js +15 -1
- package/lib/atwinui/components/toolbar/index.d.ts +2 -2
- package/lib/atwinui/components/toolbar/index.js +2 -2
- package/lib/atwinui/components/toolbar/tagFormPane.d.ts +3 -0
- package/lib/atwinui/components/toolbar/tagFormPane.js +122 -96
- package/lib/atwinui/components/toolbar/tagListPane.js +7 -11
- package/lib/atwinui/events.js +65 -4
- package/lib/graphql.d.ts +8 -0
- package/lib/graphql.js +60 -0
- package/lib/tag.d.ts +6 -1
- package/lib/tag.js +10 -1
- package/lib/types.d.ts +41 -1
- package/lib/types.js +2 -0
- package/package.json +1 -1
- package/static/utility.css +3 -0
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
ArchiTwin Library
|
|
1
|
+
# ArchiTwin Library
|
|
3
2
|
|
|
4
3
|
## Table of Contents
|
|
5
4
|
---------------------
|
|
@@ -35,10 +34,10 @@ ArchiTwin Library
|
|
|
35
34
|
- [Hiding expand/dock buttons of Media Screens](#hiding-expanddock-buttons-of-media-screens)
|
|
36
35
|
- [Setting Video Playback in the Space](#setting-video-playback-in-the-space)
|
|
37
36
|
- [Setting Animation Control in the Space](#setting-animation-control-in-the-space)
|
|
38
|
-
- [Copying
|
|
37
|
+
- [Copying an Object to Your Space](#copying-object-to-your-space)
|
|
39
38
|
- [Navigate to Object](#navigate-to-object)
|
|
40
|
-
- [Deleting Object
|
|
41
|
-
- [Replacing Object
|
|
39
|
+
- [Deleting an Object from Your Space](#deleting-object-to-your-space)
|
|
40
|
+
- [Replacing an Object in Your Space](#replacing-object-to-your-space)
|
|
42
41
|
- [Creating Text Markup Screen in the space](#creating-text-markup-screen-in-the-space)
|
|
43
42
|
- [Setting Content to Text Markup Screen](#setting-content-to-text-markup-screen)
|
|
44
43
|
- [Typescript Interface Reference](#typescript-interface-reference)
|
|
@@ -62,7 +61,7 @@ ArchiTwin Library
|
|
|
62
61
|
- [Enable Meeting Sidebar](#enable-meeting-sidebar)
|
|
63
62
|
- [Create Meeting](#create-meeting)
|
|
64
63
|
- [Pre-Meeting Setup](#pre-meeting-setup)
|
|
65
|
-
- [Join Meeting](#
|
|
64
|
+
- [Join Meeting](#join-meeting)
|
|
66
65
|
- [In-Meeting](#in-meeting)
|
|
67
66
|
- [Function Reference](#function-reference)
|
|
68
67
|
- [Space](#space)
|
|
@@ -183,6 +182,96 @@ ArchiTwin Library
|
|
|
183
182
|
- [Viewpoint](#viewpoint)
|
|
184
183
|
- [renderViewpointMarker()](#renderViewpointMarker)
|
|
185
184
|
- [toggleViewpointVisibility()](#toggleViewpointVisibility)
|
|
185
|
+
- [Draw Polygon and Path Methods](#draw-polygon-and-path-methods)
|
|
186
|
+
<!-- - [drawPath()](#drawpath) -->
|
|
187
|
+
- [toggleSpaceNavigation()](#togglespacenavigation)
|
|
188
|
+
- [startDraw()](#startdraw)
|
|
189
|
+
- [exitDraw()](#exitdraw)
|
|
190
|
+
- [cancelDraw()](#canceldraw)
|
|
191
|
+
- [setPolygonPath()](#setpolygonpath)
|
|
192
|
+
- [setPolygonDrawingMode()](#setpolygondrawingmode)
|
|
193
|
+
- [setPathLine()](#setpathline)
|
|
194
|
+
- [setPathLineOptions()](#setpathlineoptions)
|
|
195
|
+
- [getCurrentTubeLine()](#getcurrenttubeline)
|
|
196
|
+
- [renderPolygon()](#renderpolygon)
|
|
197
|
+
- [toggleWallVisibility()](#togglewallvisibility)
|
|
198
|
+
- [toggleMeshChildrenVisibility()](#togglemeshchildrenvisibility)
|
|
199
|
+
- [toggleFloorVisibility()](#togglefloorvisibility)
|
|
200
|
+
- [getChildrenOfModel()](#getchildrenofmodel)
|
|
201
|
+
- [toggleVerticeRingVisibility()](#toggleverticeringvisibility)
|
|
202
|
+
- [setPolygonFloorOffset()](#setpolygonflooroffset)
|
|
203
|
+
- [getPolygonFloorOffset()](#getpolygonflooroffset)
|
|
204
|
+
- [setFloorBaseHeight()](#setfloorbaseheight)
|
|
205
|
+
- [clearFloorBaseHeight()](#clearfloorbaseheight)
|
|
206
|
+
- [enableVerticeControls()](#enableverticecontrols)
|
|
207
|
+
<!-- - [deleteEdge()](#deleteedge) -->
|
|
208
|
+
- [disposePathLine()](#disposepathline)
|
|
209
|
+
- [getFloorBaseHeight()](#getfloorbaseheight)
|
|
210
|
+
- [setMeshChildrenMaterialProperty()](#setmeshchildrenmaterialproperty)
|
|
211
|
+
- [undoDrawAction()](#undodrawaction)
|
|
212
|
+
- [redoDrawAction()](#redodrawaction)
|
|
213
|
+
- [setWallBaseHeight()](#setwallbaseheight)
|
|
214
|
+
- [getWallBaseHeight()](#getwallbaseheight)
|
|
215
|
+
- [clearWallBaseHeight()](#clearwallbaseheight)
|
|
216
|
+
- [getVertexPath()](#getvertexpath)
|
|
217
|
+
- [renderPath()](#renderpath)
|
|
218
|
+
- [setDrawingConfig()](#setdrawingconfig)
|
|
219
|
+
- [getDrawingConfig()](#getdrawingconfig)
|
|
220
|
+
- [resetDrawingConfig()](#resetdrawingconfig)
|
|
221
|
+
- [setPointerEnabled()](#setpointerenabled)
|
|
222
|
+
- [removeScreenShareSessionData()](#removescreensharesessiondata)
|
|
223
|
+
- [setVertexPath()](#setvertexpath)
|
|
224
|
+
- [clearTagVisibilityStorage()](#cleartagvisibilitystorage)
|
|
225
|
+
- [clearActivePane()](#clearactivepane)
|
|
226
|
+
- [Space Partition](#space-partition)
|
|
227
|
+
<!-- - [setSpacePartitionNodes()](#setspacepartitionnodes) -->
|
|
228
|
+
- [setCurrentPolygon()](#setcurrentpolygon)
|
|
229
|
+
- [Others](#others)
|
|
230
|
+
- [getSpaceId()](#getspaceid)
|
|
231
|
+
- [getCurrentPolygon()](#getcurrentpolygon)
|
|
232
|
+
- [getPathBetweenSweeps()](#getpathbetweensweeps)
|
|
233
|
+
- [moveAlongPath()](#movealongpath)
|
|
234
|
+
<!-- - [convertZupToYup()](#convertzuptoyup)
|
|
235
|
+
[convertYupToZup()](#convertyuptozup) -->
|
|
236
|
+
- [getRelativePosition()](#getrelativeposition)
|
|
237
|
+
- [getOriginalWorldPosition()](#getoriginalworldposition)
|
|
238
|
+
- [setSpaceMetadata()](#setspacemetadata)
|
|
239
|
+
- [getSpaceMetadata()](#getspacemetadata)
|
|
240
|
+
- [getAssetUrl()](#getasseturl)
|
|
241
|
+
<!-- - [IoT (Internet of Things)](#iot-internet-of-things)
|
|
242
|
+
- [setIotCategoryTypes()](#setiotcategorytypes)
|
|
243
|
+
- [setIotDeviceTypes()](#setiotdevicetypes)
|
|
244
|
+
- [setIoTDeviceTagIcons()](#setiotdevicetagicons)
|
|
245
|
+
- [getIoTDeviceTagIcons()](#getiotdevicetagicons)
|
|
246
|
+
- [setIoTLinkedSystemOptions()](#setiotlinkedsystemoptions) -->
|
|
247
|
+
- [Space Screen Share](#space-screen-share)
|
|
248
|
+
- [setScreenSharingHostUser()](#setscreensharinghostuser)
|
|
249
|
+
- [setScreenSharingParticipantUsers()](#setscreensharingparticipantusers)
|
|
250
|
+
- [renderCursorMarkerPointer()](#rendercursormarkerpointer)
|
|
251
|
+
- [updatePointerTexture()](#updatepointertexture)
|
|
252
|
+
- [toggleElementVisibility()](#toggleelementvisibility)
|
|
253
|
+
<!-- - [setPipeCategories()](#setpipecategories)
|
|
254
|
+
- [setSelectedPipeCategory()](#setselectedpipecategory)
|
|
255
|
+
- [getSelectedPipeCategory()](#getselectedpipecategory)
|
|
256
|
+
- [setPipes()](#setpipes)
|
|
257
|
+
- [setSelectedPipe()](#setselectedpipe)
|
|
258
|
+
- [getSelectedPipe()](#getselectedpipe)
|
|
259
|
+
- [deleteVertex()](#deletevertex)
|
|
260
|
+
- [setPipeIsDrawingMode()](#setpipeisdrawingmode)
|
|
261
|
+
- [getPipeIsDrawingMode()](#getpipeisdrawingmode)
|
|
262
|
+
- [undoPipePath()](#undopipepath)
|
|
263
|
+
- [redoPipePath()](#redopipepath) -->
|
|
264
|
+
<!-- - [Preview Modal](#preview-modal)
|
|
265
|
+
- [renderPreviewModal()](#renderpreviewmodal)
|
|
266
|
+
- [togglePreviewModal()](#togglepreviewmodal)
|
|
267
|
+
- [closePreviewModal()](#closepreviewmodal)
|
|
268
|
+
- [setPreviewModalAction()](#setpreviewmodalaction)
|
|
269
|
+
- [getIsPolygonVisible()](#getispolygonvisible)
|
|
270
|
+
- [appendNotionUrlTagDescription()](#appendnotionurltagdescription) -->
|
|
271
|
+
- [Copy Object](#copy-object)
|
|
272
|
+
- [clearLastCopiedObjectPosition()](#clearlastcopiedobjectposition)
|
|
273
|
+
|
|
274
|
+
|
|
186
275
|
## Installation
|
|
187
276
|
### Install Using NPM
|
|
188
277
|
To install the latest ArchiTwin package:
|
|
@@ -196,10 +285,11 @@ npm i architwin
|
|
|
196
285
|
|
|
197
286
|
Before you start coding your architwin powered app, there are a few things you need to have ready to ensure that you are able to run the app properly without interruptions. For a seamless development experience, make sure to have the following ready:
|
|
198
287
|
|
|
199
|
-
- **appKey:** your appKey is used to authenticate your connection when loading the 3D
|
|
200
|
-
- **
|
|
201
|
-
- **
|
|
202
|
-
- **
|
|
288
|
+
- **appKey:** your appKey is used to authenticate your connection to Matterport when loading the 3D space. For security purposes, the appKey can only be used by a domain (e.g. awesomesite.com) it is associated with. This key is important especially when you launch your app in production and utilize your own site domain. Go to your Matterport dashboard to get your app key and make sure to whitelist your app domain that you will use this key with.
|
|
289
|
+
- **Matterport Bundle SDK:** You must have a copy of Matterport's Bundle SDK and serve it under your applications public directory or the equivalent directory your chosen framework recommends you to place public assets. As of the time of this writing, the library has been tested to work with version 25.10.1 of the bundle SDK. We recommend using this version for your app or use the latest version of the bundle SDK. You can get the latest version of the bundle SDK from matterport by [clicking here](https://matterport.github.io/showcase-sdk/sdkbundle_home.html)
|
|
290
|
+
<!-- - **apiKey:** not to be confused with the appKey, the apiKey is used to authenticate all API requests sent to our servers including user authentication and fetching object data connected to a showcase. Please contact us to request your apiKey -->
|
|
291
|
+
<!-- - **apiURL:** an optional key in the [auth object](#connection-parameters) which if set, will point all internal API calls to the api endpoint or base URL you assign. If this is not set, all api calls will be directed to the proxy address set in the `vite.config.ts` file during **local development**. Example: `apiURL: "apps.awesomesite.com/api"` will resolve internally to `apps.awesomesite.com/api/cas/tickets?someparams` or `apps.awesomesite.com/api/v1/showcase/id/1`. It is important to add `/api` to the base url of your custom apiURL to ensure the api requests are properly sent. There is no need to add a forward slash at the end of our custom apiURL. Please take note that you *may* have to setup a proxy server to bypass CORS issues when you deploy your application on your production servers -->
|
|
292
|
+
<!-- - **Username and password:** User credentials used to authenticate the user. Please contact us to request your username and password -->
|
|
203
293
|
|
|
204
294
|
#### Define an iFrame as target for the Showcase
|
|
205
295
|
|
|
@@ -228,20 +318,15 @@ import { onMounted, ref } from 'vue';
|
|
|
228
318
|
|
|
229
319
|
const mpIframe = ref<HTMLIFrameElement>()
|
|
230
320
|
|
|
231
|
-
// replace with your api key and user
|
|
232
|
-
const apiKey = "YOUR-API-KEY"
|
|
233
|
-
const authUser = {
|
|
234
|
-
email: "su@email.com",
|
|
235
|
-
password: "su123"
|
|
236
|
-
} as IUser
|
|
237
|
-
|
|
238
321
|
....
|
|
239
322
|
</script>
|
|
240
323
|
````
|
|
241
324
|
|
|
242
325
|
#### Setup your proxy
|
|
243
326
|
|
|
244
|
-
|
|
327
|
+
This section may not apply to you depending on your setup and use case. You may proceed to the next section if so.
|
|
328
|
+
|
|
329
|
+
In your `vite.config.ts`, add the following block of code. This will allow your app in your development environment to send API request to our servers and circumvent CORS issues. If you are not using vite as your build tool, please refer on the official documentation of your build tool of choice on how to setup the proxy.
|
|
245
330
|
|
|
246
331
|
You may have to change the VITE_PROXY value if you intend to direct your api requests on another server during development.
|
|
247
332
|
|
|
@@ -312,49 +397,32 @@ export default defineConfig(({ command, mode }) => {
|
|
|
312
397
|
|
|
313
398
|
#### Connect to a Space
|
|
314
399
|
|
|
315
|
-
In order to connect to space you may use [connectSpace()](#connectspace) method.
|
|
400
|
+
In order to connect to a space, you may use [connectSpace()](#connectspace) method.
|
|
316
401
|
````typescript
|
|
317
402
|
<script lang="ts">
|
|
318
403
|
|
|
319
|
-
...
|
|
320
404
|
onMounted( async() => {
|
|
321
405
|
|
|
322
|
-
//
|
|
323
|
-
const spaceUrl = "https://
|
|
324
|
-
|
|
325
|
-
// space url can also be a matterport url
|
|
326
|
-
// ex: const spaceUrl = "https://my.matterport.com/show/?m=qSGGhhjTYbN";
|
|
327
|
-
|
|
328
|
-
const auth = {
|
|
329
|
-
apiURL: 'YOUR-API-URL'
|
|
330
|
-
apiKey: apiKey,
|
|
331
|
-
user: authUser
|
|
332
|
-
}
|
|
406
|
+
//matterport url
|
|
407
|
+
const spaceUrl = "https://my.matterport.com/show/?m=<space-id>";
|
|
333
408
|
|
|
334
409
|
const config: IMPConfig = {
|
|
335
410
|
iframeId: 'mp-showcase',
|
|
336
|
-
bundlePath: "path/to/bundle/",
|
|
411
|
+
bundlePath: "path/to/bundle/",
|
|
337
412
|
appKey: 'YOUR-APP-KEY'
|
|
338
413
|
play: 1,
|
|
339
414
|
}
|
|
340
415
|
|
|
341
|
-
// more config options as
|
|
342
|
-
await atwin.connectSpace(spaceUrl,
|
|
343
|
-
|
|
344
|
-
// after connected to space, the following objects should be available
|
|
345
|
-
// tags - an array of tag objects found in the space
|
|
346
|
-
// sweeps - an array of sweep objects found in the space
|
|
347
|
-
...
|
|
416
|
+
// more config options as explained later
|
|
417
|
+
await atwin.connectSpace(spaceUrl, null, config)
|
|
348
418
|
|
|
349
419
|
})
|
|
350
420
|
|
|
351
421
|
</script>
|
|
352
422
|
````
|
|
353
|
-
Once connected, the interactive Space will be rendered in the target iFrame.
|
|
354
|
-
A Space generally contains Tags, 3D objects, Video Screens , Slideshow Screens and Sweeps.
|
|
355
|
-
You should be able to move around the Space using keyboard and mouse.
|
|
423
|
+
Once connected, the interactive Space will be rendered in the target iFrame. A Space generally contains Tags, 3D objects, and Sweeps, and via the custom loaders the library provides, may also render videos, slideshows, etc.
|
|
356
424
|
|
|
357
|
-
|
|
425
|
+
You can navigate the Space using a keyboard and mouse, or programmatically using the methods defined in this library.
|
|
358
426
|
|
|
359
427
|
## Executing methods on specific App Phases
|
|
360
428
|
|
|
@@ -368,11 +436,11 @@ Your application may need to execute certain methods during the initialization o
|
|
|
368
436
|
- **STARTING:** Matterport begins the transition to the start location
|
|
369
437
|
- **PLAYING** The 3D space is now ready for user interaction
|
|
370
438
|
|
|
371
|
-
You can also view the technical diagram of how this
|
|
439
|
+
You can also view the technical diagram of how this works below:
|
|
372
440
|
|
|
373
|
-
<img src="https://
|
|
441
|
+
<img src="https://i.ibb.co/Z1pK04X5/Architwin-Library-Phases-Diagram.png" width="400" height="300" />
|
|
374
442
|
|
|
375
|
-
To invoke a function from your application during one of the phases
|
|
443
|
+
To invoke a function from your application during one of the phases, simply pass the function name as a parameter in the `connectSpace()` method. Make sure to not add a parenthesis to your function name when you pass it as a parameter to avoid invoking the function prematurely.
|
|
376
444
|
|
|
377
445
|
*Example:*
|
|
378
446
|
|
|
@@ -430,7 +498,7 @@ Vue is the framework we use in the code snippets provided above. If your team in
|
|
|
430
498
|
appKey: 'YOUR-APP-KEY'
|
|
431
499
|
} as IMPConfig
|
|
432
500
|
|
|
433
|
-
// more config options as
|
|
501
|
+
// more config options as explained later
|
|
434
502
|
await atwin.connectSpace(spaceUrl, auth, config)
|
|
435
503
|
})
|
|
436
504
|
</script>
|
|
@@ -550,22 +618,20 @@ await atwin.connectSpace(url, auth, config)
|
|
|
550
618
|
|
|
551
619
|
A user should be able to navigate around using PC or devices (keyboard and mouse), measure real object dimensions and interact with the virtual objects as if you are actually visiting the physical space.
|
|
552
620
|
|
|
553
|
-
**Sweeps** -
|
|
621
|
+
**Sweeps** - Spaces have static sweep markers (white circles on the floor) which serve as primary navigation points. Users can go to sweeps (or click), stand, and look around.
|
|
554
622
|
|
|
555
|
-
**Tags** -
|
|
556
|
-
web pages, videos, images or text descriptions. It is possible to go directly to any specifig tag ([gotoTag](#gototag)) from anywhere in Space.
|
|
623
|
+
**Tags** - Spaces also have tags, which are virtual markers attached to objects or locations in the space. Tags can be clicked to render and display relevant content such as web pages, videos, images, or text descriptions. It is possible to go directly to any specific tag ([gotoTag](#gototag)) from anywhere in the Space.
|
|
557
624
|
|
|
558
|
-
|
|
625
|
+
They can be used as a quick way to navigate around the space.
|
|
559
626
|
|
|
560
|
-
**3D Objects** -
|
|
627
|
+
**3D Objects** - Spaces usually contain 3D objects or three-dimensional models. Some 3D objects may have simple animations.
|
|
561
628
|
|
|
562
|
-
**Video Screens** - Another interesting
|
|
563
|
-
screens placed at selected locations. The Video screens will automatically play when a User is nearby (2 meters). And automatically turns off when the User leaves.
|
|
629
|
+
**Video Screens** - Another interesting type of object that can be found inside the space is Video Screens. They practically look like TV screens placed at selected locations. Video screens automatically play when a user is nearby (within 2 meters) and automatically turn off when the user moves away.
|
|
564
630
|
|
|
565
631
|
|
|
566
632
|
**Slideshow Screens** - Space can also contain Image Slideshow Screens. This is similar to the Video Screen, but uses static images.
|
|
567
633
|
Clicking on the right section of the current slide image will display the next slide.
|
|
568
|
-
Clicking on the
|
|
634
|
+
Clicking on the left section will display the previous slide.
|
|
569
635
|
|
|
570
636
|
The slideshow can be auto played in whole by clicking the lower-right corner.
|
|
571
637
|
|
|
@@ -584,7 +650,7 @@ The method accepts the following as its parameters:
|
|
|
584
650
|
| callback | Function or Array of Functions | yes | none | function or async function |
|
|
585
651
|
|
|
586
652
|
### Subscribing a method to an event
|
|
587
|
-
To subscribe to an event,
|
|
653
|
+
To subscribe to an event, simply call the `subscribeSpaceEvent()` and pass the event you want to subscribe to and the method you want to trigger. Subscribing to an event will also return to you the data of an object if you are interacting with one. Said object data will implement the `IShowcaseObject` interface.
|
|
588
654
|
|
|
589
655
|
*Example:*
|
|
590
656
|
```typescript
|
|
@@ -658,7 +724,7 @@ You can subscribe your method to more than one event. Currently, we support subs
|
|
|
658
724
|
For more information regarding the loading,starting, and playing phase events. Please refer to [this section](#executing-methods-on-specific-app-phases)
|
|
659
725
|
|
|
660
726
|
### Subscribing multiple methods to an event
|
|
661
|
-
If you wish to subscribe multiple methods to an event
|
|
727
|
+
If you wish to subscribe multiple methods to an event, you can use the following methods listed below.
|
|
662
728
|
|
|
663
729
|
**Method 1:**
|
|
664
730
|
Subscribing each method one at a time
|
|
@@ -713,10 +779,10 @@ const functionArray = [myFunction,myFunction2]
|
|
|
713
779
|
atwin.subscribeSpaceEvent('DRAG_END',functionArray)
|
|
714
780
|
```
|
|
715
781
|
|
|
716
|
-
Keep in mind that the library's event system utilizes
|
|
782
|
+
Keep in mind that the library's event system utilizes a FIFO algorithm. Your functions will always be executed in chronological order, meaning functions that were subscribed first will be executed first.
|
|
717
783
|
|
|
718
784
|
### Unsubscribing a method from an event
|
|
719
|
-
If you wish to unsubscribe your method from a subscribed event, simply call the `unsubscribeSpaceEvent()` method to so. The method accepts the following parameters:
|
|
785
|
+
If you wish to unsubscribe your method from a subscribed event, simply call the `unsubscribeSpaceEvent()` method to do so. The method accepts the following parameters:
|
|
720
786
|
|
|
721
787
|
The method accepts the following as its parameters:
|
|
722
788
|
| parameter | type | required | default | values |
|
|
@@ -741,13 +807,13 @@ const functionArray = [myFunction,myFunction2]
|
|
|
741
807
|
atwin.unsubscribeSpaceEvent('DRAG_END',functionArray)
|
|
742
808
|
```
|
|
743
809
|
|
|
744
|
-
|
|
810
|
+
## Creating Custom Events
|
|
745
811
|
The library has a list of default event types you can subscribe to but you may at times need to create your own event type to use for a specific task. You can easily create and subscribe to your own custom event by using `registerCustomSpaceEvent()` and `subscribeSpaceEvent()` respectively. Here is how to do it.
|
|
746
812
|
|
|
747
813
|
**IMPORTANT:** Your custom event type name must **not** be the same as an existing custom event type or a default event type. Doing so will return an error and the registration will fail.
|
|
748
814
|
|
|
749
815
|
**STEP 1:**
|
|
750
|
-
Register your event type name. As a convention, the name of your event type should be in uppercase and use snake_case (e.g. FOO_BAR). It is important to register
|
|
816
|
+
Register your event type name. As a convention, the name of your event type should be in uppercase and use snake_case (e.g. FOO_BAR). It is important to register your custom event type first before subscribing a method to it. You can register one or multiple events using the method.
|
|
751
817
|
|
|
752
818
|
```typescript
|
|
753
819
|
//Register one custom event type
|
|
@@ -788,15 +854,15 @@ atwin.dispatchSpaceEvent('MY_EVENT',someData)
|
|
|
788
854
|
|
|
789
855
|
## Points of Interest
|
|
790
856
|
|
|
791
|
-
Tags are primarily
|
|
857
|
+
Tags are primarily used to mark locations or objects in space for quick and direct navigation.
|
|
792
858
|
Tags usually contain additional content that will be rendered when hovered. Contents can be web pages,
|
|
793
859
|
text descriptions, videos, or images.
|
|
794
860
|
|
|
795
861
|
You may use the [getTags()](#gettags) method in order to get a list of Tags found in the space.
|
|
796
862
|
|
|
797
|
-
You may use the [goToTag()](#gototag) method in order to navigate to specific Tag
|
|
863
|
+
You may use the [goToTag()](#gototag) method in order to navigate to a specific Tag
|
|
798
864
|
|
|
799
|
-
You may use the [getSweeps()](#getsweeps) method in order get a list of Sweeps found in the Space.
|
|
865
|
+
You may use the [getSweeps()](#getsweeps) method in order to get a list of Sweeps found in the Space.
|
|
800
866
|
|
|
801
867
|
You may use the [moveToSweep()](#movetosweep) method in order to move to a specific Sweep
|
|
802
868
|
|
|
@@ -809,7 +875,7 @@ import * as atwin from 'architwin';
|
|
|
809
875
|
|
|
810
876
|
...
|
|
811
877
|
|
|
812
|
-
const spaceUrl = "https://
|
|
878
|
+
const spaceUrl = "https://my.matterport.com/space/m?=<space-id>"
|
|
813
879
|
|
|
814
880
|
const ispace = {
|
|
815
881
|
id: 1;
|
|
@@ -954,7 +1020,7 @@ You can enable a minimap display of your 3D space by setting the following key-v
|
|
|
954
1020
|
} as IMPConfig;
|
|
955
1021
|
```
|
|
956
1022
|
|
|
957
|
-
To ensure that you will not encounter any errors. Make sure to follow the prescribed markup structure under the [defining an iFrame section](#define-an-iframe-as-target-for-the-showcase). All CSS classes or ids used internally by the library will have an `at_` prefix for classes and an `at-` for ids. The classes and ids are named this way to avoid any naming conflicts with your
|
|
1023
|
+
To ensure that you will not encounter any errors. Make sure to follow the prescribed markup structure under the [defining an iFrame section](#define-an-iframe-as-target-for-the-showcase). All CSS classes or ids used internally by the library will have an `at_` prefix for classes and an `at-` for ids. The classes and ids are named this way to avoid any naming conflicts with your app's own CSS classes or IDs.
|
|
958
1024
|
|
|
959
1025
|
You can technically forego the at_showcase_container class of the parent div with your own class. Just make sure it has the `position` attribute set to `relative` otherwise things may not position correctly.
|
|
960
1026
|
|
|
@@ -962,7 +1028,7 @@ You can technically forego the at_showcase_container class of the parent div wit
|
|
|
962
1028
|
|
|
963
1029
|
- **mapId** - The id attribute value of the div element that will hold the map.
|
|
964
1030
|
- **position** - (optional) Specify where to place the minimap. Valid positions are topLeft, topRight, bottomRight, bottomLeft. By default, the map is placed at the topRight corner if this value is not set.
|
|
965
|
-
- **fixedSized** - (optional) Specify a fixed width of the minimap. By default, the minimap has width of 100px and expands to 250px upon mouse hover. Please take note that setting a fixed width of your minimap will disable the hover-to-expand animation. Any
|
|
1031
|
+
- **fixedSized** - (optional) Specify a fixed width of the minimap. By default, the minimap has width of 100px and expands to 250px upon mouse hover. Please take note that setting a fixed width of your minimap will disable the hover-to-expand animation. Any numeric value you provide will be translated into pixel units
|
|
966
1032
|
|
|
967
1033
|
Example:
|
|
968
1034
|
|
|
@@ -990,11 +1056,11 @@ Your application may need to execute certain methods during the initialization o
|
|
|
990
1056
|
- **STARTING:** Matterport begins the transition to the start location
|
|
991
1057
|
- **PLAYING** The 3D space is now ready for user interaction
|
|
992
1058
|
|
|
993
|
-
You can also view the technical diagram of how this
|
|
1059
|
+
You can also view the technical diagram of how this works below:
|
|
994
1060
|
|
|
995
1061
|
<img src="https://drive.google.com/uc?id=1I_NuuI_PWkRzB0DueCmBCBH-1V_upiOB" width="400" height="300" />
|
|
996
1062
|
|
|
997
|
-
To invoke a function from your application during one of the phases
|
|
1063
|
+
To invoke a function from your application during one of the phases, simply pass the function name as a parameter in the `connectSpace()` method. Make sure to not add a parenthesis to your function name when you pass it as a parameter to avoid invoking the function prematurely.
|
|
998
1064
|
|
|
999
1065
|
*Example:*
|
|
1000
1066
|
|
|
@@ -1025,7 +1091,7 @@ In this example, the method named `runThisOnPlayState` is passed as a value to t
|
|
|
1025
1091
|
|
|
1026
1092
|
You can navigate around the space using keyboard arrow keys or using a mouse.
|
|
1027
1093
|
|
|
1028
|
-
|
|
1094
|
+
Programmatically, you can also navigate the space. You may use [moveInDirection()](#moveindirection) method to move around inside the space.
|
|
1029
1095
|
This will move the user to the nearest Sweep marker in the indicated direction.
|
|
1030
1096
|
|
|
1031
1097
|
````typescript
|
|
@@ -1107,7 +1173,7 @@ await atwin.cameraPan(30,0)
|
|
|
1107
1173
|
|
|
1108
1174
|
## Tags
|
|
1109
1175
|
|
|
1110
|
-
Tags refer to interactive annotations or markers that can be added to a 3D Space provide additional information or context about specific areas or objects within the space.
|
|
1176
|
+
Tags refer to interactive annotations or markers that can be added to a 3D Space to provide additional information or context about specific areas or objects within the space.
|
|
1111
1177
|
|
|
1112
1178
|
### Adding tag to Space
|
|
1113
1179
|
|
|
@@ -1153,17 +1219,17 @@ try {
|
|
|
1153
1219
|
}
|
|
1154
1220
|
```
|
|
1155
1221
|
|
|
1156
|
-
### Removing
|
|
1222
|
+
### Removing a Tag from a Space
|
|
1157
1223
|
|
|
1158
1224
|
|
|
1159
1225
|
|
|
1160
|
-
### Customization of Tag
|
|
1226
|
+
### Customization of a Tag
|
|
1161
1227
|
|
|
1162
|
-
### Moving
|
|
1228
|
+
### Moving a Tag in the Space
|
|
1163
1229
|
|
|
1164
1230
|
## Loading and Interacting with 3D/2D Objects
|
|
1165
1231
|
|
|
1166
|
-
Architwin allows you to load and interact with 3D or 2D objects into a 3D showcase. Architwin has internal functions that
|
|
1232
|
+
Architwin allows you to load and interact with 3D or 2D objects into a 3D showcase. Architwin has internal functions that perform GET requests from an API endpoint, parse the data, and then render it to your 3D showcase. The fetched data implements the `IShowcaseObject` type interface, which matches the schema of the API response. Please take note that this guide assumes that you have implemented the recommended database schema for storing your showcase objects.
|
|
1167
1233
|
|
|
1168
1234
|
### What is an Object?
|
|
1169
1235
|
|
|
@@ -1171,7 +1237,7 @@ We define objects as 3D or 2D assets that have or will be loaded into a space. T
|
|
|
1171
1237
|
|
|
1172
1238
|
**3D Models**
|
|
1173
1239
|
|
|
1174
|
-
-
|
|
1240
|
+
- GLTF/GLB
|
|
1175
1241
|
- FBX
|
|
1176
1242
|
|
|
1177
1243
|
**2D Objects**
|
|
@@ -1182,13 +1248,13 @@ We define objects as 3D or 2D assets that have or will be loaded into a space. T
|
|
|
1182
1248
|
- JPEG (Images)
|
|
1183
1249
|
- ZIP (Image/Image slideshows)
|
|
1184
1250
|
|
|
1185
|
-
We add support for more file types in future updates
|
|
1251
|
+
We will add support for more file types in future updates
|
|
1186
1252
|
|
|
1187
1253
|
### Loading Objects
|
|
1188
1254
|
|
|
1189
1255
|
Objects come in many shapes and sizes. Loading objects may sometimes take a lot of resources especially if you intend to load a lot of objects in your space. Architwin is optimized to load your 3D spaces and its associated objects as fast and efficiently as possible to reduce the TTI.
|
|
1190
1256
|
|
|
1191
|
-
To achieve this, instead of loading all of your objects at the same time at the start which causes long initial load times, Architwin eagerly renders objects in the space when the user is at a certain distance from the
|
|
1257
|
+
To achieve this, instead of loading all of your objects at the same time at the start which causes long initial load times, Architwin eagerly renders objects in the space when the user is at a certain distance from the object's intended position. We call this feature **Render On Demand**.
|
|
1192
1258
|
|
|
1193
1259
|
By default, objects are rendered in the space when objects are within a **2 meters** diameter from the Camera (User view). You can increase or decrease this distance by setting the render distance using the `setRenderDistance()` method.
|
|
1194
1260
|
|
|
@@ -1209,7 +1275,7 @@ atwin.connectSpace(url, auth, config)
|
|
|
1209
1275
|
...
|
|
1210
1276
|
```
|
|
1211
1277
|
|
|
1212
|
-
You only need to set the render distance once. Make sure to invoke the function before
|
|
1278
|
+
You only need to set the render distance once. Make sure to invoke the function before calling the [connectSpace](#connectspace) method.
|
|
1213
1279
|
|
|
1214
1280
|
Architwin also allows you to get **rendered** objects near the user by calling the [getNearbyObjects()](#getnearbyobjects) method which will return an array of nodes of the rendered objects within the target range.
|
|
1215
1281
|
|
|
@@ -1232,7 +1298,7 @@ atwin.getNearbyObjects(payload)
|
|
|
1232
1298
|
...
|
|
1233
1299
|
```
|
|
1234
1300
|
|
|
1235
|
-
You can learn more about the different
|
|
1301
|
+
You can learn more about the different parameters of this function under the [function reference](#function-reference) section. If you need to get all the nearby objects every time the user moves, then you can simply add the following key-value pair in your config.
|
|
1236
1302
|
|
|
1237
1303
|
```typescript
|
|
1238
1304
|
import * as atwin from 'architwin'
|
|
@@ -1256,15 +1322,15 @@ import * as atwin from 'architwin'
|
|
|
1256
1322
|
|
|
1257
1323
|
...
|
|
1258
1324
|
|
|
1259
|
-
//Gets updated
|
|
1325
|
+
//Gets updated every time the User camera moves
|
|
1260
1326
|
atwin.nearbyObjects
|
|
1261
1327
|
|
|
1262
1328
|
...
|
|
1263
1329
|
``` -->
|
|
1264
1330
|
|
|
1265
|
-
|
|
1331
|
+
## Adding, removing and customizing Tags
|
|
1266
1332
|
|
|
1267
|
-
Tags are interactive elements that can be added to a 3D Space. Tags are essentially clickable
|
|
1333
|
+
Tags are interactive elements that can be added to a 3D Space. Tags are essentially clickable annotations or markers that can be placed within the 3D model of a space, typically linking to additional information or media. They enhance the user experience by providing context and additional details about specific features or objects within the Space.
|
|
1268
1334
|
|
|
1269
1335
|
To render a tag in the Space, you can use [renderTag()](#rendertag) method. The [renderTag()](#rendertag) method accepts payload input.
|
|
1270
1336
|
|
|
@@ -1343,7 +1409,7 @@ try {
|
|
|
1343
1409
|
}
|
|
1344
1410
|
```
|
|
1345
1411
|
|
|
1346
|
-
Tags are
|
|
1412
|
+
Tags are customizable. You can customize the tag label, description, stem, icon, and color.
|
|
1347
1413
|
|
|
1348
1414
|
[editTagLabel()](#edittaglabel) is the right method to change or edit the label of a specific tag.
|
|
1349
1415
|
|
|
@@ -1364,7 +1430,7 @@ try {
|
|
|
1364
1430
|
}
|
|
1365
1431
|
```
|
|
1366
1432
|
|
|
1367
|
-
To edit or change the description of a tag, the [editTagDescription()](#edittagdescription)
|
|
1433
|
+
To edit or change the description of a tag, use the [editTagDescription()](#edittagdescription) method.
|
|
1368
1434
|
|
|
1369
1435
|
|
|
1370
1436
|
*Example:*
|
|
@@ -1384,7 +1450,7 @@ try {
|
|
|
1384
1450
|
}
|
|
1385
1451
|
```
|
|
1386
1452
|
|
|
1387
|
-
You can also choose
|
|
1453
|
+
You can also choose to show or hide the tag stem by invoking [editTagStem()](#edittagstem).
|
|
1388
1454
|
|
|
1389
1455
|
*Example:*
|
|
1390
1456
|
```typescript
|
|
@@ -1403,7 +1469,7 @@ try {
|
|
|
1403
1469
|
}
|
|
1404
1470
|
```
|
|
1405
1471
|
|
|
1406
|
-
|
|
1472
|
+
The tag icon is also editable; use the [editTagIcon()](#edittagicon) method for this.
|
|
1407
1473
|
|
|
1408
1474
|
*Example:*
|
|
1409
1475
|
```typescript
|
|
@@ -1442,7 +1508,7 @@ try {
|
|
|
1442
1508
|
}
|
|
1443
1509
|
```
|
|
1444
1510
|
|
|
1445
|
-
|
|
1511
|
+
Attaching media to a tag is also possible; use the [attachTagMedia()](#attachtagmedia) method.
|
|
1446
1512
|
|
|
1447
1513
|
*Example:*
|
|
1448
1514
|
```typescript
|
|
@@ -1485,13 +1551,13 @@ Please explore the [Tags](#tags) related function to learn more what you can do
|
|
|
1485
1551
|
|
|
1486
1552
|
### Accessing List of Rendered Objects and Object Structure
|
|
1487
1553
|
|
|
1488
|
-
Objects that have been loaded and **rendered** into the 3D space are stored in an array called _3DXObjects which you can access by
|
|
1554
|
+
Objects that have been loaded and **rendered** into the 3D space are stored in an array called _3DXObjects which you can access by calling it this way
|
|
1489
1555
|
|
|
1490
1556
|
```typescript
|
|
1491
1557
|
atwin._3DXObjects
|
|
1492
1558
|
```
|
|
1493
1559
|
|
|
1494
|
-
All the elements in this array implement the `IObjectData` interface. Each element in the array contains all the data you would need manipulate the object.
|
|
1560
|
+
All the elements in this array implement the `IObjectData` interface. Each element in the array contains all the data you would need to manipulate the object.
|
|
1495
1561
|
|
|
1496
1562
|
*interface used* (TS)
|
|
1497
1563
|
```typescript
|
|
@@ -1506,7 +1572,7 @@ interface IObjectData {
|
|
|
1506
1572
|
|
|
1507
1573
|
Each object element inside `atwin._3DXObjects` contains the value keys:
|
|
1508
1574
|
|
|
1509
|
-
**collider** - Collider components define the shape of
|
|
1575
|
+
**collider** - Collider components define the shape of a 3D/2D object for the purposes of physical collisions. A collider, which is invisible, does not need to be the exact same shape as the GameObject’s mesh.
|
|
1510
1576
|
|
|
1511
1577
|
**object** - The object key is an object that implements the `IShowcaseObject` interface. This is one of the most important values as the object contains all the information about an object such as its id,name,position,rotation,scale,amazon_uri link, and etc. You can look at the interface below to view the full makeup of the object key.
|
|
1512
1578
|
|
|
@@ -1545,9 +1611,9 @@ export interface IShowcaseObject {
|
|
|
1545
1611
|
}
|
|
1546
1612
|
```
|
|
1547
1613
|
|
|
1548
|
-
**component:** This
|
|
1614
|
+
**component:** This object contains functions and variables responsible for initializing, updating, and destroying a rendered object's mesh, texture, etc. This object also contains the three.js instance. Since the 3D space is rendered with Three.js under the hood. You can use this instance to invoke methods made available by three.js. This gives you a lot of flexibility and control provided you know how to use it. This documentation will not cover Three.js specific methods. Visit their [official website](https://threejs.org/) if you want to learn more about it.
|
|
1549
1615
|
|
|
1550
|
-
**node:** The node is responsible for managing the lifecycle of a 3D/2D
|
|
1616
|
+
**node:** The node is responsible for managing the lifecycle of a 3D/2D object. The node can be used to `start()` and `stop()` a rendered model. Invoking `start()` will render the model into the scene while `stop()` will destroy it and remove it from the scene.
|
|
1551
1617
|
|
|
1552
1618
|
**type:** A string that states the file or object type of a 3D/2D object. The file type could be any of the following
|
|
1553
1619
|
|
|
@@ -1560,7 +1626,7 @@ export interface IShowcaseObject {
|
|
|
1560
1626
|
| FRAME | Media Screen | A customizable [media screen](#creating-a-customizable-media-screen) |
|
|
1561
1627
|
| ZIP | slideshow | A zip file rendered as a image slideshow |
|
|
1562
1628
|
|
|
1563
|
-
The `atwin.selectedObject` variable is an example of a variable that implements this
|
|
1629
|
+
The `atwin.selectedObject` variable is an example of a variable that implements this interface and contains this data.
|
|
1564
1630
|
|
|
1565
1631
|
### Transforming Objects
|
|
1566
1632
|
|
|
@@ -1578,15 +1644,15 @@ There are several methods that allows you to transform an object. Let's go throu
|
|
|
1578
1644
|
|
|
1579
1645
|
#### Transforming Object by clicking it
|
|
1580
1646
|
|
|
1581
|
-
Clicking on any object in the space will attach the axis controls to it. By default, clicking on an object will show axis controls for translating the object. You can then use your mouse cursor to click and drag the object to modify its position,rotation, and scale in
|
|
1647
|
+
Clicking on any object in the space will attach the axis controls to it. By default, clicking on an object will show axis controls for translating the object. You can then use your mouse cursor to click and drag the object to modify its position, rotation, and scale in whatever way you prefer. See screenshot for reference
|
|
1582
1648
|
|
|
1583
1649
|
<img src="https://matterport.github.io/showcase-sdk/images/sdkbundle-components-transform-controls.png" width="300" height="200" />
|
|
1584
1650
|
|
|
1585
1651
|
You can switch the transform mode on the currently selected object by using the [setTransformMode()](#settransformmode) method.
|
|
1586
1652
|
|
|
1587
|
-
Please take note that transform controls can only be attached to one object at a time. Clicking on another object will remove the transform controls
|
|
1653
|
+
Please take note that transform controls can only be attached to one object at a time. Clicking on another object will remove the transform controls from the previous object and add them to the currently selected object. It is impractical to attach multiple transform controls on more than one object. If you wish to programmatically transform multiple objects, the next method offers a solution.
|
|
1588
1654
|
|
|
1589
|
-
If you wish
|
|
1655
|
+
If you wish to access the object data of the object that has been clicked on, You can do so by calling the `atwin.selectedObject` variable which returns an object implementing the `IObjectData` interface containing all the necessary data you need. Know more about the structure of an object by going to this section
|
|
1590
1656
|
|
|
1591
1657
|
```typescript
|
|
1592
1658
|
import * as atwin from 'architwin';
|
|
@@ -1600,7 +1666,7 @@ console.log("Selected object data", atwin.selectedObject)
|
|
|
1600
1666
|
|
|
1601
1667
|
**Switching Transform Modes**
|
|
1602
1668
|
|
|
1603
|
-
If you wish switch transformation mode, you can pass either 'translate'
|
|
1669
|
+
If you wish to switch transformation mode, you can pass either 'translate', 'scale', or 'rotate' as parameters to the [setTransformMode()](#settransformmode) method. This will switch the transform controls on the currently selected object
|
|
1604
1670
|
|
|
1605
1671
|
| parameter | type | required | default | values |
|
|
1606
1672
|
| :----: | :----: | :---: | :---: | :---: |
|
|
@@ -1698,7 +1764,7 @@ atwin.setObjectTransformation(mirrorMediaScreen.node, mirrorObjectPosition)
|
|
|
1698
1764
|
...
|
|
1699
1765
|
```
|
|
1700
1766
|
|
|
1701
|
-
If done correctly, you should see your target object(s) display or reposition to your intended position, rotation, and scale. Please
|
|
1767
|
+
If done correctly, you should see your target object(s) display or reposition to your intended position, rotation, and scale. Please note that the transform controls UI will not be attached to the object when using this method.
|
|
1702
1768
|
|
|
1703
1769
|
### Undoing and Redoing Transformation Changes
|
|
1704
1770
|
|
|
@@ -1718,7 +1784,7 @@ atwin.revertTransform()
|
|
|
1718
1784
|
...
|
|
1719
1785
|
```
|
|
1720
1786
|
|
|
1721
|
-
If you want to redo a
|
|
1787
|
+
If you want to redo a transformation, change the parameter to 'redo'.
|
|
1722
1788
|
|
|
1723
1789
|
```typescript
|
|
1724
1790
|
import * as atwin from 'architwin';
|
|
@@ -1777,7 +1843,7 @@ atwin.addObjectToSpace(objectUrl,objectType, objectConfig)
|
|
|
1777
1843
|
|
|
1778
1844
|
**Method 2: Adding with click method using getTargetPosition**
|
|
1779
1845
|
|
|
1780
|
-
The library has several helper methods that provide a range of
|
|
1846
|
+
The library has several helper methods that provide a range of common functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do so by using the `getTargetPosition()` helper method in tandem with the [addObjectToSpace()](#addobjecttospace) method. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
|
|
1781
1847
|
|
|
1782
1848
|
Here is an example of how you can use the two methods together. This is just one example, it is up to you on how you wish to combine different methods provided by the library
|
|
1783
1849
|
|
|
@@ -1838,7 +1904,7 @@ By default, your media screen will show a blank white canvas if you set the medi
|
|
|
1838
1904
|
|
|
1839
1905
|
There are many ways you can use this method to add a media screen to your 3D space. Let's go through each one.
|
|
1840
1906
|
|
|
1841
|
-
**NOTE:** The following examples utilize typescript and will utilize the TypeScript (TS) interfaces the library provides. While you can use just plain JavaScript (JS) for your project and copy the following code snippets (minus the TS interfaces) to your plain JS project, we **highly** recommend that you use TypeScript instead for your Architwin
|
|
1907
|
+
**NOTE:** The following examples utilize typescript and will utilize the TypeScript (TS) interfaces the library provides. While you can use just plain JavaScript (JS) for your project and copy the following code snippets (minus the TS interfaces) to your plain JS project, we **highly** recommend that you use TypeScript instead for your Architwin-powered projects to take advantage of the type-safety and the custom interfaces provided by the library
|
|
1842
1908
|
|
|
1843
1909
|
**Method 1: Adding Programmatically**
|
|
1844
1910
|
|
|
@@ -1872,7 +1938,7 @@ If done correctly, you should be able to see your media screen in your intended
|
|
|
1872
1938
|
|
|
1873
1939
|
**Method 2: Adding with click method using getTargetPosition**
|
|
1874
1940
|
|
|
1875
|
-
The library has several helper methods that provide a range of
|
|
1941
|
+
The library has several helper methods that provide a range of common functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do so by using the `getTargetPosition()` helper method in tandem with the [addMediaScreen()](#addmediascreen) method. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
|
|
1876
1942
|
|
|
1877
1943
|
Here is an example of how you can use the two methods together. This is just one example, it is up to you on how you wish to combine different methods provided by the library
|
|
1878
1944
|
|
|
@@ -1945,7 +2011,7 @@ await atwin.attachMediaScreenContent(targetMediaScreenId, validUrl, 'video')
|
|
|
1945
2011
|
|
|
1946
2012
|
When setting a video as the media screen content. You can use the [setVideoPlayback()](#setvideoplayback) method to programmatically play,pause,mute,and unmute a video. You can navigate to the [playback controls section](#setting-video-playback-in-the-space) to learn more about the method. Here is an example on how to use it.
|
|
1947
2013
|
|
|
1948
|
-
In this example, we are getting a random media screen from the `atwin._3DXObject` array which contains all the objects rendered in the space. Media screens whose media type is a video will have a variable called `planeElement` inside the object's `component` which contains an HTML video element that we can manipulate using the [setVideoPlayback()](#setvideoplayback) method. Please take note that this variable is not
|
|
2014
|
+
In this example, we are getting a random media screen from the `atwin._3DXObject` array which contains all the objects rendered in the space. Media screens whose media type is a video will have a variable called `planeElement` inside the object's `component` which contains an HTML video element that we can manipulate using the [setVideoPlayback()](#setvideoplayback) method. Please take note that this variable is not accessible if the media type of the media screen content is an image.
|
|
1949
2015
|
|
|
1950
2016
|
*Interface used*
|
|
1951
2017
|
```typescript
|
|
@@ -1992,9 +2058,9 @@ const config = {
|
|
|
1992
2058
|
|
|
1993
2059
|
Setting video playback refers to the act of adjusting various controls associated with the playback of a video in the space. It involves manipulating controls such as pause, play, mute, and unmute to modify the playback behavior according to user's preferences.
|
|
1994
2060
|
|
|
1995
|
-
**Pause** - Pausing a video temporarily
|
|
2061
|
+
**Pause** - Pausing a video temporarily freezes it at a specific moment.
|
|
1996
2062
|
|
|
1997
|
-
**Play** - Playing a video resumes its playback from paused state, allowing the user to watch the video in real-time
|
|
2063
|
+
**Play** - Playing a video resumes its playback from a paused state, allowing the user to watch the video in real-time.
|
|
1998
2064
|
|
|
1999
2065
|
**Mute** - Muting a video disables the audio playback, suppressing any sound embedded within the video.
|
|
2000
2066
|
|
|
@@ -2002,7 +2068,7 @@ Setting video playback refers to the act of adjusting various controls associate
|
|
|
2002
2068
|
|
|
2003
2069
|
Assuming that you have already selected a video, you can now set the playback of the video.
|
|
2004
2070
|
|
|
2005
|
-
|
|
2071
|
+
In order to set the playback of a video, you may use the [setVideoPlayback()](#setvideoplayback) method.
|
|
2006
2072
|
|
|
2007
2073
|
| parameter | type | required | default | values |
|
|
2008
2074
|
| :----: | :----: | :---: | :---: | :---: |
|
|
@@ -2035,17 +2101,17 @@ atwin.setVideoPlayback('unmute', targetVideoElement)
|
|
|
2035
2101
|
...
|
|
2036
2102
|
```
|
|
2037
2103
|
|
|
2038
|
-
**NOTE:** Please take note that this variable is not
|
|
2104
|
+
**NOTE:** Please take note that this variable is not accessible if the media type of the media screen content is an image.
|
|
2039
2105
|
|
|
2040
2106
|
### Setting Animation Control in the Space
|
|
2041
2107
|
|
|
2042
|
-
Setting animation control refers to the process of manipulating the playback of animations applied to 3D objects in the space. It involves utilizing controls such as play and pause to control the
|
|
2108
|
+
Setting animation control refers to the process of manipulating the playback of animations applied to 3D objects in the space. It involves utilizing controls such as play and pause to control the animation.
|
|
2043
2109
|
|
|
2044
|
-
Assuming that you have already selected an animated 3D object, you can now control the
|
|
2110
|
+
Assuming that you have already selected an animated 3D object, you can now control the animation.
|
|
2045
2111
|
|
|
2046
|
-
In order to set the animation control of a 3D object, you may use the [setAnimationState()](#setanimationstate) method. By default the action is set to 'play'.
|
|
2112
|
+
In order to set the animation control of a 3D object, you may use the [setAnimationState()](#setanimationstate) method. By default, the action is set to 'play'.
|
|
2047
2113
|
|
|
2048
|
-
**NOTE:** Please
|
|
2114
|
+
**NOTE:** Please note that the 3D object MUST be fully rendered in the space before you can manipulate its animation state. This method will have no affect on 3D objects that do not have any animations in them.
|
|
2049
2115
|
|
|
2050
2116
|
| parameter | type | required | default | values |
|
|
2051
2117
|
| :----: | :----: | :---: | :---: | :---: |
|
|
@@ -2075,7 +2141,7 @@ atwin.setAnimationState('pause', modelID)
|
|
|
2075
2141
|
...
|
|
2076
2142
|
```
|
|
2077
2143
|
|
|
2078
|
-
### Copying
|
|
2144
|
+
### Copying an Object to Your Space
|
|
2079
2145
|
Copying an object refers to creating a duplicate or clone of an object. When an object is copied in the space, it means that the object's data is duplicated.
|
|
2080
2146
|
|
|
2081
2147
|
Assuming that you have already selected an object to be copied, you may now copy the object by calling [copyObject()](#copyobject) method. You may also specify a custom offset position and rotation of the object to be cloned.
|
|
@@ -2105,9 +2171,9 @@ if (atwin.selectedObject.object) {
|
|
|
2105
2171
|
|
|
2106
2172
|
### Navigate to Object
|
|
2107
2173
|
|
|
2108
|
-
Navigating to an object in space refers to the process of moving the camera's location near
|
|
2174
|
+
Navigating to an object in space refers to the process of moving the camera's location near the object.
|
|
2109
2175
|
|
|
2110
|
-
Assuming that you have already selected an object to navigate to, you may now navigate to the object by using [goToModel()](#goToModel) method.
|
|
2176
|
+
Assuming that you have already selected an object to navigate to, you may now navigate to the object by using the [goToModel()](#goToModel) method.
|
|
2111
2177
|
|
|
2112
2178
|
| parameter | type | required | default | values |
|
|
2113
2179
|
| :----: | :----: | :---: | :---: | :---: |
|
|
@@ -2124,7 +2190,7 @@ await atwin.goToModel(objectId)
|
|
|
2124
2190
|
|
|
2125
2191
|
```
|
|
2126
2192
|
|
|
2127
|
-
### Deleting Object
|
|
2193
|
+
### Deleting an Object from Your Space
|
|
2128
2194
|
|
|
2129
2195
|
Deleting an object in space refers to the process of removing a pre-existing 2D or 3D object from the 3D environment or space. This action results in the elimination of the visual representation and physical presence of the object within the virtual space. By removing the object, users can maintain control over the composition and contents of their space, allowing for more dynamic and tailored virtual experiences.
|
|
2130
2196
|
|
|
@@ -2147,9 +2213,9 @@ async function handleDeleteObjectFromSpace() {
|
|
|
2147
2213
|
...
|
|
2148
2214
|
```
|
|
2149
2215
|
|
|
2150
|
-
**NOTE:** This
|
|
2216
|
+
**NOTE:** This only removes the object from the space, not from the database.
|
|
2151
2217
|
|
|
2152
|
-
### Replacing Object
|
|
2218
|
+
### Replacing an Object in Your Space
|
|
2153
2219
|
|
|
2154
2220
|
Replacing an object in space refers to the process of substituting a pre-existing 2D or 3D object within a 3D environment or space with another object. This action involves removing the original object and introducing a new one in its place, while maintaining the object's location and any associated properties or attributes.
|
|
2155
2221
|
|
|
@@ -2183,7 +2249,7 @@ async function handleReplaceObject() {
|
|
|
2183
2249
|
|
|
2184
2250
|
### Creating Text Markup Screen in the space
|
|
2185
2251
|
|
|
2186
|
-
A text markup screen is a graphical user interface
|
|
2252
|
+
A text markup screen is a graphical user interface object that allows users to input and display formatted text in the 3D space. The method internally generates elements and programmatically applies CSS styling. You can use this method to display text messages to the 3D screen.
|
|
2187
2253
|
|
|
2188
2254
|
In order to add a text markup screen in your space, you may use the [addTextMarkupScreen()](#addtextmarkupscreen) method.
|
|
2189
2255
|
|
|
@@ -2251,7 +2317,7 @@ atwin.setTextMarkupScreenContent(id, title, text, textColor, backgroundColor)
|
|
|
2251
2317
|
```
|
|
2252
2318
|
|
|
2253
2319
|
## Typescript Interface Reference
|
|
2254
|
-
We encourage
|
|
2320
|
+
We encourage you to use TypeScript for any new project you intend to use the library with. With typescript, you can take advantage of the type interfaces provided by the library. This helps you catch errors more easily on your IDE instead of seeing it on production. If you do intend to just use vanilla JS for your project, you can still use this section as a reference on how to structure the javascript objects in yours project
|
|
2255
2321
|
|
|
2256
2322
|
You can use the library's type interfaces by importing it using the following import path
|
|
2257
2323
|
|
|
@@ -2268,7 +2334,7 @@ The library also exports a couple enums that you can use in your project too. He
|
|
|
2268
2334
|
import {type IShowcaseObject,SPACE_EVENTS} from 'architwin/lib/types'
|
|
2269
2335
|
|
|
2270
2336
|
//Method 2: Import interface and enums separately
|
|
2271
|
-
import type {IShowcaseObject} from '
|
|
2337
|
+
import type {IShowcaseObject} from 'architwin/lib/types'
|
|
2272
2338
|
import {SPACE_EVENTS} from 'architwin/lib/types'
|
|
2273
2339
|
|
|
2274
2340
|
const spaceObject:IShowcaseObject = {}
|
|
@@ -3031,7 +3097,7 @@ _______
|
|
|
3031
3097
|
|
|
3032
3098
|
### Space
|
|
3033
3099
|
|
|
3034
|
-
|
|
3100
|
+
### connectSpace()
|
|
3035
3101
|
Connect and load a 3D space into an HTML iframe asynchronously using this function. It initializes various configuration settings and view modes based on the provided parameters.
|
|
3036
3102
|
|
|
3037
3103
|
```typescript
|
|
@@ -3051,7 +3117,7 @@ async function connectSpace(
|
|
|
3051
3117
|
|
|
3052
3118
|
**url** - the URL of the space you wish to connect to.
|
|
3053
3119
|
|
|
3054
|
-
- The [connectSpace](#connectSpace) method can also
|
|
3120
|
+
- The [connectSpace](#connectSpace) method can also accommodate the following URL parameters:
|
|
3055
3121
|
- "tagId" : ID of the tag
|
|
3056
3122
|
* In cases where the 'tag' is included in the URL with an assigned value, the camera location will swiftly adjust to the specified tag within the 3D space once the loading is complete. The particular tag to focus on will be determined by the value of the 'tag' parameter.
|
|
3057
3123
|
|
|
@@ -3064,7 +3130,7 @@ async function connectSpace(
|
|
|
3064
3130
|
|
|
3065
3131
|
- "hr" : 0 | 1
|
|
3066
3132
|
* 0 : Hide the highlight reel located at the bottom of the 3D Showcase user interface.
|
|
3067
|
-
* 1 (Default) :
|
|
3133
|
+
* 1 (Default) : Display highlight reel
|
|
3068
3134
|
|
|
3069
3135
|
- "tour" : 0 | 1 | 2 | 3
|
|
3070
3136
|
* 0 : Tour controls and highlight reel will not be visible.
|
|
@@ -3274,7 +3340,7 @@ You can enable a minimap display of your 3D space by setting the following key-v
|
|
|
3274
3340
|
} as IMPConfig;
|
|
3275
3341
|
```
|
|
3276
3342
|
|
|
3277
|
-
To ensure that you will not encounter any errors. Make sure to follow the prescribed markup structure under the [defining an iFrame section](#define-an-iframe-as-target-for-the-showcase). All CSS classes or ids used internally by the library will have an `at_` prefix for classes and an `at-` for ids. The classes and ids are named this way to avoid any naming conflicts with your
|
|
3343
|
+
To ensure that you will not encounter any errors. Make sure to follow the prescribed markup structure under the [defining an iFrame section](#define-an-iframe-as-target-for-the-showcase). All CSS classes or ids used internally by the library will have an `at_` prefix for classes and an `at-` for ids. The classes and ids are named this way to avoid any naming conflicts with your app's own CSS classes or IDs.
|
|
3278
3344
|
|
|
3279
3345
|
You can technically forego the at_showcase_container class of the parent div with your own class. Just make sure it has the `position` attribute set to `relative` otherwise things may not position correctly.
|
|
3280
3346
|
|
|
@@ -3282,7 +3348,7 @@ You can technically forego the at_showcase_container class of the parent div wit
|
|
|
3282
3348
|
|
|
3283
3349
|
- **mapId** - The id attribute value of the div element that will hold the map.
|
|
3284
3350
|
- **position** - (optional) Specify where to place the minimap. Valid positions are topLeft, topRight, bottomRight, bottomLeft. By default, the map is placed at the topRight corner if this value is not set.
|
|
3285
|
-
- **fixedSized** - (optional) Specify a fixed width of the minimap. By default, the minimap has width of 100px and expands to 250px upon mouse hover. Please take note that setting a fixed width of your minimap will disable the hover-to-expand animation. Any
|
|
3351
|
+
- **fixedSized** - (optional) Specify a fixed width of the minimap. By default, the minimap has width of 100px and expands to 250px upon mouse hover. Please take note that setting a fixed width of your minimap will disable the hover-to-expand animation. Any numeric value you provide will be translated into pixel units
|
|
3286
3352
|
|
|
3287
3353
|
*Example:*
|
|
3288
3354
|
|
|
@@ -3643,10 +3709,10 @@ import * as atwin from 'architwin'
|
|
|
3643
3709
|
|
|
3644
3710
|
atwin.disconnectSpace();
|
|
3645
3711
|
````
|
|
3646
|
-
-----
|
|
3647
|
-
### Tags
|
|
3648
3712
|
|
|
3649
|
-
|
|
3713
|
+
## Tags
|
|
3714
|
+
|
|
3715
|
+
### getTags()
|
|
3650
3716
|
|
|
3651
3717
|
This method returns an array of `ITag` containing information of all tags in the space.
|
|
3652
3718
|
|
|
@@ -3674,7 +3740,7 @@ if (tags) {
|
|
|
3674
3740
|
```
|
|
3675
3741
|
|
|
3676
3742
|
|
|
3677
|
-
|
|
3743
|
+
### gotoTag()
|
|
3678
3744
|
|
|
3679
3745
|
This method enables direct navigation to the tag within the space, identified by a specific ID.
|
|
3680
3746
|
|
|
@@ -3934,7 +4000,7 @@ try {
|
|
|
3934
4000
|
|
|
3935
4001
|
### detachTagMedia()
|
|
3936
4002
|
|
|
3937
|
-
In
|
|
4003
|
+
In contrast to [attachTagMedia()](#attachtagmedia), this asynchronous function is available for detaching media attachments from a particular tag, identified by its tagId, using an object payload as its input. The process involves retrieving the tag and subsequently separating the specified media attachments.
|
|
3938
4004
|
|
|
3939
4005
|
|
|
3940
4006
|
*Function Signature*
|
|
@@ -3969,7 +4035,7 @@ try {
|
|
|
3969
4035
|
|
|
3970
4036
|
### moveTag()
|
|
3971
4037
|
|
|
3972
|
-
|
|
4038
|
+
This asynchronous function relocates a specific tag identified by its tagId, which is passed as its input parameter.
|
|
3973
4039
|
|
|
3974
4040
|
*Function Signature*
|
|
3975
4041
|
```typescript
|
|
@@ -4171,11 +4237,10 @@ try {
|
|
|
4171
4237
|
|
|
4172
4238
|
```
|
|
4173
4239
|
|
|
4174
|
-
-----
|
|
4175
4240
|
|
|
4176
|
-
|
|
4241
|
+
## Sweeps
|
|
4177
4242
|
|
|
4178
|
-
|
|
4243
|
+
### getSweeps()
|
|
4179
4244
|
|
|
4180
4245
|
Retrieve information about the sweeps (viewpoints) within the loaded 3D space using this asynchronous method.
|
|
4181
4246
|
|
|
@@ -4196,7 +4261,7 @@ if (sweeps) {
|
|
|
4196
4261
|
}
|
|
4197
4262
|
```
|
|
4198
4263
|
|
|
4199
|
-
|
|
4264
|
+
### moveToSweep()
|
|
4200
4265
|
|
|
4201
4266
|
This asynchronous function moves the camera location to a specific sweep (viewpoint) within the loaded 3D space.
|
|
4202
4267
|
|
|
@@ -4221,7 +4286,7 @@ console.log('Camera view moved to sweep ' + sweepId);
|
|
|
4221
4286
|
```
|
|
4222
4287
|
|
|
4223
4288
|
|
|
4224
|
-
|
|
4289
|
+
### getNearbySweeps()
|
|
4225
4290
|
|
|
4226
4291
|
Retrieve information about nearby sweeps (viewpoints) for a given sweep within the loaded 3D space using this asynchronous function.
|
|
4227
4292
|
|
|
@@ -4244,7 +4309,7 @@ const nearbySweeps = await atwin.getNearbySweeps(sweepId);
|
|
|
4244
4309
|
console.log('Nearby Sweeps:', nearbySweeps);
|
|
4245
4310
|
```
|
|
4246
4311
|
|
|
4247
|
-
|
|
4312
|
+
### getCurrentSweep()
|
|
4248
4313
|
|
|
4249
4314
|
Obtain information about the current sweep that the camera view is focused on within the loaded 3D space using this function.
|
|
4250
4315
|
|
|
@@ -4262,9 +4327,9 @@ console.log('Current Sweep:', currentSweep);
|
|
|
4262
4327
|
```
|
|
4263
4328
|
|
|
4264
4329
|
|
|
4265
|
-
|
|
4330
|
+
### getCurrentSweepPosition()
|
|
4266
4331
|
|
|
4267
|
-
Retrieve
|
|
4332
|
+
Retrieve the exact position of the current sweep. This function returns the sweep's (x, y, z) coordinates.
|
|
4268
4333
|
|
|
4269
4334
|
*Function Signature*
|
|
4270
4335
|
```typescript
|
|
@@ -4280,7 +4345,7 @@ console.log('Current Sweep Position:', currentSweepPosition);
|
|
|
4280
4345
|
```
|
|
4281
4346
|
|
|
4282
4347
|
|
|
4283
|
-
|
|
4348
|
+
### getAllSweeps()
|
|
4284
4349
|
|
|
4285
4350
|
This function retrieves all sweep data within the currently loaded space. It will return an array of objects, each containing information about a sweep. Each object includes properties such as id, position, and neighbors.
|
|
4286
4351
|
|
|
@@ -4306,7 +4371,7 @@ const allSweeps = atwin.getAllSweeps();
|
|
|
4306
4371
|
console.log('All Sweeps:', allSweeps);
|
|
4307
4372
|
```
|
|
4308
4373
|
|
|
4309
|
-
|
|
4374
|
+
### disableSweeps()
|
|
4310
4375
|
|
|
4311
4376
|
This function disables all Sweeps when the iframeId is passed.
|
|
4312
4377
|
|
|
@@ -4322,7 +4387,7 @@ iframeId = "mp-showcase";
|
|
|
4322
4387
|
const disableSweeps = atwin.disableSweeps(iframeId) (edited)
|
|
4323
4388
|
```
|
|
4324
4389
|
|
|
4325
|
-
|
|
4390
|
+
### disableSweep()
|
|
4326
4391
|
|
|
4327
4392
|
Disables the current sweep or multiple sweeps by passing an array of sweep ids. If no parameter is passed the current sweep will be disabled using the current SDK instance
|
|
4328
4393
|
|
|
@@ -4338,7 +4403,7 @@ const iframeId = "mp-showcase";
|
|
|
4338
4403
|
const disableSweeps = atwin.disableSweep(['sweep1','sweep2'],iframeId)
|
|
4339
4404
|
```
|
|
4340
4405
|
|
|
4341
|
-
|
|
4406
|
+
### enableSweep()
|
|
4342
4407
|
|
|
4343
4408
|
Enables the current sweep or multiple sweeps by passing an array of sweep ids. If no parameter is passed the current sweep will be enabled using the current SDK instance
|
|
4344
4409
|
|
|
@@ -4354,7 +4419,7 @@ const iframeId = "mp-showcase";
|
|
|
4354
4419
|
const disableSweeps = atwin.enableSweep(['sweep1','sweep2'],iframeId)
|
|
4355
4420
|
```
|
|
4356
4421
|
|
|
4357
|
-
|
|
4422
|
+
### Using custom sweep pucks
|
|
4358
4423
|
|
|
4359
4424
|
Custom sweep pucks allow you to place a 2D circle or 3D torus as an additional visual indicator in your sweeps. Do take note that the sweep pucks do not replace the existing sweep markers on the space. To add custom sweep pucks to your space simply add the following to your config object that you pass to `connectSpace`
|
|
4360
4425
|
|
|
@@ -4394,11 +4459,11 @@ const config = {
|
|
|
4394
4459
|
atwin.connectSpace(url,config)
|
|
4395
4460
|
```
|
|
4396
4461
|
|
|
4397
|
-
-----
|
|
4398
4462
|
|
|
4399
|
-
### Video
|
|
4400
4463
|
|
|
4401
|
-
|
|
4464
|
+
## Video
|
|
4465
|
+
|
|
4466
|
+
### playVideo()
|
|
4402
4467
|
|
|
4403
4468
|
Initiate playback of a video object with a specified ID in the loaded 3D space using this function. It fetches the video object using the provided video ID and starts playback.
|
|
4404
4469
|
|
|
@@ -4420,7 +4485,7 @@ const videoId = /* specify the video ID */;
|
|
|
4420
4485
|
atwin.playVideo(videoId);
|
|
4421
4486
|
```
|
|
4422
4487
|
|
|
4423
|
-
|
|
4488
|
+
### pauseVideo()
|
|
4424
4489
|
|
|
4425
4490
|
Pause playback of a video object with a specified ID in the loaded 3D space using this function. It retrieves the video object using the provided video ID and halts its playback.
|
|
4426
4491
|
|
|
@@ -4442,7 +4507,7 @@ const videoId = /* specify the video ID */;
|
|
|
4442
4507
|
atwin.pauseVideo(videoId);
|
|
4443
4508
|
```
|
|
4444
4509
|
|
|
4445
|
-
|
|
4510
|
+
### setVideoPlayback()
|
|
4446
4511
|
|
|
4447
4512
|
This function enables you to control the playback and mute state of an HTML video element by specifying an action. Supported actions include "play," "pause", "mute," and "unmute." The function modifies the playback and mute settings of the provided video element based on the action.
|
|
4448
4513
|
|
|
@@ -4466,11 +4531,10 @@ const videoElement = /* Specify the HTML video element */;
|
|
|
4466
4531
|
atwin.setVideoPlayback(action, videoElement);
|
|
4467
4532
|
```
|
|
4468
4533
|
|
|
4469
|
-
-----
|
|
4470
4534
|
|
|
4471
|
-
|
|
4535
|
+
## Navigation
|
|
4472
4536
|
|
|
4473
|
-
|
|
4537
|
+
### moveInDirection()
|
|
4474
4538
|
|
|
4475
4539
|
Move the camera within the space in a specified direction using this asynchronous function. Supported directions comprise 'LEFT,' 'RIGHT,' 'UP,' 'DOWN,' 'FORWARD,' and 'BACK'.
|
|
4476
4540
|
|
|
@@ -4498,13 +4562,12 @@ atwin.moveInDirection(desiredDirection)
|
|
|
4498
4562
|
});
|
|
4499
4563
|
```
|
|
4500
4564
|
|
|
4501
|
-
-----
|
|
4502
4565
|
|
|
4503
|
-
|
|
4566
|
+
## Camera
|
|
4504
4567
|
|
|
4505
|
-
|
|
4568
|
+
### getCurrentCameraPose()
|
|
4506
4569
|
|
|
4507
|
-
Retrieve the current camera pose, including the
|
|
4570
|
+
Retrieve the current camera pose, including the camera's spatial orientation and position within the space. This data provides details about the camera's location and orientation, allowing you to understand its position in the virtual environment.
|
|
4508
4571
|
|
|
4509
4572
|
*Function Signature*
|
|
4510
4573
|
```typescript
|
|
@@ -4519,9 +4582,9 @@ const cameraPose = atwin.getCurrentCameraPose();
|
|
|
4519
4582
|
console.log("Current Camera Pose:", cameraPose);
|
|
4520
4583
|
```
|
|
4521
4584
|
|
|
4522
|
-
|
|
4585
|
+
### getCurrentCameraZoom()
|
|
4523
4586
|
|
|
4524
|
-
Retrieve the current camera zoom data specifically camera zoom level.
|
|
4587
|
+
Retrieve the current camera zoom data, specifically the camera zoom level.
|
|
4525
4588
|
|
|
4526
4589
|
*Function Signature*
|
|
4527
4590
|
```typescript
|
|
@@ -4536,7 +4599,7 @@ const cameraZoomData = atwin.getCurrentCameraZoom();
|
|
|
4536
4599
|
console.log("Current Camera Pose:", cameraZoomData);
|
|
4537
4600
|
```
|
|
4538
4601
|
|
|
4539
|
-
|
|
4602
|
+
### getCameraPosition()
|
|
4540
4603
|
|
|
4541
4604
|
Retrieve the present camera position within the 3D space using this function. The function provides the coordinates (x, y, z) that signify the camera's placement in the 3D space.
|
|
4542
4605
|
|
|
@@ -4553,9 +4616,9 @@ const cameraPosition = atwin.getCameraPosition();
|
|
|
4553
4616
|
console.log("Current Camera Position:", cameraPosition);
|
|
4554
4617
|
```
|
|
4555
4618
|
|
|
4556
|
-
|
|
4619
|
+
### cameraPan()
|
|
4557
4620
|
|
|
4558
|
-
Pan the camera view
|
|
4621
|
+
Pan the camera view by specifying rotation angles along both the horizontal and vertical axes using this function. The panning action simulates looking sideways left and right (horizontal) and looking up and down (vertical).
|
|
4559
4622
|
|
|
4560
4623
|
*Function Signature*
|
|
4561
4624
|
```typescript
|
|
@@ -4582,7 +4645,7 @@ atwin.cameraPan(30, 10)
|
|
|
4582
4645
|
});
|
|
4583
4646
|
```
|
|
4584
4647
|
|
|
4585
|
-
|
|
4648
|
+
### cameraRotate()
|
|
4586
4649
|
This function allows you to rotate the camera's view by specifying rotation angles along the horizontal and vertical axes. The rotation action simulates changing the direction the camera is facing.
|
|
4587
4650
|
|
|
4588
4651
|
*Function Signature*
|
|
@@ -4595,7 +4658,7 @@ async function cameraRotate(x: number, y: number, speed: number): Promise<void>;
|
|
|
4595
4658
|
| :----: | :----: | :---: | :---: | :---: |
|
|
4596
4659
|
| x | number | yes | | number of degrees will pan the camera to the right |
|
|
4597
4660
|
| y | number | yes | | number of degrees will tilt the camera upward |
|
|
4598
|
-
| speed | number | yes | | number of
|
|
4661
|
+
| speed | number | yes | | number of seconds the camera will take to animate to the specified angle (x, y) |
|
|
4599
4662
|
|
|
4600
4663
|
*Example:*
|
|
4601
4664
|
```typescript
|
|
@@ -4611,7 +4674,7 @@ cameraRotate(45, 15, 0.5)
|
|
|
4611
4674
|
});
|
|
4612
4675
|
```
|
|
4613
4676
|
|
|
4614
|
-
|
|
4677
|
+
### cameraSetRotation()
|
|
4615
4678
|
This function allows you to rotate the camera's view by specifying rotation angles along the horizontal and vertical axes. It sets the orientation of the camera (user’s viewpoint) while in Panorama View.
|
|
4616
4679
|
|
|
4617
4680
|
*Function Signature*
|
|
@@ -4640,7 +4703,7 @@ cameraSetRotation(45, 15, 0.5)
|
|
|
4640
4703
|
});
|
|
4641
4704
|
```
|
|
4642
4705
|
|
|
4643
|
-
|
|
4706
|
+
### getViewMode()
|
|
4644
4707
|
|
|
4645
4708
|
Obtain the existing view mode of the Matterport scene using this function. The view mode illustrates the manner in which the scene is presented, which includes 3D walkthrough mode, dollhouse mode, or floor plan mode.
|
|
4646
4709
|
|
|
@@ -4657,7 +4720,7 @@ const currentViewMode = atwin.getViewMode();
|
|
|
4657
4720
|
console.log("Current view mode:", currentViewMode);
|
|
4658
4721
|
```
|
|
4659
4722
|
|
|
4660
|
-
|
|
4723
|
+
### setViewMode()
|
|
4661
4724
|
|
|
4662
4725
|
Change the current view mode of the 3D space scene to the designated mode using this function. The chosen view mode dictates the presentation style of the space, including options like 3D walkthrough mode, dollhouse mode, or floor plan mode.
|
|
4663
4726
|
|
|
@@ -4681,7 +4744,7 @@ async function changeToDollhouseMode() {
|
|
|
4681
4744
|
}
|
|
4682
4745
|
```
|
|
4683
4746
|
|
|
4684
|
-
|
|
4747
|
+
### cameraLookAt()
|
|
4685
4748
|
|
|
4686
4749
|
This function adjusts the camera's view to focus on a specific point in the Matterport scene. The point is defined in screen coordinates, where x and y represent the pixel coordinates from the upper-left corner of the screen.
|
|
4687
4750
|
|
|
@@ -4707,7 +4770,7 @@ async function focusOnPoint(x, y) {
|
|
|
4707
4770
|
|
|
4708
4771
|
```
|
|
4709
4772
|
|
|
4710
|
-
|
|
4773
|
+
### captureSpaceScreenshot()
|
|
4711
4774
|
|
|
4712
4775
|
This function takes a screenshot (JPEG) of the user’s current space view. It creates a temporary download link for the screenshot image with the filename 'image.png', and then triggers the download.
|
|
4713
4776
|
|
|
@@ -4752,7 +4815,7 @@ async function captureSpace() {
|
|
|
4752
4815
|
}
|
|
4753
4816
|
```
|
|
4754
4817
|
|
|
4755
|
-
|
|
4818
|
+
### captureScreenshotAndCameraDetails()
|
|
4756
4819
|
|
|
4757
4820
|
This function captures a screenshot of a virtual space and retrieves details about the camera's position and rotation at the time of the capture. It is designed to provide an easy way to get both a visual snapshot and the camera's state.
|
|
4758
4821
|
|
|
@@ -4807,9 +4870,9 @@ async function captureScreenshotAndCameraDetails() {
|
|
|
4807
4870
|
|
|
4808
4871
|
-----
|
|
4809
4872
|
|
|
4810
|
-
|
|
4873
|
+
## Objects
|
|
4811
4874
|
|
|
4812
|
-
|
|
4875
|
+
### getNearbyObjects()
|
|
4813
4876
|
The [getNearbyObjects()](#getnearbyobjects) method retrieves nearby rendered objects based on a given payload containing type and distance parameters. It calculates the distance between the camera position and the objects' positions and returns a categorized list of nearby objects.
|
|
4814
4877
|
|
|
4815
4878
|
*Function Signature*
|
|
@@ -4837,7 +4900,7 @@ const nearByObjects:NearbyObjects = atwin.getNearbyObjects(payload)
|
|
|
4837
4900
|
...
|
|
4838
4901
|
```
|
|
4839
4902
|
|
|
4840
|
-
|
|
4903
|
+
### addMediaScreen()
|
|
4841
4904
|
The [addMediaScreen()](#addmediascreen) method is asynchronous function allows you to add a media screen to the space. The media screen displays a media content specified by the mediaUrl parameter. You can customize the media screen's position, scale, and rotation using the transform parameter. Additional options such as readonly mode and autoplay can also be configured. This function logs information about the provided parameters and performs media handling.
|
|
4842
4905
|
|
|
4843
4906
|
*Function Signature*
|
|
@@ -4881,7 +4944,7 @@ awtwin.addMediaScreen(mediaUrl, transform, readonly, autoplay)
|
|
|
4881
4944
|
});
|
|
4882
4945
|
```
|
|
4883
4946
|
|
|
4884
|
-
|
|
4947
|
+
### setTransformMode()
|
|
4885
4948
|
The [setTransformMode()](#settransformmode) asynchronous void function sets the transform mode for a specific type of transformation. The mode parameter defines the transformation mode, which can be translation, rotation, or scaling.
|
|
4886
4949
|
|
|
4887
4950
|
*Function Signature*
|
|
@@ -4909,7 +4972,7 @@ atwin.setTransformMode(desiredMode)
|
|
|
4909
4972
|
});
|
|
4910
4973
|
```
|
|
4911
4974
|
|
|
4912
|
-
|
|
4975
|
+
### revertTransform()
|
|
4913
4976
|
The [revertTransform()](#reverttransform) function allows you to revert transformations applied to a selected object. The function retrieves previous or next transformation data from the history, applies it to the selected object, and updates the internal state.
|
|
4914
4977
|
|
|
4915
4978
|
*Function Signature*
|
|
@@ -4941,7 +5004,7 @@ if (atwin.revertTransform('redo')) {
|
|
|
4941
5004
|
}
|
|
4942
5005
|
```
|
|
4943
5006
|
|
|
4944
|
-
|
|
5007
|
+
### removeTransformControls()
|
|
4945
5008
|
|
|
4946
5009
|
Use this function to remove transformation controls and associated components from the scene. It stops the transformation control node and potentially cancels any input control component, if available. The function ensures that the transformation controls are properly removed to maintain the integrity of the scene.
|
|
4947
5010
|
|
|
@@ -4962,7 +5025,7 @@ import * as atwin from 'architwin'
|
|
|
4962
5025
|
atwin.removeTransformControls();
|
|
4963
5026
|
```
|
|
4964
5027
|
|
|
4965
|
-
|
|
5028
|
+
### setAnimationState()
|
|
4966
5029
|
This function is used to set the animation state of a specific model object in the scene. It allows you to play or stop the animation associated with the specified model using the provided action parameter. The function locates the animation state path corresponding to the given modelId and updates it accordingly.
|
|
4967
5030
|
|
|
4968
5031
|
*Function Signature*
|
|
@@ -4985,7 +5048,7 @@ const modelId = 123;
|
|
|
4985
5048
|
setAnimationState(action, modelId);
|
|
4986
5049
|
```
|
|
4987
5050
|
|
|
4988
|
-
|
|
5051
|
+
### showObjectDimensions()
|
|
4989
5052
|
|
|
4990
5053
|
Use this function to display the dimensions of a chosen object within a 3D space. The function computes the object's width, height, and depth through its bounding box and showcases this data as 3D text labels strategically positioned around the object.
|
|
4991
5054
|
|
|
@@ -5006,7 +5069,7 @@ import * as atwin from 'architwin'
|
|
|
5006
5069
|
atwin.showObjectDimensions(selectedObject)
|
|
5007
5070
|
```
|
|
5008
5071
|
|
|
5009
|
-
|
|
5072
|
+
### copyObject()
|
|
5010
5073
|
|
|
5011
5074
|
Generate a duplicate of a showcase object asynchronously, with the option to include positional and rotational offsets. The function generates a fresh ID for the duplicated object, applies provided positional and rotational adjustments, and integrates the object into the scene.
|
|
5012
5075
|
|
|
@@ -5043,7 +5106,7 @@ atwin.copyObject(objectToCopy, positionOffset, rotationOffset)
|
|
|
5043
5106
|
});
|
|
5044
5107
|
```
|
|
5045
5108
|
|
|
5046
|
-
|
|
5109
|
+
### deleteObject()
|
|
5047
5110
|
|
|
5048
5111
|
Use asynchronous function to delete an existing 3D object. The deletion target is determined by the `id` parameter value.
|
|
5049
5112
|
|
|
@@ -5071,7 +5134,7 @@ atwin.deleteObject(objectId)
|
|
|
5071
5134
|
});
|
|
5072
5135
|
```
|
|
5073
5136
|
|
|
5074
|
-
|
|
5137
|
+
### deleteObjectFromSpace()
|
|
5075
5138
|
|
|
5076
5139
|
To remove a designated object from a 3D space use [deleteObjectFromSpace()](#deleteobjectfromspace). Provide an `IObjectData` object as input, and the function will eliminate the object from the scene. Additionally, it undertakes essential cleanup tasks like halting animations and removing linked markup elements.
|
|
5077
5140
|
|
|
@@ -5099,7 +5162,7 @@ atwin.deleteObjectFromSpace(targetObject)
|
|
|
5099
5162
|
});
|
|
5100
5163
|
```
|
|
5101
5164
|
|
|
5102
|
-
|
|
5165
|
+
### replaceObject()
|
|
5103
5166
|
|
|
5104
5167
|
To replace a particular object within a 3D space with a fresh one use [replaceObject()](#replaceobject) method. Provide an `I3DObject` payload for the new object, an IObjectData target for the object to be replaced, and optional configuration choices. The function eliminates the target object from the scene and introduces the new object in its designated position.
|
|
5105
5168
|
|
|
@@ -5131,7 +5194,7 @@ atwin.replaceObject(newObjectPayload, targetObject, replacementOptions)
|
|
|
5131
5194
|
console.error('Error replacing object:', error);
|
|
5132
5195
|
});
|
|
5133
5196
|
```
|
|
5134
|
-
|
|
5197
|
+
### addTextMarkupScreen()
|
|
5135
5198
|
|
|
5136
5199
|
To introduce a text markup screen into the 3D space use the [addTextMarkupScreen()](#addtextmarkupscreen) method. The function generates a 3D object based on the supplied title and message. The screen's placement, scaling, and rotation align with the designated transformation parameters.
|
|
5137
5200
|
|
|
@@ -5162,7 +5225,7 @@ async function addTextMarkupScreen(
|
|
|
5162
5225
|
import * as atwin from 'architwin'
|
|
5163
5226
|
```
|
|
5164
5227
|
|
|
5165
|
-
|
|
5228
|
+
### setTextMarkupScreenContent()
|
|
5166
5229
|
|
|
5167
5230
|
To set the content of a text markup screen within a 3D space use the [setTextMarkupScreenContent()](#settextmarkupscreencontent). The function modifies multiple properties of the screen, including its title, text content, text color, and background color.
|
|
5168
5231
|
|
|
@@ -6545,4 +6608,1920 @@ await atwin.toggleViewpointVisibility()
|
|
|
6545
6608
|
const ids = [012345, 6789,]
|
|
6546
6609
|
|
|
6547
6610
|
await atwin.toggleViewpointVisibility(ids)
|
|
6548
|
-
````
|
|
6611
|
+
````
|
|
6612
|
+
|
|
6613
|
+
## Draw Polygon and Path Methods
|
|
6614
|
+
|
|
6615
|
+
Draw polygon functions enable users to interactively draw polygons inside 3D space to define custom room boundaries, partitions, and spatial zones. This is useful for creating custom floor plans, marking restricted areas, setting up room divisions, or defining zones with specific properties. Users can click points in the 3D space to create vertices, and the system will connect them to form a closed polygon or a linear tubular path. Enclosed polygons will additionally display measurement details such as the length and area the polygon occupies. These functions allow developers to perform creating, editing, validating, and managing polygon geometry either via user input or programmatically.
|
|
6616
|
+
|
|
6617
|
+
<!-- ### drawPath()
|
|
6618
|
+
|
|
6619
|
+
Draws a semi transparent tube line along a path.
|
|
6620
|
+
@deprecated - Use renderPath instead to render a path and setPathLine to update an existing path
|
|
6621
|
+
|
|
6622
|
+
*Function Signature*
|
|
6623
|
+
```typescript
|
|
6624
|
+
async function drawPath(vertices: Array<Vector3>, options?: ComponentOptions): Promise<void>
|
|
6625
|
+
```
|
|
6626
|
+
|
|
6627
|
+
*Parameter Table*
|
|
6628
|
+
| parameter | type | required | default | values |
|
|
6629
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6630
|
+
| vertices | Array<Vector3> | yes | | Array of coordinates or vertices |
|
|
6631
|
+
| options | ComponentOptions | optional | | |
|
|
6632
|
+
|
|
6633
|
+
*Example:*
|
|
6634
|
+
```typescript
|
|
6635
|
+
import * as atwin from 'architwin'
|
|
6636
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
6637
|
+
|
|
6638
|
+
const pathVertices = [
|
|
6639
|
+
new Vector3(0, 0, 0),
|
|
6640
|
+
new Vector3(5, 0, 0),
|
|
6641
|
+
new Vector3(5, 5, 0)
|
|
6642
|
+
]
|
|
6643
|
+
|
|
6644
|
+
await atwin.drawPath(pathVertices)
|
|
6645
|
+
```
|
|
6646
|
+
-->
|
|
6647
|
+
|
|
6648
|
+
### toggleSpaceNavigation()
|
|
6649
|
+
|
|
6650
|
+
Toggle space navigation on/off to enable or disable user navigation within the 3D space.
|
|
6651
|
+
|
|
6652
|
+
*Function Signature*
|
|
6653
|
+
```typescript
|
|
6654
|
+
function toggleSpaceNavigation(state: boolean = true): void
|
|
6655
|
+
```
|
|
6656
|
+
|
|
6657
|
+
*Parameter Table*
|
|
6658
|
+
| parameter | type | required | default | values |
|
|
6659
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6660
|
+
| state | boolean | optional | true | true to enable navigation, false to disable |
|
|
6661
|
+
|
|
6662
|
+
*Example:*
|
|
6663
|
+
```typescript
|
|
6664
|
+
import * as atwin from 'architwin'
|
|
6665
|
+
|
|
6666
|
+
// Disable space navigation
|
|
6667
|
+
atwin.toggleSpaceNavigation(false)
|
|
6668
|
+
|
|
6669
|
+
// Enable space navigation
|
|
6670
|
+
atwin.toggleSpaceNavigation(true)
|
|
6671
|
+
```
|
|
6672
|
+
|
|
6673
|
+
### startDraw()
|
|
6674
|
+
|
|
6675
|
+
Begin drawing mode in the space. This disables certain features (measurements, space search, mattertags) while drawing is active.
|
|
6676
|
+
|
|
6677
|
+
*Function Signature*
|
|
6678
|
+
```typescript
|
|
6679
|
+
function startDraw(config?: PathConfig): void
|
|
6680
|
+
```
|
|
6681
|
+
|
|
6682
|
+
*Parameter Table*
|
|
6683
|
+
| parameter | type | required | default | values |
|
|
6684
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6685
|
+
| config | PathConfig | optional | undefined | Configuration for line type, vertice type, and component options |
|
|
6686
|
+
|
|
6687
|
+
*Example:*
|
|
6688
|
+
```typescript
|
|
6689
|
+
import * as atwin from 'architwin'
|
|
6690
|
+
|
|
6691
|
+
// Start drawing with default config
|
|
6692
|
+
atwin.startDraw()
|
|
6693
|
+
|
|
6694
|
+
// Start drawing with custom config
|
|
6695
|
+
const config = {
|
|
6696
|
+
lineType: 'tubeLineType',
|
|
6697
|
+
verticeType: 'verticeType'
|
|
6698
|
+
}
|
|
6699
|
+
atwin.startDraw(config)
|
|
6700
|
+
```
|
|
6701
|
+
|
|
6702
|
+
### exitDraw()
|
|
6703
|
+
|
|
6704
|
+
Exit drawing mode in the space. This re-enables features that were disabled during drawing (measurements, space search, mattertags).
|
|
6705
|
+
|
|
6706
|
+
*Function Signature*
|
|
6707
|
+
```typescript
|
|
6708
|
+
function exitDraw(): void
|
|
6709
|
+
```
|
|
6710
|
+
|
|
6711
|
+
*Example:*
|
|
6712
|
+
```typescript
|
|
6713
|
+
import * as atwin from 'architwin'
|
|
6714
|
+
|
|
6715
|
+
// Exit drawing mode
|
|
6716
|
+
atwin.exitDraw()
|
|
6717
|
+
```
|
|
6718
|
+
|
|
6719
|
+
### cancelDraw()
|
|
6720
|
+
|
|
6721
|
+
Cancel the current drawing operation and exit drawing mode. This also clears the history for pipe or room creation tools.
|
|
6722
|
+
|
|
6723
|
+
*Function Signature*
|
|
6724
|
+
```typescript
|
|
6725
|
+
function cancelDraw(): void
|
|
6726
|
+
```
|
|
6727
|
+
|
|
6728
|
+
*Example:*
|
|
6729
|
+
```typescript
|
|
6730
|
+
import * as atwin from 'architwin'
|
|
6731
|
+
|
|
6732
|
+
// Cancel current drawing
|
|
6733
|
+
atwin.cancelDraw()
|
|
6734
|
+
```
|
|
6735
|
+
|
|
6736
|
+
### setPolygonPath()
|
|
6737
|
+
|
|
6738
|
+
Updates the polygons by passing a new array of vertices. Do note that any vertex markers visible will not automatically update their position.
|
|
6739
|
+
|
|
6740
|
+
*Function Signature*
|
|
6741
|
+
```typescript
|
|
6742
|
+
function setPolygonPath(id: number, vertices: Array<Vector3>): void
|
|
6743
|
+
```
|
|
6744
|
+
|
|
6745
|
+
*Parameter Table*
|
|
6746
|
+
| parameter | type | required | default | values |
|
|
6747
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6748
|
+
| id | number | yes | | id of the polygon object |
|
|
6749
|
+
| vertices | Array<Vector3> | yes | | array of vertices that are used to render the geometry of the polygon |
|
|
6750
|
+
|
|
6751
|
+
*Example:*
|
|
6752
|
+
```typescript
|
|
6753
|
+
import * as atwin from 'architwin'
|
|
6754
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
6755
|
+
|
|
6756
|
+
const polygonId = 123
|
|
6757
|
+
const newVertices = [
|
|
6758
|
+
new Vector3(0, 0, 0),
|
|
6759
|
+
new Vector3(10, 0, 0),
|
|
6760
|
+
new Vector3(10, 10, 0),
|
|
6761
|
+
new Vector3(0, 10, 0)
|
|
6762
|
+
]
|
|
6763
|
+
|
|
6764
|
+
atwin.setPolygonPath(polygonId, newVertices)
|
|
6765
|
+
```
|
|
6766
|
+
|
|
6767
|
+
### setPolygonDrawingMode()
|
|
6768
|
+
|
|
6769
|
+
Updates the drawing mode of a polygon loader. Drawing supports two modes, `floor` which is the default and `window`. If drawing mode is set to `floor`, this will allow the user to draw a set of points inside the 3D space and render a flat horizontal polygon shape on the floor, each edge of the polygon in this mode with have vertical polygon forming a wall that when combined together completes the enclosed polygon. If mode is set to `window`, the user will be able to draw polygon shapes vertically, the vertical polygon shapes rendered in this mode will not render any additional shapes on its edges like floor mode does.
|
|
6770
|
+
|
|
6771
|
+
*Function Signature*
|
|
6772
|
+
```typescript
|
|
6773
|
+
function setPolygonDrawingMode(id: number, mode: string): void
|
|
6774
|
+
```
|
|
6775
|
+
|
|
6776
|
+
*Parameter Table*
|
|
6777
|
+
| parameter | type | required | default | values |
|
|
6778
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6779
|
+
| id | number | yes | | id of the polygon object |
|
|
6780
|
+
| mode | string | yes | floor | floor or window |
|
|
6781
|
+
|
|
6782
|
+
*Example:*
|
|
6783
|
+
```typescript
|
|
6784
|
+
import * as atwin from 'architwin'
|
|
6785
|
+
|
|
6786
|
+
const polygonId = 123
|
|
6787
|
+
|
|
6788
|
+
// Set polygon to floor mode
|
|
6789
|
+
atwin.setPolygonDrawingMode(polygonId, 'floor')
|
|
6790
|
+
|
|
6791
|
+
// Set polygon to window drawing mode
|
|
6792
|
+
atwin.setPolygonDrawingMode(polygonId, 'window')
|
|
6793
|
+
```
|
|
6794
|
+
|
|
6795
|
+
### setPathLine()
|
|
6796
|
+
|
|
6797
|
+
Update the path of an existing path created by `renderPath` by setting the new vertices of the path line.
|
|
6798
|
+
|
|
6799
|
+
*Function Signature*
|
|
6800
|
+
```typescript
|
|
6801
|
+
function setPathLine(id: number, path: Array<Vector3>): void
|
|
6802
|
+
```
|
|
6803
|
+
|
|
6804
|
+
*Parameter Table*
|
|
6805
|
+
| parameter | type | required | default | values |
|
|
6806
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6807
|
+
| id | number | yes | | id of the object/path |
|
|
6808
|
+
| path | Array<Vector3> | yes | | array of xyz coordinates |
|
|
6809
|
+
|
|
6810
|
+
*Example:*
|
|
6811
|
+
```typescript
|
|
6812
|
+
import * as atwin from 'architwin'
|
|
6813
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
6814
|
+
|
|
6815
|
+
const pathId = 456
|
|
6816
|
+
const newPath = [
|
|
6817
|
+
new Vector3(1, 0, 0),
|
|
6818
|
+
new Vector3(6, 0, 0),
|
|
6819
|
+
new Vector3(6, 6, 0)
|
|
6820
|
+
]
|
|
6821
|
+
|
|
6822
|
+
atwin.setPathLine(pathId, newPath)
|
|
6823
|
+
```
|
|
6824
|
+
|
|
6825
|
+
### setPathLineOptions()
|
|
6826
|
+
|
|
6827
|
+
Update the inputs of a rendered path line.
|
|
6828
|
+
|
|
6829
|
+
*Function Signature*
|
|
6830
|
+
```typescript
|
|
6831
|
+
function setPathLineOptions(id: number, options: ComponentOptions): void
|
|
6832
|
+
```
|
|
6833
|
+
|
|
6834
|
+
*Parameter Table*
|
|
6835
|
+
| parameter | type | required | default | values |
|
|
6836
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6837
|
+
| id | number | yes | | id of the object/path |
|
|
6838
|
+
| options | ComponentOptions | yes | | keys you want to update, you should only populate keys that you explicitly wanted to update |
|
|
6839
|
+
|
|
6840
|
+
*Example:*
|
|
6841
|
+
```typescript
|
|
6842
|
+
import * as atwin from 'architwin'
|
|
6843
|
+
|
|
6844
|
+
const pathId = 456
|
|
6845
|
+
const pathOptions = {
|
|
6846
|
+
visible: true,
|
|
6847
|
+
color: '#0000FF',
|
|
6848
|
+
width: 2
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
atwin.setPathLineOptions(pathId, pathOptions)
|
|
6852
|
+
```
|
|
6853
|
+
|
|
6854
|
+
### getCurrentTubeLine()
|
|
6855
|
+
|
|
6856
|
+
Returns the current tube line and data instance.
|
|
6857
|
+
|
|
6858
|
+
*Function Signature*
|
|
6859
|
+
```typescript
|
|
6860
|
+
function getCurrentTubeLine(): IObjectData | undefined
|
|
6861
|
+
```
|
|
6862
|
+
|
|
6863
|
+
*Example:*
|
|
6864
|
+
```typescript
|
|
6865
|
+
import * as atwin from 'architwin'
|
|
6866
|
+
|
|
6867
|
+
const currentTubeLine = atwin.getCurrentTubeLine()
|
|
6868
|
+
|
|
6869
|
+
if (currentTubeLine) {
|
|
6870
|
+
console.log('Current tube line ID:', currentTubeLine.object.id)
|
|
6871
|
+
console.log('Current tube line object:', currentTubeLine)
|
|
6872
|
+
}
|
|
6873
|
+
```
|
|
6874
|
+
|
|
6875
|
+
### renderPolygon()
|
|
6876
|
+
|
|
6877
|
+
Renders a polygon from an array of coordinates or an object containing an array of coordinates.
|
|
6878
|
+
|
|
6879
|
+
*Function Signature*
|
|
6880
|
+
```typescript
|
|
6881
|
+
function renderPolygon(payload: PartitionPayload | Array<Vector3>, options?: ComponentOptions): void
|
|
6882
|
+
```
|
|
6883
|
+
|
|
6884
|
+
*Parameter Table*
|
|
6885
|
+
| parameter | type | required | default | values |
|
|
6886
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6887
|
+
| payload | PartitionPayload \| Array<Vector3> | yes | | PartitionPayload or array of xyz coordinates |
|
|
6888
|
+
| options | ComponentOptions | optional | | customization options to dictate the look and behavior of the polygon |
|
|
6889
|
+
|
|
6890
|
+
*Example:*
|
|
6891
|
+
```typescript
|
|
6892
|
+
import * as atwin from 'architwin'
|
|
6893
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
6894
|
+
|
|
6895
|
+
const vertices = [
|
|
6896
|
+
new Vector3(0, 0, 0),
|
|
6897
|
+
new Vector3(10, 0, 0),
|
|
6898
|
+
new Vector3(10, 10, 0),
|
|
6899
|
+
new Vector3(0, 10, 0)
|
|
6900
|
+
]
|
|
6901
|
+
|
|
6902
|
+
const options = {
|
|
6903
|
+
visible: true,
|
|
6904
|
+
color: '#FF0000'
|
|
6905
|
+
}
|
|
6906
|
+
|
|
6907
|
+
atwin.renderPolygon(vertices, options)
|
|
6908
|
+
```
|
|
6909
|
+
|
|
6910
|
+
### toggleWallVisibility()
|
|
6911
|
+
|
|
6912
|
+
Wrapper function around toggleMeshChildrenVisibility that also toggles associated wall label visibility.
|
|
6913
|
+
|
|
6914
|
+
*Function Signature*
|
|
6915
|
+
```typescript
|
|
6916
|
+
function toggleWallVisibility(component: MpSdk.Scene.IComponent, name: string, visible?: boolean): boolean
|
|
6917
|
+
```
|
|
6918
|
+
|
|
6919
|
+
*Parameter Table*
|
|
6920
|
+
| parameter | type | required | default | values |
|
|
6921
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6922
|
+
| component | MpSdk.Scene.IComponent | yes | | Component of the model |
|
|
6923
|
+
| name | string | yes | | name of the model |
|
|
6924
|
+
| visible | boolean | optional | undefined | true to show, false to hide, undefined to toggle |
|
|
6925
|
+
|
|
6926
|
+
*Example:*
|
|
6927
|
+
```typescript
|
|
6928
|
+
import * as atwin from 'architwin'
|
|
6929
|
+
|
|
6930
|
+
const component = atwin.selectedObject?.component
|
|
6931
|
+
const wallName = 'wall_001'
|
|
6932
|
+
|
|
6933
|
+
// Toggle wall visibility
|
|
6934
|
+
if (component) {
|
|
6935
|
+
atwin.toggleWallVisibility(component, wallName)
|
|
6936
|
+
|
|
6937
|
+
// Show wall
|
|
6938
|
+
atwin.toggleWallVisibility(component, wallName, true)
|
|
6939
|
+
}
|
|
6940
|
+
```
|
|
6941
|
+
|
|
6942
|
+
### toggleMeshChildrenVisibility()
|
|
6943
|
+
|
|
6944
|
+
Toggles the visibility of the children of a mesh.
|
|
6945
|
+
|
|
6946
|
+
*Function Signature*
|
|
6947
|
+
```typescript
|
|
6948
|
+
function toggleMeshChildrenVisibility(component: MpSdk.Scene.IComponent, name: string, visible?: boolean): boolean
|
|
6949
|
+
```
|
|
6950
|
+
|
|
6951
|
+
*Parameter Table*
|
|
6952
|
+
| parameter | type | required | default | values |
|
|
6953
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6954
|
+
| component | MpSdk.Scene.IComponent | yes | | Component of the model |
|
|
6955
|
+
| name | string | yes | | name of the model |
|
|
6956
|
+
| visible | boolean | optional | undefined | true to show, false to hide, undefined to toggle |
|
|
6957
|
+
|
|
6958
|
+
*Example:*
|
|
6959
|
+
```typescript
|
|
6960
|
+
import * as atwin from 'architwin'
|
|
6961
|
+
|
|
6962
|
+
const component = atwin.selectedObject?.component
|
|
6963
|
+
const childName = 'mesh_child_001'
|
|
6964
|
+
|
|
6965
|
+
// Toggle mesh children visibility
|
|
6966
|
+
if (component) {
|
|
6967
|
+
atwin.toggleMeshChildrenVisibility(component, childName)
|
|
6968
|
+
|
|
6969
|
+
// Show mesh children
|
|
6970
|
+
atwin.toggleMeshChildrenVisibility(component, childName, true)
|
|
6971
|
+
}
|
|
6972
|
+
```
|
|
6973
|
+
|
|
6974
|
+
### toggleFloorVisibility()
|
|
6975
|
+
|
|
6976
|
+
Wrapper function around toggleMeshChildrenVisibility that also toggles associated edge labels.
|
|
6977
|
+
|
|
6978
|
+
*Function Signature*
|
|
6979
|
+
```typescript
|
|
6980
|
+
function toggleFloorVisibility(component: MpSdk.Scene.IComponent, name: string, visible?: boolean): boolean
|
|
6981
|
+
```
|
|
6982
|
+
|
|
6983
|
+
*Parameter Table*
|
|
6984
|
+
| parameter | type | required | default | values |
|
|
6985
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
6986
|
+
| component | MpSdk.Scene.IComponent | yes | | Component of the model |
|
|
6987
|
+
| name | string | yes | | name of the model |
|
|
6988
|
+
| visible | boolean | optional | undefined | true to show, false to hide, undefined to toggle |
|
|
6989
|
+
|
|
6990
|
+
*Example:*
|
|
6991
|
+
```typescript
|
|
6992
|
+
import * as atwin from 'architwin'
|
|
6993
|
+
|
|
6994
|
+
const component = atwin.selectedObject?.component
|
|
6995
|
+
const floorName = 'floor_001'
|
|
6996
|
+
|
|
6997
|
+
// Toggle floor visibility
|
|
6998
|
+
if (component) {
|
|
6999
|
+
atwin.toggleFloorVisibility(component, floorName)
|
|
7000
|
+
|
|
7001
|
+
// Hide floor
|
|
7002
|
+
atwin.toggleFloorVisibility(component, floorName, false)
|
|
7003
|
+
}
|
|
7004
|
+
```
|
|
7005
|
+
|
|
7006
|
+
### getChildrenOfModel()
|
|
7007
|
+
|
|
7008
|
+
Returns the children of a model's component.
|
|
7009
|
+
|
|
7010
|
+
*Function Signature*
|
|
7011
|
+
```typescript
|
|
7012
|
+
function getChildrenOfModel(component: MpSdk.Scene.IComponent): Array<any>
|
|
7013
|
+
```
|
|
7014
|
+
|
|
7015
|
+
*Parameter Table*
|
|
7016
|
+
| parameter | type | required | default | values |
|
|
7017
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7018
|
+
| component | MpSdk.Scene.IComponent | yes | | Component of the model |
|
|
7019
|
+
|
|
7020
|
+
*Example:*
|
|
7021
|
+
```typescript
|
|
7022
|
+
import * as atwin from 'architwin'
|
|
7023
|
+
|
|
7024
|
+
const component = atwin.selectedObject?.component
|
|
7025
|
+
|
|
7026
|
+
if (component) {
|
|
7027
|
+
const children = atwin.getChildrenOfModel(component)
|
|
7028
|
+
|
|
7029
|
+
if (children && children.length > 0) {
|
|
7030
|
+
console.log('Model has', children.length, 'child elements')
|
|
7031
|
+
children.forEach(child => console.log(child.name))
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
7034
|
+
```
|
|
7035
|
+
|
|
7036
|
+
### toggleVerticeRingVisibility()
|
|
7037
|
+
|
|
7038
|
+
During edit mode when drawing a path or polygon and you switch to a different view such as floor plan mode in the Matterport space, you may sometimes find it hard to see the vertice markers. You can use this method to toggle the visibility of a red circular marker on each vertice to make it easier to spot. By default, these vertice rings are hidden.
|
|
7039
|
+
|
|
7040
|
+
*Function Signature*
|
|
7041
|
+
```typescript
|
|
7042
|
+
function toggleVerticeRingVisibility(visibility?: boolean): void
|
|
7043
|
+
```
|
|
7044
|
+
|
|
7045
|
+
*Parameter Table*
|
|
7046
|
+
| parameter | type | required | default | values |
|
|
7047
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7048
|
+
| visibility | boolean | optional | false | Default is false |
|
|
7049
|
+
|
|
7050
|
+
*Example:*
|
|
7051
|
+
```typescript
|
|
7052
|
+
import * as atwin from 'architwin'
|
|
7053
|
+
|
|
7054
|
+
// Hide vertex rings
|
|
7055
|
+
atwin.toggleVerticeRingVisibility(false)
|
|
7056
|
+
|
|
7057
|
+
// Show vertex rings
|
|
7058
|
+
atwin.toggleVerticeRingVisibility(true)
|
|
7059
|
+
```
|
|
7060
|
+
|
|
7061
|
+
### setPolygonFloorOffset()
|
|
7062
|
+
|
|
7063
|
+
Sets the global offset value of the y axis of a rendered polygon.
|
|
7064
|
+
|
|
7065
|
+
*Function Signature*
|
|
7066
|
+
```typescript
|
|
7067
|
+
function setPolygonFloorOffset(offset: number): void
|
|
7068
|
+
```
|
|
7069
|
+
|
|
7070
|
+
*Parameter Table*
|
|
7071
|
+
| parameter | type | required | default | values |
|
|
7072
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7073
|
+
| offset | number | yes | | vertical offset value in meters |
|
|
7074
|
+
|
|
7075
|
+
*Example:*
|
|
7076
|
+
```typescript
|
|
7077
|
+
import * as atwin from 'architwin'
|
|
7078
|
+
|
|
7079
|
+
// Set polygon offset to 2 meters above floor
|
|
7080
|
+
atwin.setPolygonFloorOffset(2.0)
|
|
7081
|
+
```
|
|
7082
|
+
|
|
7083
|
+
### getPolygonFloorOffset()
|
|
7084
|
+
|
|
7085
|
+
Returns the value of the global floor offset.
|
|
7086
|
+
|
|
7087
|
+
*Function Signature*
|
|
7088
|
+
```typescript
|
|
7089
|
+
function getPolygonFloorOffset(): number
|
|
7090
|
+
```
|
|
7091
|
+
|
|
7092
|
+
*Example:*
|
|
7093
|
+
```typescript
|
|
7094
|
+
import * as atwin from 'architwin'
|
|
7095
|
+
|
|
7096
|
+
const polygonOffset = atwin.getPolygonFloorOffset()
|
|
7097
|
+
console.log('Current polygon floor offset:', polygonOffset)
|
|
7098
|
+
```
|
|
7099
|
+
|
|
7100
|
+
### setFloorBaseHeight()
|
|
7101
|
+
|
|
7102
|
+
Set the value of the base height or y-axis of the vertex of a polygon.
|
|
7103
|
+
|
|
7104
|
+
*Function Signature*
|
|
7105
|
+
```typescript
|
|
7106
|
+
function setFloorBaseHeight(baseHeight: number): void
|
|
7107
|
+
```
|
|
7108
|
+
|
|
7109
|
+
*Parameter Table*
|
|
7110
|
+
| parameter | type | required | default | values |
|
|
7111
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7112
|
+
| baseHeight | number | yes | | base height reference value |
|
|
7113
|
+
|
|
7114
|
+
*Example:*
|
|
7115
|
+
```typescript
|
|
7116
|
+
import * as atwin from 'architwin'
|
|
7117
|
+
|
|
7118
|
+
// Set floor base height to 0.5 meters
|
|
7119
|
+
atwin.setFloorBaseHeight(0.5)
|
|
7120
|
+
```
|
|
7121
|
+
|
|
7122
|
+
### clearFloorBaseHeight()
|
|
7123
|
+
|
|
7124
|
+
Clear the value of the base height for floors of polygons.
|
|
7125
|
+
|
|
7126
|
+
*Function Signature*
|
|
7127
|
+
```typescript
|
|
7128
|
+
function clearFloorBaseHeight(): void
|
|
7129
|
+
```
|
|
7130
|
+
|
|
7131
|
+
*Example:*
|
|
7132
|
+
```typescript
|
|
7133
|
+
import * as atwin from 'architwin'
|
|
7134
|
+
|
|
7135
|
+
// Clear the floor base height
|
|
7136
|
+
atwin.clearFloorBaseHeight()
|
|
7137
|
+
```
|
|
7138
|
+
|
|
7139
|
+
### enableVerticeControls()
|
|
7140
|
+
|
|
7141
|
+
Enable vertex controls for polygon editing. This allows users to manipulate vertices of the polygon.
|
|
7142
|
+
|
|
7143
|
+
*Function Signature*
|
|
7144
|
+
```typescript
|
|
7145
|
+
function enableVerticeControls(component: MpSdk.Scene.IComponent): void
|
|
7146
|
+
```
|
|
7147
|
+
|
|
7148
|
+
*Parameter Table*
|
|
7149
|
+
| parameter | type | required | default | values |
|
|
7150
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7151
|
+
| component | MpSdk.Scene.IComponent | yes | | Component of the model |
|
|
7152
|
+
|
|
7153
|
+
*Example:*
|
|
7154
|
+
```typescript
|
|
7155
|
+
import * as atwin from 'architwin'
|
|
7156
|
+
|
|
7157
|
+
const component = atwin.selectedObject?.component
|
|
7158
|
+
|
|
7159
|
+
if (component) {
|
|
7160
|
+
atwin.enableVerticeControls(component)
|
|
7161
|
+
}
|
|
7162
|
+
```
|
|
7163
|
+
|
|
7164
|
+
<!-- ### deleteEdge()
|
|
7165
|
+
|
|
7166
|
+
Deletes the edge of a polygon.
|
|
7167
|
+
|
|
7168
|
+
*Function Signature*
|
|
7169
|
+
```typescript
|
|
7170
|
+
function deleteEdge(component: MpSdk.Scene.IComponent, endPoint: Vector3): void
|
|
7171
|
+
```
|
|
7172
|
+
|
|
7173
|
+
*Parameter Table*
|
|
7174
|
+
| parameter | type | required | default | values |
|
|
7175
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7176
|
+
| component | MpSdk.Scene.IComponent | yes | | The component of the polygon instance |
|
|
7177
|
+
| endPoint | Vector3 | yes | | Endpoint of the edge to be deleted |
|
|
7178
|
+
|
|
7179
|
+
*Example:*
|
|
7180
|
+
```typescript
|
|
7181
|
+
import * as atwin from 'architwin'
|
|
7182
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
7183
|
+
|
|
7184
|
+
const component = atwin.selectedObject?.component
|
|
7185
|
+
const edgeEndpoint = new Vector3(10, 0, 0)
|
|
7186
|
+
|
|
7187
|
+
if (component) {
|
|
7188
|
+
atwin.deleteEdge(component, edgeEndpoint)
|
|
7189
|
+
}
|
|
7190
|
+
```
|
|
7191
|
+
-->
|
|
7192
|
+
|
|
7193
|
+
|
|
7194
|
+
### disposePathLine()
|
|
7195
|
+
|
|
7196
|
+
Destroys the current path line instance.
|
|
7197
|
+
|
|
7198
|
+
*Function Signature*
|
|
7199
|
+
```typescript
|
|
7200
|
+
function disposePathLine(): void
|
|
7201
|
+
```
|
|
7202
|
+
|
|
7203
|
+
*Example:*
|
|
7204
|
+
```typescript
|
|
7205
|
+
import * as atwin from 'architwin'
|
|
7206
|
+
|
|
7207
|
+
// Dispose of current path line
|
|
7208
|
+
atwin.disposePathLine()
|
|
7209
|
+
```
|
|
7210
|
+
|
|
7211
|
+
### getFloorBaseHeight()
|
|
7212
|
+
|
|
7213
|
+
Returns the value of the global base height.
|
|
7214
|
+
|
|
7215
|
+
*Function Signature*
|
|
7216
|
+
```typescript
|
|
7217
|
+
function getFloorBaseHeight(): number
|
|
7218
|
+
```
|
|
7219
|
+
|
|
7220
|
+
*Example:*
|
|
7221
|
+
```typescript
|
|
7222
|
+
import * as atwin from 'architwin'
|
|
7223
|
+
|
|
7224
|
+
const floorHeight = atwin.getFloorBaseHeight()
|
|
7225
|
+
console.log('Current floor base height:', floorHeight)
|
|
7226
|
+
```
|
|
7227
|
+
|
|
7228
|
+
### setMeshChildrenMaterialProperty()
|
|
7229
|
+
|
|
7230
|
+
Updates the value of a property of a child of the mesh.
|
|
7231
|
+
|
|
7232
|
+
*Function Signature*
|
|
7233
|
+
```typescript
|
|
7234
|
+
function setMeshChildrenMaterialProperty(component: MpSdk.Scene.IComponent, name: string, key: string, value: any): void
|
|
7235
|
+
```
|
|
7236
|
+
|
|
7237
|
+
*Parameter Table*
|
|
7238
|
+
| parameter | type | required | default | values |
|
|
7239
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7240
|
+
| component | MpSdk.Scene.IComponent | yes | | Component of the model |
|
|
7241
|
+
| name | string | yes | | name of the model |
|
|
7242
|
+
| key | string | yes | | property key |
|
|
7243
|
+
| value | any | yes | | value for the property |
|
|
7244
|
+
|
|
7245
|
+
*Example:*
|
|
7246
|
+
```typescript
|
|
7247
|
+
import * as atwin from 'architwin'
|
|
7248
|
+
|
|
7249
|
+
const component = atwin.selectedObject?.component
|
|
7250
|
+
const meshName = 'mesh_child_001'
|
|
7251
|
+
const propertyKey = 'color'
|
|
7252
|
+
const colorValue = '#FF0000'
|
|
7253
|
+
|
|
7254
|
+
if (component) {
|
|
7255
|
+
atwin.setMeshChildrenMaterialProperty(component, meshName, propertyKey, colorValue)
|
|
7256
|
+
}
|
|
7257
|
+
```
|
|
7258
|
+
|
|
7259
|
+
### undoDrawAction()
|
|
7260
|
+
|
|
7261
|
+
Undo the last drawing action.
|
|
7262
|
+
|
|
7263
|
+
*Function Signature*
|
|
7264
|
+
```typescript
|
|
7265
|
+
function undoDrawAction(): void
|
|
7266
|
+
```
|
|
7267
|
+
|
|
7268
|
+
*Example:*
|
|
7269
|
+
```typescript
|
|
7270
|
+
import * as atwin from 'architwin'
|
|
7271
|
+
|
|
7272
|
+
// Undo the last drawing action
|
|
7273
|
+
atwin.undoDrawAction()
|
|
7274
|
+
```
|
|
7275
|
+
|
|
7276
|
+
### redoDrawAction()
|
|
7277
|
+
|
|
7278
|
+
Redo the last undone drawing action.
|
|
7279
|
+
|
|
7280
|
+
*Function Signature*
|
|
7281
|
+
```typescript
|
|
7282
|
+
function redoDrawAction(): void
|
|
7283
|
+
```
|
|
7284
|
+
|
|
7285
|
+
*Example:*
|
|
7286
|
+
```typescript
|
|
7287
|
+
import * as atwin from 'architwin'
|
|
7288
|
+
|
|
7289
|
+
// Redo the last undone drawing action
|
|
7290
|
+
atwin.redoDrawAction()
|
|
7291
|
+
```
|
|
7292
|
+
|
|
7293
|
+
### setWallBaseHeight()
|
|
7294
|
+
|
|
7295
|
+
Set the value of the base height or y-axis of the vertex of a polygon.
|
|
7296
|
+
|
|
7297
|
+
*Function Signature*
|
|
7298
|
+
```typescript
|
|
7299
|
+
function setWallBaseHeight(baseHeight: number): void
|
|
7300
|
+
```
|
|
7301
|
+
|
|
7302
|
+
*Parameter Table*
|
|
7303
|
+
| parameter | type | required | default | values |
|
|
7304
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7305
|
+
| baseHeight | number | yes | | base height reference value |
|
|
7306
|
+
|
|
7307
|
+
*Example:*
|
|
7308
|
+
```typescript
|
|
7309
|
+
import * as atwin from 'architwin'
|
|
7310
|
+
|
|
7311
|
+
// Set wall base height to 3 meters
|
|
7312
|
+
atwin.setWallBaseHeight(3.0)
|
|
7313
|
+
```
|
|
7314
|
+
|
|
7315
|
+
### getWallBaseHeight()
|
|
7316
|
+
|
|
7317
|
+
Returns the value of the global base height.
|
|
7318
|
+
|
|
7319
|
+
*Function Signature*
|
|
7320
|
+
```typescript
|
|
7321
|
+
function getWallBaseHeight(): number
|
|
7322
|
+
```
|
|
7323
|
+
|
|
7324
|
+
*Example:*
|
|
7325
|
+
```typescript
|
|
7326
|
+
import * as atwin from 'architwin'
|
|
7327
|
+
|
|
7328
|
+
const wallHeight = atwin.getWallBaseHeight()
|
|
7329
|
+
console.log('Current wall base height:', wallHeight)
|
|
7330
|
+
```
|
|
7331
|
+
|
|
7332
|
+
### clearWallBaseHeight()
|
|
7333
|
+
|
|
7334
|
+
Clear the value of the base height for floors of polygons.
|
|
7335
|
+
|
|
7336
|
+
*Function Signature*
|
|
7337
|
+
```typescript
|
|
7338
|
+
function clearWallBaseHeight(): void
|
|
7339
|
+
```
|
|
7340
|
+
|
|
7341
|
+
*Example:*
|
|
7342
|
+
```typescript
|
|
7343
|
+
import * as atwin from 'architwin'
|
|
7344
|
+
|
|
7345
|
+
// Clear the wall base height
|
|
7346
|
+
atwin.clearWallBaseHeight()
|
|
7347
|
+
```
|
|
7348
|
+
|
|
7349
|
+
### getVertexPath()
|
|
7350
|
+
|
|
7351
|
+
Get the array of vertices that form the current drawing path.
|
|
7352
|
+
|
|
7353
|
+
*Function Signature*
|
|
7354
|
+
```typescript
|
|
7355
|
+
function getVertexPath(): Array<Vector3>
|
|
7356
|
+
```
|
|
7357
|
+
|
|
7358
|
+
*Example:*
|
|
7359
|
+
```typescript
|
|
7360
|
+
import * as atwin from 'architwin'
|
|
7361
|
+
|
|
7362
|
+
const vertexPath = atwin.getVertexPath()
|
|
7363
|
+
|
|
7364
|
+
if (vertexPath && vertexPath.length > 0) {
|
|
7365
|
+
console.log('Current vertex path:', vertexPath)
|
|
7366
|
+
console.log('Number of vertices:', vertexPath.length)
|
|
7367
|
+
vertexPath.forEach((vertex, index) => {
|
|
7368
|
+
console.log(`Vertex ${index}:`, vertex.x, vertex.y, vertex.z)
|
|
7369
|
+
})
|
|
7370
|
+
}
|
|
7371
|
+
```
|
|
7372
|
+
|
|
7373
|
+
### renderPath()
|
|
7374
|
+
|
|
7375
|
+
Renders a 3D path in the space, the path can display any valid ASCII value and display it as an animated value that follows along the line.
|
|
7376
|
+
|
|
7377
|
+
*Function Signature*
|
|
7378
|
+
```typescript
|
|
7379
|
+
function renderPath(vertices: Array<Vector3>, options?: ComponentOptions): void
|
|
7380
|
+
```
|
|
7381
|
+
|
|
7382
|
+
*Parameter Table*
|
|
7383
|
+
| parameter | type | required | default | values |
|
|
7384
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7385
|
+
| vertices | Array<Vector3> | yes | | array of xyz coordinates |
|
|
7386
|
+
| options | ComponentOptions | optional | undefined | customization options to dictate the look and behavior of the path |
|
|
7387
|
+
|
|
7388
|
+
*Example:*
|
|
7389
|
+
```typescript
|
|
7390
|
+
import * as atwin from 'architwin'
|
|
7391
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
7392
|
+
|
|
7393
|
+
const pathVertices = [
|
|
7394
|
+
new Vector3(0, 0, 0),
|
|
7395
|
+
new Vector3(5, 0, 0),
|
|
7396
|
+
new Vector3(5, 5, 0),
|
|
7397
|
+
new Vector3(0, 5, 0)
|
|
7398
|
+
]
|
|
7399
|
+
|
|
7400
|
+
const options = {
|
|
7401
|
+
visible: true,
|
|
7402
|
+
color: '#FF0000'
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
atwin.renderPath(pathVertices, options)
|
|
7406
|
+
```
|
|
7407
|
+
|
|
7408
|
+
### setDrawingConfig()
|
|
7409
|
+
|
|
7410
|
+
Configure the loader to be used for the vertice and path of the drawing system. You can also pass different customization options for both path and vertex components. You only need to run this once unless you intend to switch the configuration again.
|
|
7411
|
+
|
|
7412
|
+
*Function Signature*
|
|
7413
|
+
```typescript
|
|
7414
|
+
function setDrawingConfig(config: PathConfig): void
|
|
7415
|
+
```
|
|
7416
|
+
|
|
7417
|
+
*Parameter Table*
|
|
7418
|
+
| parameter | type | required | default | values |
|
|
7419
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7420
|
+
| config | PathConfig | yes | | Configuration object with lineType, verticeType, and component config options |
|
|
7421
|
+
|
|
7422
|
+
*Example:*
|
|
7423
|
+
```typescript
|
|
7424
|
+
import * as atwin from 'architwin'
|
|
7425
|
+
|
|
7426
|
+
const drawingConfig = {
|
|
7427
|
+
lineType: 'tubeLineType',
|
|
7428
|
+
verticeType: 'verticeType',
|
|
7429
|
+
lineTypeComponentConfig: {
|
|
7430
|
+
renderPolygonOnAdd: true
|
|
7431
|
+
},
|
|
7432
|
+
verticeTypeComponentConfig: {
|
|
7433
|
+
visible: true
|
|
7434
|
+
}
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7437
|
+
atwin.setDrawingConfig(drawingConfig)
|
|
7438
|
+
```
|
|
7439
|
+
|
|
7440
|
+
### getDrawingConfig()
|
|
7441
|
+
|
|
7442
|
+
Gets the current configuration used by the drawing system.
|
|
7443
|
+
|
|
7444
|
+
*Function Signature*
|
|
7445
|
+
```typescript
|
|
7446
|
+
function getDrawingConfig(): PathConfig
|
|
7447
|
+
```
|
|
7448
|
+
|
|
7449
|
+
*Example:*
|
|
7450
|
+
```typescript
|
|
7451
|
+
import * as atwin from 'architwin'
|
|
7452
|
+
|
|
7453
|
+
const currentConfig = atwin.getDrawingConfig()
|
|
7454
|
+
console.log('Current drawing config:', currentConfig)
|
|
7455
|
+
```
|
|
7456
|
+
|
|
7457
|
+
### resetDrawingConfig()
|
|
7458
|
+
|
|
7459
|
+
Resets the configuration for the drawing system to its defaults.
|
|
7460
|
+
|
|
7461
|
+
*Function Signature*
|
|
7462
|
+
```typescript
|
|
7463
|
+
function resetDrawingConfig(): void
|
|
7464
|
+
```
|
|
7465
|
+
|
|
7466
|
+
*Example:*
|
|
7467
|
+
```typescript
|
|
7468
|
+
import * as atwin from 'architwin'
|
|
7469
|
+
|
|
7470
|
+
// Reset to default configuration
|
|
7471
|
+
atwin.resetDrawingConfig()
|
|
7472
|
+
```
|
|
7473
|
+
|
|
7474
|
+
<!-- ### deleteVertex()
|
|
7475
|
+
|
|
7476
|
+
Removes a vertex sphere from the space. If no argument is passed it will remove the last vertex that has been added.
|
|
7477
|
+
|
|
7478
|
+
*Function Signature*
|
|
7479
|
+
```typescript
|
|
7480
|
+
function deleteVertex(): void
|
|
7481
|
+
```
|
|
7482
|
+
|
|
7483
|
+
*Example:*
|
|
7484
|
+
```typescript
|
|
7485
|
+
import * as atwin from 'architwin'
|
|
7486
|
+
|
|
7487
|
+
// Delete the last vertex added to the current path
|
|
7488
|
+
atwin.deleteVertex()
|
|
7489
|
+
```
|
|
7490
|
+
-->
|
|
7491
|
+
|
|
7492
|
+
### setPointerEnabled()
|
|
7493
|
+
|
|
7494
|
+
Sets whether the screen sharing pointer is enabled.
|
|
7495
|
+
|
|
7496
|
+
*Function Signature*
|
|
7497
|
+
```typescript
|
|
7498
|
+
function setPointerEnabled(enabled: boolean): void
|
|
7499
|
+
```
|
|
7500
|
+
|
|
7501
|
+
*Parameter Table*
|
|
7502
|
+
| parameter | type | required | default | values |
|
|
7503
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7504
|
+
| enabled | boolean | yes | | Whether to enable the pointer |
|
|
7505
|
+
|
|
7506
|
+
*Example:*
|
|
7507
|
+
```typescript
|
|
7508
|
+
import * as atwin from 'architwin'
|
|
7509
|
+
|
|
7510
|
+
// Enable the pointer
|
|
7511
|
+
atwin.setPointerEnabled(true)
|
|
7512
|
+
|
|
7513
|
+
// Disable the pointer
|
|
7514
|
+
atwin.setPointerEnabled(false)
|
|
7515
|
+
```
|
|
7516
|
+
|
|
7517
|
+
### removeScreenShareSessionData()
|
|
7518
|
+
|
|
7519
|
+
Remove screen share session data.
|
|
7520
|
+
|
|
7521
|
+
*Function Signature*
|
|
7522
|
+
```typescript
|
|
7523
|
+
function removeScreenShareSessionData(): void
|
|
7524
|
+
```
|
|
7525
|
+
|
|
7526
|
+
*Example:*
|
|
7527
|
+
```typescript
|
|
7528
|
+
import * as atwin from 'architwin'
|
|
7529
|
+
|
|
7530
|
+
// Remove the screen share session data
|
|
7531
|
+
atwin.removeScreenShareSessionData()
|
|
7532
|
+
```
|
|
7533
|
+
|
|
7534
|
+
### setVertexPath()
|
|
7535
|
+
|
|
7536
|
+
Set _thisVertexPath value.
|
|
7537
|
+
|
|
7538
|
+
*Function Signature*
|
|
7539
|
+
```typescript
|
|
7540
|
+
function setVertexPath(path: Array<Vector3>): void
|
|
7541
|
+
```
|
|
7542
|
+
|
|
7543
|
+
*Parameter Table*
|
|
7544
|
+
| parameter | type | required | default | values |
|
|
7545
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7546
|
+
| path | Array<Vector3> | yes | | Array of x,y,z coordinates for the path vertices |
|
|
7547
|
+
|
|
7548
|
+
*Example:*
|
|
7549
|
+
```typescript
|
|
7550
|
+
import * as atwin from 'architwin'
|
|
7551
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
7552
|
+
|
|
7553
|
+
const vertexPath = [
|
|
7554
|
+
new Vector3(0, 0, 0),
|
|
7555
|
+
new Vector3(10, 0, 0),
|
|
7556
|
+
new Vector3(10, 10, 0)
|
|
7557
|
+
]
|
|
7558
|
+
|
|
7559
|
+
atwin.setVertexPath(vertexPath)
|
|
7560
|
+
```
|
|
7561
|
+
|
|
7562
|
+
### clearTagVisibilityStorage()
|
|
7563
|
+
|
|
7564
|
+
Clear tag visibility storage.
|
|
7565
|
+
|
|
7566
|
+
*Function Signature*
|
|
7567
|
+
```typescript
|
|
7568
|
+
function clearTagVisibilityStorage(): void
|
|
7569
|
+
```
|
|
7570
|
+
|
|
7571
|
+
*Example:*
|
|
7572
|
+
```typescript
|
|
7573
|
+
import * as atwin from 'architwin'
|
|
7574
|
+
|
|
7575
|
+
// Clear the tag visibility storage
|
|
7576
|
+
atwin.clearTagVisibilityStorage()
|
|
7577
|
+
```
|
|
7578
|
+
|
|
7579
|
+
### clearActivePane()
|
|
7580
|
+
|
|
7581
|
+
Clear the active pane.
|
|
7582
|
+
|
|
7583
|
+
*Function Signature*
|
|
7584
|
+
```typescript
|
|
7585
|
+
function clearActivePane(): void
|
|
7586
|
+
```
|
|
7587
|
+
|
|
7588
|
+
*Example:*
|
|
7589
|
+
```typescript
|
|
7590
|
+
import * as atwin from 'architwin'
|
|
7591
|
+
|
|
7592
|
+
// Clear the currently active pane
|
|
7593
|
+
atwin.clearActivePane()
|
|
7594
|
+
```
|
|
7595
|
+
|
|
7596
|
+
|
|
7597
|
+
## Space Partition
|
|
7598
|
+
|
|
7599
|
+
Space partition functions manage spatial partitioning of the 3D environment, allowing you to organize and divide the space into logical segments or regions. These partitions can be used for spatial organization, collision detection, occlusion culling, or semantic segmentation of different areas within the space. Partitions help optimize rendering performance and enable spatial queries like finding objects within a specific partition.
|
|
7600
|
+
|
|
7601
|
+
<!-- ### setSpacePartitionNodes()
|
|
7602
|
+
|
|
7603
|
+
This function sets and manages the partition nodes.
|
|
7604
|
+
|
|
7605
|
+
*Function Signature*
|
|
7606
|
+
```typescript
|
|
7607
|
+
function setSpacePartitionNodes(partitionNodes: Array<PartitionNode>): Promise<void>
|
|
7608
|
+
```
|
|
7609
|
+
|
|
7610
|
+
*Parameter Table*
|
|
7611
|
+
| parameter | type | required | default | values |
|
|
7612
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7613
|
+
| partitionNodes | Array<PartitionNode> | yes | | Array of partition nodes |
|
|
7614
|
+
|
|
7615
|
+
*Example:*
|
|
7616
|
+
```typescript
|
|
7617
|
+
import * as atwin from 'architwin'
|
|
7618
|
+
|
|
7619
|
+
const partitionNodes = [
|
|
7620
|
+
{ id: 'partition_1', bounds: { min: [0, 0, 0], max: [10, 10, 10] } },
|
|
7621
|
+
{ id: 'partition_2', bounds: { min: [10, 0, 0], max: [20, 10, 10] } }
|
|
7622
|
+
]
|
|
7623
|
+
|
|
7624
|
+
await atwin.setSpacePartitionNodes(partitionNodes)
|
|
7625
|
+
```
|
|
7626
|
+
-->
|
|
7627
|
+
|
|
7628
|
+
### setCurrentPolygon()
|
|
7629
|
+
|
|
7630
|
+
Set the current polygon for space partitioning.
|
|
7631
|
+
|
|
7632
|
+
*Function Signature*
|
|
7633
|
+
```typescript
|
|
7634
|
+
function setCurrentPolygon(polygonData: IObjectData): void
|
|
7635
|
+
```
|
|
7636
|
+
|
|
7637
|
+
*Parameter Table*
|
|
7638
|
+
| parameter | type | required | default | values |
|
|
7639
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7640
|
+
| polygonData | IObjectData | yes | | The polygon object data |
|
|
7641
|
+
|
|
7642
|
+
*Example:*
|
|
7643
|
+
```typescript
|
|
7644
|
+
import * as atwin from 'architwin'
|
|
7645
|
+
|
|
7646
|
+
const selectedPolygon = atwin.getSelectedObject()
|
|
7647
|
+
|
|
7648
|
+
if (selectedPolygon) {
|
|
7649
|
+
atwin.setCurrentPolygon(selectedPolygon)
|
|
7650
|
+
}
|
|
7651
|
+
```
|
|
7652
|
+
|
|
7653
|
+
## Others
|
|
7654
|
+
|
|
7655
|
+
Miscellaneous utility functions for space management and coordinate conversion. These include functions for retrieving space metadata, converting between coordinate systems (Z-up to Y-up and vice versa), managing space IDs, getting relative positions within the space, and handling asset URL resolution. These utilities provide essential support for space operations and coordinate transformations needed throughout the application.
|
|
7656
|
+
|
|
7657
|
+
### getSpaceId()
|
|
7658
|
+
|
|
7659
|
+
Get the current space ID.
|
|
7660
|
+
|
|
7661
|
+
*Function Signature*
|
|
7662
|
+
```typescript
|
|
7663
|
+
function getSpaceId(): string
|
|
7664
|
+
```
|
|
7665
|
+
|
|
7666
|
+
*Example:*
|
|
7667
|
+
```typescript
|
|
7668
|
+
import * as atwin from 'architwin'
|
|
7669
|
+
|
|
7670
|
+
const spaceId = atwin.getSpaceId()
|
|
7671
|
+
console.log('Current space ID:', spaceId)
|
|
7672
|
+
```
|
|
7673
|
+
|
|
7674
|
+
### getCurrentPolygon()
|
|
7675
|
+
|
|
7676
|
+
Get the currently active polygon.
|
|
7677
|
+
|
|
7678
|
+
*Function Signature*
|
|
7679
|
+
```typescript
|
|
7680
|
+
function getCurrentPolygon(): any
|
|
7681
|
+
```
|
|
7682
|
+
|
|
7683
|
+
*Example:*
|
|
7684
|
+
```typescript
|
|
7685
|
+
import * as atwin from 'architwin'
|
|
7686
|
+
|
|
7687
|
+
const currentPolygon = atwin.getCurrentPolygon()
|
|
7688
|
+
if (currentPolygon) {
|
|
7689
|
+
console.log('Current polygon ID:', currentPolygon.object.id)
|
|
7690
|
+
}
|
|
7691
|
+
```
|
|
7692
|
+
|
|
7693
|
+
### getPathBetweenSweeps()
|
|
7694
|
+
|
|
7695
|
+
Get the path between two sweeps.
|
|
7696
|
+
|
|
7697
|
+
*Function Signature*
|
|
7698
|
+
```typescript
|
|
7699
|
+
function getPathBetweenSweeps(): Array<Vector3>
|
|
7700
|
+
```
|
|
7701
|
+
|
|
7702
|
+
*Example:*
|
|
7703
|
+
```typescript
|
|
7704
|
+
import * as atwin from 'architwin'
|
|
7705
|
+
|
|
7706
|
+
const path = atwin.getPathBetweenSweeps()
|
|
7707
|
+
if (path && path.length > 0) {
|
|
7708
|
+
console.log('Path between sweeps:', path)
|
|
7709
|
+
}
|
|
7710
|
+
```
|
|
7711
|
+
|
|
7712
|
+
### moveAlongPath()
|
|
7713
|
+
|
|
7714
|
+
Move along a defined path in the space.
|
|
7715
|
+
|
|
7716
|
+
*Function Signature*
|
|
7717
|
+
```typescript
|
|
7718
|
+
function moveAlongPath(path: Array<Vector3>): void
|
|
7719
|
+
```
|
|
7720
|
+
|
|
7721
|
+
*Parameter Table*
|
|
7722
|
+
| parameter | type | required | default | values |
|
|
7723
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7724
|
+
| path | Array<Vector3> | yes | | Array of x,y,z coordinates defining the path |
|
|
7725
|
+
|
|
7726
|
+
*Example:*
|
|
7727
|
+
```typescript
|
|
7728
|
+
import * as atwin from 'architwin'
|
|
7729
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
7730
|
+
|
|
7731
|
+
const path = [
|
|
7732
|
+
new Vector3(0, 0, 0),
|
|
7733
|
+
new Vector3(5, 0, 0),
|
|
7734
|
+
new Vector3(5, 5, 0)
|
|
7735
|
+
]
|
|
7736
|
+
|
|
7737
|
+
atwin.moveAlongPath(path)
|
|
7738
|
+
```
|
|
7739
|
+
|
|
7740
|
+
<!-- ### convertZupToYup()
|
|
7741
|
+
|
|
7742
|
+
Converts a coordinate from a right handed Z-up coordinates system to a right handed Y-up coordinate system.
|
|
7743
|
+
|
|
7744
|
+
*Function Signature*
|
|
7745
|
+
```typescript
|
|
7746
|
+
function convertZupToYup(revitCoords: Vector3, mpBasePoint?: Vector3, bimBasepoint?: Vector3, unit?: string, scaleFactor?: number): Vector3
|
|
7747
|
+
```
|
|
7748
|
+
|
|
7749
|
+
*Parameter Table*
|
|
7750
|
+
| parameter | type | required | default | values |
|
|
7751
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7752
|
+
| revitCoords | Vector3 | yes | | coordinates |
|
|
7753
|
+
| mpBasePoint | Vector3 | optional | {x:0,y:0,z:0} | if defined will offset the position based on the MP basepoint |
|
|
7754
|
+
| bimBasepoint | Vector3 | optional | {x:0,y:0,z:0} | if defined will offset the position based on the BIM basepoint |
|
|
7755
|
+
| unit | string | optional | METER | Supported units: MILLIMETER, CENTIMETER, METER, FOOT, INCH |
|
|
7756
|
+
| scaleFactor | number | optional | 1 | default is 1 (1:1 scale). Applied after conversion to meters |
|
|
7757
|
+
|
|
7758
|
+
*Example:*
|
|
7759
|
+
```typescript
|
|
7760
|
+
import * as atwin from 'architwin'
|
|
7761
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
7762
|
+
|
|
7763
|
+
const zupPoint = new Vector3(0, 5, 10)
|
|
7764
|
+
const yupPoint = atwin.convertZupToYup(zupPoint)
|
|
7765
|
+
|
|
7766
|
+
console.log('Converted point:', yupPoint)
|
|
7767
|
+
```
|
|
7768
|
+
|
|
7769
|
+
### convertYupToZup()
|
|
7770
|
+
|
|
7771
|
+
Converts a coordinate from a right handed Y-up coordinate system to a right handed Z-up coordinate system.
|
|
7772
|
+
|
|
7773
|
+
*Function Signature*
|
|
7774
|
+
```typescript
|
|
7775
|
+
function convertYupToZup(objectPosition: Vector3, mpBasePoint?: Vector3, bimBasepoint?: Vector3, unit?: string, scaleFactor?: number): Vector3
|
|
7776
|
+
```
|
|
7777
|
+
|
|
7778
|
+
*Parameter Table*
|
|
7779
|
+
| parameter | type | required | default | values |
|
|
7780
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7781
|
+
| objectPosition | Vector3 | yes | | coordinates in meters (ThreeJS uses meters) |
|
|
7782
|
+
| mpBasePoint | Vector3 | optional | {x:0,y:0,z:0} | if defined will offset the position based on the MP basepoint |
|
|
7783
|
+
| bimBasepoint | Vector3 | optional | {x:0,y:0,z:0} | if defined will offset the position based on the BIM basepoint |
|
|
7784
|
+
| unit | string | optional | METER | Supported units: MILLIMETER, CENTIMETER, METER, FOOT, INCH. Only affects the basePoint conversion |
|
|
7785
|
+
| scaleFactor | number | optional | 1 | default is 1 (1:1 scale). Applied to coordinates in meters |
|
|
7786
|
+
|
|
7787
|
+
*Example:*
|
|
7788
|
+
```typescript
|
|
7789
|
+
import * as atwin from 'architwin'
|
|
7790
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
7791
|
+
|
|
7792
|
+
const yupPoint = new Vector3(0, 10, 5)
|
|
7793
|
+
const zupPoint = atwin.convertYupToZup(yupPoint)
|
|
7794
|
+
|
|
7795
|
+
console.log('Converted point:', zupPoint)
|
|
7796
|
+
```
|
|
7797
|
+
-->
|
|
7798
|
+
|
|
7799
|
+
### getRelativePosition()
|
|
7800
|
+
|
|
7801
|
+
Gives you the simple relative position of an object to another object in the Matterport Space.
|
|
7802
|
+
|
|
7803
|
+
*Function Signature*
|
|
7804
|
+
```typescript
|
|
7805
|
+
function getRelativePosition(position: Vector3, relativeTo: Vector3): Vector3
|
|
7806
|
+
```
|
|
7807
|
+
|
|
7808
|
+
*Parameter Table*
|
|
7809
|
+
| parameter | type | required | default | values |
|
|
7810
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7811
|
+
| position | Vector3 | yes | | position coordinates |
|
|
7812
|
+
| relativeTo | Vector3 | yes | | reference position |
|
|
7813
|
+
|
|
7814
|
+
*Example:*
|
|
7815
|
+
```typescript
|
|
7816
|
+
import * as atwin from 'architwin'
|
|
7817
|
+
|
|
7818
|
+
const relativePosition = atwin.getRelativePosition()
|
|
7819
|
+
console.log('Relative position:', relativePosition)
|
|
7820
|
+
```
|
|
7821
|
+
|
|
7822
|
+
### getOriginalWorldPosition()
|
|
7823
|
+
|
|
7824
|
+
Gives your the original position of an object's relative position to another object. use this to reverse the result given by getRelativePosition.
|
|
7825
|
+
|
|
7826
|
+
*Function Signature*
|
|
7827
|
+
```typescript
|
|
7828
|
+
function getOriginalWorldPosition(position: Vector3, relativeTo: Vector3): Vector3
|
|
7829
|
+
```
|
|
7830
|
+
|
|
7831
|
+
*Parameter Table*
|
|
7832
|
+
| parameter | type | required | default | values |
|
|
7833
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7834
|
+
| position | Vector3 | yes | | relative position coordinates |
|
|
7835
|
+
| relativeTo | Vector3 | yes | | reference position |
|
|
7836
|
+
|
|
7837
|
+
*Example:*
|
|
7838
|
+
```typescript
|
|
7839
|
+
import * as atwin from 'architwin'
|
|
7840
|
+
|
|
7841
|
+
const worldPosition = atwin.getOriginalWorldPosition()
|
|
7842
|
+
console.log('Original world position:', worldPosition)
|
|
7843
|
+
```
|
|
7844
|
+
|
|
7845
|
+
### setSpaceMetadata()
|
|
7846
|
+
|
|
7847
|
+
Set the space meta data variable.
|
|
7848
|
+
|
|
7849
|
+
*Function Signature*
|
|
7850
|
+
```typescript
|
|
7851
|
+
function setSpaceMetadata(payload: SpaceMetadata | null): void
|
|
7852
|
+
```
|
|
7853
|
+
|
|
7854
|
+
*Parameter Table*
|
|
7855
|
+
| parameter | type | required | default | values |
|
|
7856
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7857
|
+
| payload | SpaceMetadata \| null | yes | | space metadata object |
|
|
7858
|
+
|
|
7859
|
+
*Example:*
|
|
7860
|
+
```typescript
|
|
7861
|
+
import * as atwin from 'architwin'
|
|
7862
|
+
|
|
7863
|
+
// Set space metadata
|
|
7864
|
+
atwin.setSpaceMetadata('theme', 'dark')
|
|
7865
|
+
atwin.setSpaceMetadata('version', 1.5)
|
|
7866
|
+
atwin.setSpaceMetadata('features', ['feature1', 'feature2'])
|
|
7867
|
+
```
|
|
7868
|
+
|
|
7869
|
+
### getSpaceMetadata()
|
|
7870
|
+
|
|
7871
|
+
Returns the value of the space meta data.
|
|
7872
|
+
|
|
7873
|
+
*Function Signature*
|
|
7874
|
+
```typescript
|
|
7875
|
+
function getSpaceMetadata(): SpaceMetadata
|
|
7876
|
+
```
|
|
7877
|
+
|
|
7878
|
+
*Example:*
|
|
7879
|
+
```typescript
|
|
7880
|
+
import * as atwin from 'architwin'
|
|
7881
|
+
|
|
7882
|
+
const themeValue = atwin.getSpaceMetadata('theme')
|
|
7883
|
+
console.log('Space theme:', themeValue)
|
|
7884
|
+
```
|
|
7885
|
+
|
|
7886
|
+
### getAssetUrl()
|
|
7887
|
+
|
|
7888
|
+
Returns the path to an asset placed in the static folder.
|
|
7889
|
+
|
|
7890
|
+
*Function Signature*
|
|
7891
|
+
```typescript
|
|
7892
|
+
function getAssetUrl(filename: string): string
|
|
7893
|
+
```
|
|
7894
|
+
|
|
7895
|
+
*Parameter Table*
|
|
7896
|
+
| parameter | type | required | default | values |
|
|
7897
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7898
|
+
| filename | string | yes | | filename of the file including the extension. If the file is placed in a subfolder of static folder include that without any / in the beginning |
|
|
7899
|
+
|
|
7900
|
+
*Example:*
|
|
7901
|
+
```typescript
|
|
7902
|
+
import * as atwin from 'architwin'
|
|
7903
|
+
|
|
7904
|
+
const assetUrl = atwin.getAssetUrl('images/logo.png')
|
|
7905
|
+
console.log('Asset URL:', assetUrl)
|
|
7906
|
+
```
|
|
7907
|
+
|
|
7908
|
+
|
|
7909
|
+
<!-- ## IoT (Internet of Things)
|
|
7910
|
+
|
|
7911
|
+
IoT functions enable integration of Internet of Things devices within the 3D space, allowing you to represent and manage smart devices, sensors, and connected equipment as interactive objects in the visualization. You can define device categories, set device types and properties, customize device icons and tags, and link IoT devices to external systems. This enables users to monitor and interact with real-world IoT devices within the immersive 3D environment.
|
|
7912
|
+
|
|
7913
|
+
### setIotCategoryTypes()
|
|
7914
|
+
|
|
7915
|
+
Set the available IoT device category types.
|
|
7916
|
+
|
|
7917
|
+
*Function Signature*
|
|
7918
|
+
```typescript
|
|
7919
|
+
function setIotCategoryTypes(payload: Array<ITagIOTCategory>): Array<ITagIOTCategory>
|
|
7920
|
+
```
|
|
7921
|
+
|
|
7922
|
+
*Parameter Table*
|
|
7923
|
+
| parameter | type | required | default | values |
|
|
7924
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7925
|
+
| payload | Array<ITagIOTCategory> | yes | | Array of IoT category objects |
|
|
7926
|
+
|
|
7927
|
+
*Example:*
|
|
7928
|
+
```typescript
|
|
7929
|
+
import * as atwin from 'architwin'
|
|
7930
|
+
|
|
7931
|
+
const categories = [
|
|
7932
|
+
{ id: '1', name: 'Sensors', icon: 'sensor.png' },
|
|
7933
|
+
{ id: '2', name: 'Actuators', icon: 'actuator.png' }
|
|
7934
|
+
]
|
|
7935
|
+
|
|
7936
|
+
atwin.setIotCategoryTypes(categories)
|
|
7937
|
+
```
|
|
7938
|
+
|
|
7939
|
+
### setIotDeviceTypes()
|
|
7940
|
+
|
|
7941
|
+
Set the available IoT device types.
|
|
7942
|
+
|
|
7943
|
+
*Function Signature*
|
|
7944
|
+
```typescript
|
|
7945
|
+
function setIotDeviceTypes(payload: Array<DeviceInfo>): Array<DeviceInfo>
|
|
7946
|
+
```
|
|
7947
|
+
|
|
7948
|
+
*Parameter Table*
|
|
7949
|
+
| parameter | type | required | default | values |
|
|
7950
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7951
|
+
| payload | Array<DeviceInfo> | yes | | Array of device info objects |
|
|
7952
|
+
|
|
7953
|
+
*Example:*
|
|
7954
|
+
```typescript
|
|
7955
|
+
import * as atwin from 'architwin'
|
|
7956
|
+
|
|
7957
|
+
const devices = [
|
|
7958
|
+
{ id: '1', name: 'Temperature Sensor', type: 'Sensor' },
|
|
7959
|
+
{ id: '2', name: 'Door Lock', type: 'Actuator' }
|
|
7960
|
+
]
|
|
7961
|
+
|
|
7962
|
+
atwin.setIotDeviceTypes(devices)
|
|
7963
|
+
```
|
|
7964
|
+
|
|
7965
|
+
### setIoTDeviceTagIcons()
|
|
7966
|
+
|
|
7967
|
+
Set custom icons for IoT device tags.
|
|
7968
|
+
|
|
7969
|
+
*Function Signature*
|
|
7970
|
+
```typescript
|
|
7971
|
+
function setIoTDeviceTagIcons(payload: any): void
|
|
7972
|
+
```
|
|
7973
|
+
|
|
7974
|
+
*Parameter Table*
|
|
7975
|
+
| parameter | type | required | default | values |
|
|
7976
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
7977
|
+
| payload | any | yes | | Icon configuration object |
|
|
7978
|
+
|
|
7979
|
+
*Example:*
|
|
7980
|
+
```typescript
|
|
7981
|
+
import * as atwin from 'architwin'
|
|
7982
|
+
|
|
7983
|
+
const iconConfig = {
|
|
7984
|
+
sensor: 'path/to/sensor-icon.png',
|
|
7985
|
+
actuator: 'path/to/actuator-icon.png'
|
|
7986
|
+
}
|
|
7987
|
+
|
|
7988
|
+
atwin.setIoTDeviceTagIcons(iconConfig)
|
|
7989
|
+
```
|
|
7990
|
+
|
|
7991
|
+
### getIoTDeviceTagIcons()
|
|
7992
|
+
|
|
7993
|
+
Retrieve the currently configured IoT device tag icons.
|
|
7994
|
+
|
|
7995
|
+
*Function Signature*
|
|
7996
|
+
```typescript
|
|
7997
|
+
function getIoTDeviceTagIcons(): any
|
|
7998
|
+
```
|
|
7999
|
+
|
|
8000
|
+
*Example:*
|
|
8001
|
+
```typescript
|
|
8002
|
+
import * as atwin from 'architwin'
|
|
8003
|
+
|
|
8004
|
+
const icons = atwin.getIoTDeviceTagIcons()
|
|
8005
|
+
console.log('Current IoT device tag icons:', icons)
|
|
8006
|
+
```
|
|
8007
|
+
|
|
8008
|
+
### setIoTLinkedSystemOptions()
|
|
8009
|
+
|
|
8010
|
+
Set available linked system options for IoT devices.
|
|
8011
|
+
|
|
8012
|
+
*Function Signature*
|
|
8013
|
+
```typescript
|
|
8014
|
+
function setIoTLinkedSystemOptions(payload: Array<string>): void
|
|
8015
|
+
```
|
|
8016
|
+
|
|
8017
|
+
*Parameter Table*
|
|
8018
|
+
| parameter | type | required | default | values |
|
|
8019
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8020
|
+
| payload | Array<string> | yes | | Array of system option strings |
|
|
8021
|
+
|
|
8022
|
+
*Example:*
|
|
8023
|
+
```typescript
|
|
8024
|
+
import * as atwin from 'architwin'
|
|
8025
|
+
|
|
8026
|
+
const linkedSystems = ['Building Management System', 'Home Automation', 'Industrial Control']
|
|
8027
|
+
|
|
8028
|
+
atwin.setIoTLinkedSystemOptions(linkedSystems)
|
|
8029
|
+
```
|
|
8030
|
+
-->
|
|
8031
|
+
|
|
8032
|
+
## Space Screen Share
|
|
8033
|
+
|
|
8034
|
+
Screen sharing functions enable users to share their screens within the collaborative 3D space, allowing multiple participants to view shared content simultaneously. Includes functionality to designate a host user sharing their screen, manage participant viewers, render cursor markers to show where the host is pointing, and update cursor textures for visual feedback. This facilitates collaborative work sessions and presentations within the immersive environment.
|
|
8035
|
+
|
|
8036
|
+
### setScreenSharingHostUser()
|
|
8037
|
+
|
|
8038
|
+
Set value to screen sharing host user.
|
|
8039
|
+
|
|
8040
|
+
*Function Signature*
|
|
8041
|
+
```typescript
|
|
8042
|
+
function setScreenSharingHostUser(user: ScreenShareUser | null): void
|
|
8043
|
+
```
|
|
8044
|
+
|
|
8045
|
+
*Parameter Table*
|
|
8046
|
+
| parameter | type | required | default | values |
|
|
8047
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8048
|
+
| user | ScreenShareUser \| null | yes | | ScreenShareUser object or null |
|
|
8049
|
+
|
|
8050
|
+
*Example:*
|
|
8051
|
+
```typescript
|
|
8052
|
+
import * as atwin from 'architwin'
|
|
8053
|
+
|
|
8054
|
+
const hostUser = {
|
|
8055
|
+
id: 'user123',
|
|
8056
|
+
name: 'John Doe',
|
|
8057
|
+
color: '#FF0000'
|
|
8058
|
+
}
|
|
8059
|
+
|
|
8060
|
+
atwin.setScreenSharingHostUser(hostUser)
|
|
8061
|
+
```
|
|
8062
|
+
|
|
8063
|
+
### setScreenSharingParticipantUsers()
|
|
8064
|
+
|
|
8065
|
+
Set value to screen sharing participant users.
|
|
8066
|
+
|
|
8067
|
+
*Function Signature*
|
|
8068
|
+
```typescript
|
|
8069
|
+
function setScreenSharingParticipantUsers(users: Array<ScreenShareUser>): void
|
|
8070
|
+
```
|
|
8071
|
+
|
|
8072
|
+
*Parameter Table*
|
|
8073
|
+
| parameter | type | required | default | values |
|
|
8074
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8075
|
+
| users | Array<ScreenShareUser> | yes | | ScreenShareUser array |
|
|
8076
|
+
|
|
8077
|
+
*Example:*
|
|
8078
|
+
```typescript
|
|
8079
|
+
import * as atwin from 'architwin'
|
|
8080
|
+
|
|
8081
|
+
const participants = [
|
|
8082
|
+
{ id: 'user234', name: 'Jane Smith', color: '#00FF00' },
|
|
8083
|
+
{ id: 'user345', name: 'Bob Wilson', color: '#0000FF' }
|
|
8084
|
+
]
|
|
8085
|
+
|
|
8086
|
+
atwin.setScreenSharingParticipantUsers(participants)
|
|
8087
|
+
```
|
|
8088
|
+
|
|
8089
|
+
### renderCursorMarkerPointer()
|
|
8090
|
+
|
|
8091
|
+
Syncs an object's position and rotation to align with a pointer intersection surface. If an object is provided, its transformation is updated. Otherwise, a new marker is added at the intersection point.
|
|
8092
|
+
|
|
8093
|
+
*Function Signature*
|
|
8094
|
+
```typescript
|
|
8095
|
+
function renderCursorMarkerPointer(pointerIntersection: MpSdk.Pointer.Intersection, _object?: IObjectData, markerTexture?: string): Promise<IShowcaseObject | void>
|
|
8096
|
+
```
|
|
8097
|
+
|
|
8098
|
+
*Parameter Table*
|
|
8099
|
+
| parameter | type | required | default | values |
|
|
8100
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8101
|
+
| pointerIntersection | MpSdk.Pointer.Intersection | yes | | The pointer intersection from Matterport SDK |
|
|
8102
|
+
| _object | IObjectData | optional | | Optional object to transform |
|
|
8103
|
+
| markerTexture | string | optional | | Optional texture URL for a new marker |
|
|
8104
|
+
|
|
8105
|
+
*Example:*
|
|
8106
|
+
```typescript
|
|
8107
|
+
import * as atwin from 'architwin'
|
|
8108
|
+
import { Vector3 } from 'architwin/lib/types'
|
|
8109
|
+
|
|
8110
|
+
const cursorPosition = new Vector3(5, 2, 3)
|
|
8111
|
+
atwin.renderCursorMarkerPointer(cursorPosition)
|
|
8112
|
+
```
|
|
8113
|
+
|
|
8114
|
+
### updatePointerTexture()
|
|
8115
|
+
|
|
8116
|
+
Update the texture of the pointer reticle using a registered texture ID. Defaults to 'targetPointer' if no ID is provided.
|
|
8117
|
+
|
|
8118
|
+
*Function Signature*
|
|
8119
|
+
```typescript
|
|
8120
|
+
function updatePointerTexture(textureId?: string): Promise<void>
|
|
8121
|
+
```
|
|
8122
|
+
|
|
8123
|
+
*Parameter Table*
|
|
8124
|
+
| parameter | type | required | default | values |
|
|
8125
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8126
|
+
| textureId | string | optional | targetPointer | Optional texture ID to apply to the pointer, if equal to 'resetTexture' it will reset texture |
|
|
8127
|
+
|
|
8128
|
+
*Example:*
|
|
8129
|
+
```typescript
|
|
8130
|
+
import * as atwin from 'architwin'
|
|
8131
|
+
|
|
8132
|
+
const textureUrl = 'https://example.com/cursor-texture.png'
|
|
8133
|
+
atwin.updatePointerTexture(textureUrl)
|
|
8134
|
+
```
|
|
8135
|
+
|
|
8136
|
+
### toggleElementVisibility()
|
|
8137
|
+
|
|
8138
|
+
Toggles the visibility of an HTML element by its ID.
|
|
8139
|
+
|
|
8140
|
+
*Function Signature*
|
|
8141
|
+
```typescript
|
|
8142
|
+
function toggleElementVisibility(id: string, shouldShow: boolean): void
|
|
8143
|
+
```
|
|
8144
|
+
|
|
8145
|
+
*Parameter Table*
|
|
8146
|
+
| parameter | type | required | default | values |
|
|
8147
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8148
|
+
| id | string | yes | | The ID of the HTML element to be shown or hidden |
|
|
8149
|
+
| shouldShow | boolean | yes | | Boolean flag to show (true) or hide (false) the element |
|
|
8150
|
+
|
|
8151
|
+
*Example:*
|
|
8152
|
+
```typescript
|
|
8153
|
+
import * as atwin from 'architwin'
|
|
8154
|
+
|
|
8155
|
+
// Toggle visibility of an element
|
|
8156
|
+
atwin.toggleElementVisibility('element-123')
|
|
8157
|
+
```
|
|
8158
|
+
|
|
8159
|
+
|
|
8160
|
+
<!-- ### setPipeCategories()
|
|
8161
|
+
|
|
8162
|
+
Set pipes categories value.
|
|
8163
|
+
|
|
8164
|
+
*Function Signature*
|
|
8165
|
+
```typescript
|
|
8166
|
+
function setPipeCategories(pipes: IPipeCategory[]): void
|
|
8167
|
+
```
|
|
8168
|
+
|
|
8169
|
+
*Parameter Table*
|
|
8170
|
+
| parameter | type | required | default | values |
|
|
8171
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8172
|
+
| pipes | IPipeCategory[] | yes | | IPipeCategory array |
|
|
8173
|
+
|
|
8174
|
+
*Example:*
|
|
8175
|
+
```typescript
|
|
8176
|
+
import * as atwin from 'architwin'
|
|
8177
|
+
|
|
8178
|
+
const pipeCategories = [
|
|
8179
|
+
{ id: '1', name: 'HVAC', color: '#FF0000' },
|
|
8180
|
+
{ id: '2', name: 'Plumbing', color: '#0000FF' }
|
|
8181
|
+
]
|
|
8182
|
+
|
|
8183
|
+
atwin.setPipeCategories(pipeCategories)
|
|
8184
|
+
```
|
|
8185
|
+
|
|
8186
|
+
### setSelectedPipeCategory() -->
|
|
8187
|
+
|
|
8188
|
+
<!-- ### setSelectedPipeCategory()
|
|
8189
|
+
|
|
8190
|
+
Set selected pipes catrgory value.
|
|
8191
|
+
|
|
8192
|
+
*Function Signature*
|
|
8193
|
+
```typescript
|
|
8194
|
+
function setSelectedPipeCategory(pipe: IPipeCategory): void
|
|
8195
|
+
```
|
|
8196
|
+
|
|
8197
|
+
*Parameter Table*
|
|
8198
|
+
| parameter | type | required | default | values |
|
|
8199
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8200
|
+
| pipe | IPipeCategory | yes | | IPipeCategory object |
|
|
8201
|
+
|
|
8202
|
+
*Example:*
|
|
8203
|
+
```typescript
|
|
8204
|
+
import * as atwin from 'architwin'
|
|
8205
|
+
|
|
8206
|
+
const pipeCategory = { id: '1', name: 'HVAC', color: '#FF0000' }
|
|
8207
|
+
|
|
8208
|
+
atwin.setSelectedPipeCategory(pipeCategory)
|
|
8209
|
+
```
|
|
8210
|
+
|
|
8211
|
+
### getSelectedPipeCategory()
|
|
8212
|
+
|
|
8213
|
+
Gets the current pipe category for the pipe form.
|
|
8214
|
+
|
|
8215
|
+
*Function Signature*
|
|
8216
|
+
```typescript
|
|
8217
|
+
function getSelectedPipeCategory(): IPipeCategory
|
|
8218
|
+
```
|
|
8219
|
+
-->
|
|
8220
|
+
|
|
8221
|
+
<!-- ### setPipes()
|
|
8222
|
+
|
|
8223
|
+
Set pipes value.
|
|
8224
|
+
|
|
8225
|
+
*Function Signature*
|
|
8226
|
+
```typescript
|
|
8227
|
+
function setPipes(pipes: IPipe[]): IPipe[]
|
|
8228
|
+
```
|
|
8229
|
+
|
|
8230
|
+
*Parameter Table*
|
|
8231
|
+
| parameter | type | required | default | values |
|
|
8232
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8233
|
+
| pipes | IPipe[] | yes | | Array of pipe objects |
|
|
8234
|
+
|
|
8235
|
+
*Example:*
|
|
8236
|
+
```typescript
|
|
8237
|
+
import * as atwin from 'architwin'
|
|
8238
|
+
|
|
8239
|
+
const pipes = [
|
|
8240
|
+
{ id: '1', name: '6 inch duct', diameter: 6 },
|
|
8241
|
+
{ id: '2', name: '8 inch duct', diameter: 8 }
|
|
8242
|
+
]
|
|
8243
|
+
|
|
8244
|
+
atwin.setPipes(pipes)
|
|
8245
|
+
```
|
|
8246
|
+
|
|
8247
|
+
### setSelectedPipe() -->
|
|
8248
|
+
|
|
8249
|
+
<!-- ### setSelectedPipe()
|
|
8250
|
+
|
|
8251
|
+
Set selected pipes value.
|
|
8252
|
+
|
|
8253
|
+
*Function Signature*
|
|
8254
|
+
```typescript
|
|
8255
|
+
function setSelectedPipe(pipe: IPipe): void
|
|
8256
|
+
```
|
|
8257
|
+
|
|
8258
|
+
*Parameter Table*
|
|
8259
|
+
| parameter | type | required | default | values |
|
|
8260
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8261
|
+
| pipe | IPipe | yes | | The pipe object to set as active |
|
|
8262
|
+
|
|
8263
|
+
*Example:*
|
|
8264
|
+
```typescript
|
|
8265
|
+
import * as atwin from 'architwin'
|
|
8266
|
+
|
|
8267
|
+
const pipe = { id: '1', name: '6 inch duct', diameter: 6 }
|
|
8268
|
+
|
|
8269
|
+
atwin.setSelectedPipe(pipe)
|
|
8270
|
+
```
|
|
8271
|
+
|
|
8272
|
+
### getSelectedPipe()
|
|
8273
|
+
|
|
8274
|
+
Gets the current pipe for the pipe form.
|
|
8275
|
+
|
|
8276
|
+
*Function Signature*
|
|
8277
|
+
```typescript
|
|
8278
|
+
function getSelectedPipe(): IPipe
|
|
8279
|
+
```
|
|
8280
|
+
|
|
8281
|
+
*Example:*
|
|
8282
|
+
```typescript
|
|
8283
|
+
import * as atwin from 'architwin'
|
|
8284
|
+
|
|
8285
|
+
const selectedPipe = atwin.getSelectedPipe()
|
|
8286
|
+
console.log('Currently selected pipe:', selectedPipe)
|
|
8287
|
+
```
|
|
8288
|
+
-->
|
|
8289
|
+
|
|
8290
|
+
<!-- ### setPipeIsDrawingMode()
|
|
8291
|
+
|
|
8292
|
+
Set selected pipes value.
|
|
8293
|
+
|
|
8294
|
+
*Function Signature*
|
|
8295
|
+
```typescript
|
|
8296
|
+
function setPipeIsDrawingMode(isDrawing: boolean): void
|
|
8297
|
+
```
|
|
8298
|
+
|
|
8299
|
+
*Parameter Table*
|
|
8300
|
+
| parameter | type | required | default | values |
|
|
8301
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8302
|
+
| isDrawing | boolean | yes | | Whether pipe drawing mode should be enabled |
|
|
8303
|
+
|
|
8304
|
+
*Example:*
|
|
8305
|
+
```typescript
|
|
8306
|
+
import * as atwin from 'architwin'
|
|
8307
|
+
|
|
8308
|
+
// Enable pipe drawing mode
|
|
8309
|
+
atwin.setPipeIsDrawingMode(true)
|
|
8310
|
+
|
|
8311
|
+
// Disable pipe drawing mode
|
|
8312
|
+
atwin.setPipeIsDrawingMode(false)
|
|
8313
|
+
```
|
|
8314
|
+
|
|
8315
|
+
### getPipeIsDrawingMode() -->
|
|
8316
|
+
|
|
8317
|
+
<!-- ### getPipeIsDrawingMode()
|
|
8318
|
+
|
|
8319
|
+
Gets the current pipe for the pipe form.
|
|
8320
|
+
|
|
8321
|
+
*Function Signature*
|
|
8322
|
+
```typescript
|
|
8323
|
+
function getPipeIsDrawingMode(): boolean
|
|
8324
|
+
```
|
|
8325
|
+
|
|
8326
|
+
*Example:*
|
|
8327
|
+
```typescript
|
|
8328
|
+
import * as atwin from 'architwin'
|
|
8329
|
+
|
|
8330
|
+
const isDrawing = atwin.getPipeIsDrawingMode()
|
|
8331
|
+
console.log('Pipe drawing mode active:', isDrawing)
|
|
8332
|
+
```
|
|
8333
|
+
-->
|
|
8334
|
+
|
|
8335
|
+
<!-- ### undoPipePath()
|
|
8336
|
+
|
|
8337
|
+
Undo the last pipe path action.
|
|
8338
|
+
|
|
8339
|
+
*Function Signature*
|
|
8340
|
+
```typescript
|
|
8341
|
+
function undoPipePath(): void
|
|
8342
|
+
```
|
|
8343
|
+
|
|
8344
|
+
*Example:*
|
|
8345
|
+
```typescript
|
|
8346
|
+
import * as atwin from 'architwin'
|
|
8347
|
+
|
|
8348
|
+
// Undo the last pipe path action
|
|
8349
|
+
atwin.undoPipePath()
|
|
8350
|
+
```
|
|
8351
|
+
|
|
8352
|
+
### redoPipePath()
|
|
8353
|
+
|
|
8354
|
+
Redo the last undone pipe path action.
|
|
8355
|
+
|
|
8356
|
+
*Function Signature*
|
|
8357
|
+
```typescript
|
|
8358
|
+
function redoPipePath(): void
|
|
8359
|
+
```
|
|
8360
|
+
|
|
8361
|
+
*Example:*
|
|
8362
|
+
```typescript
|
|
8363
|
+
import * as atwin from 'architwin'
|
|
8364
|
+
|
|
8365
|
+
// Redo the last undone pipe path action
|
|
8366
|
+
atwin.redoPipePath()
|
|
8367
|
+
```
|
|
8368
|
+
-->
|
|
8369
|
+
|
|
8370
|
+
<!-- ## Preview Modal
|
|
8371
|
+
|
|
8372
|
+
Preview modal functions for rendering and managing preview interfaces, typically displayed as overlay dialogs or popups above the 3D scene. These modals can show previews of objects, properties, configurations, or information. Functions allow you to display content, toggle visibility, set action callbacks for user interactions, manage edit modes, and check visibility status of elements like polygons. Used for displaying detailed information, settings, or confirmations to users.
|
|
8373
|
+
|
|
8374
|
+
### renderPreviewModal()
|
|
8375
|
+
|
|
8376
|
+
Render a preview modal dialog with custom content.
|
|
8377
|
+
|
|
8378
|
+
*Function Signature*
|
|
8379
|
+
```typescript
|
|
8380
|
+
function renderPreviewModal(content?: any, options?: ComponentOptions): void
|
|
8381
|
+
```
|
|
8382
|
+
|
|
8383
|
+
*Parameter Table*
|
|
8384
|
+
| parameter | type | required | default | values |
|
|
8385
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8386
|
+
| content | any | optional | undefined | Content to display in the modal |
|
|
8387
|
+
| options | ComponentOptions | optional | undefined | Customization options for the modal |
|
|
8388
|
+
|
|
8389
|
+
*Example:*
|
|
8390
|
+
```typescript
|
|
8391
|
+
import * as atwin from 'architwin'
|
|
8392
|
+
|
|
8393
|
+
const modalContent = {
|
|
8394
|
+
title: 'Object Preview',
|
|
8395
|
+
description: 'This is a preview of the selected object'
|
|
8396
|
+
}
|
|
8397
|
+
|
|
8398
|
+
const options = {
|
|
8399
|
+
width: 400,
|
|
8400
|
+
height: 300
|
|
8401
|
+
}
|
|
8402
|
+
|
|
8403
|
+
atwin.renderPreviewModal(modalContent, options)
|
|
8404
|
+
```
|
|
8405
|
+
|
|
8406
|
+
### togglePreviewModal()
|
|
8407
|
+
|
|
8408
|
+
Toggle the preview modal visibility between shown and hidden.
|
|
8409
|
+
|
|
8410
|
+
*Function Signature*
|
|
8411
|
+
```typescript
|
|
8412
|
+
function togglePreviewModal(): void
|
|
8413
|
+
```
|
|
8414
|
+
|
|
8415
|
+
*Example:*
|
|
8416
|
+
```typescript
|
|
8417
|
+
import * as atwin from 'architwin'
|
|
8418
|
+
|
|
8419
|
+
// Toggle preview modal visibility
|
|
8420
|
+
atwin.togglePreviewModal()
|
|
8421
|
+
```
|
|
8422
|
+
|
|
8423
|
+
### closePreviewModal()
|
|
8424
|
+
|
|
8425
|
+
Close the preview modal.
|
|
8426
|
+
|
|
8427
|
+
*Function Signature*
|
|
8428
|
+
```typescript
|
|
8429
|
+
function closePreviewModal(): void
|
|
8430
|
+
```
|
|
8431
|
+
|
|
8432
|
+
*Example:*
|
|
8433
|
+
```typescript
|
|
8434
|
+
import * as atwin from 'architwin'
|
|
8435
|
+
|
|
8436
|
+
// Close the preview modal
|
|
8437
|
+
atwin.closePreviewModal()
|
|
8438
|
+
```
|
|
8439
|
+
|
|
8440
|
+
### setPreviewModalAction()
|
|
8441
|
+
|
|
8442
|
+
Set the action callback for the preview modal. This callback is executed when the user performs an action in the modal.
|
|
8443
|
+
|
|
8444
|
+
*Function Signature*
|
|
8445
|
+
```typescript
|
|
8446
|
+
function setPreviewModalAction(callback: Function): void
|
|
8447
|
+
```
|
|
8448
|
+
|
|
8449
|
+
*Parameter Table*
|
|
8450
|
+
| parameter | type | required | default | values |
|
|
8451
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8452
|
+
| callback | Function | yes | | Function to execute on modal action |
|
|
8453
|
+
|
|
8454
|
+
*Example:*
|
|
8455
|
+
```typescript
|
|
8456
|
+
import * as atwin from 'architwin'
|
|
8457
|
+
|
|
8458
|
+
const actionCallback = (data) => {
|
|
8459
|
+
console.log('Modal action triggered:', data)
|
|
8460
|
+
}
|
|
8461
|
+
|
|
8462
|
+
atwin.setPreviewModalAction(actionCallback)
|
|
8463
|
+
```
|
|
8464
|
+
|
|
8465
|
+
### getIsPolygonVisible()
|
|
8466
|
+
|
|
8467
|
+
Check if polygon is currently visible.
|
|
8468
|
+
|
|
8469
|
+
*Function Signature*
|
|
8470
|
+
```typescript
|
|
8471
|
+
function getIsPolygonVisible(): boolean
|
|
8472
|
+
```
|
|
8473
|
+
|
|
8474
|
+
*Example:*
|
|
8475
|
+
```typescript
|
|
8476
|
+
import * as atwin from 'architwin'
|
|
8477
|
+
|
|
8478
|
+
const isVisible = atwin.getIsPolygonVisible()
|
|
8479
|
+
console.log('Polygon visible:', isVisible)
|
|
8480
|
+
```
|
|
8481
|
+
|
|
8482
|
+
### appendNotionUrlTagDescription()
|
|
8483
|
+
|
|
8484
|
+
Append a notion URL to a tag description.
|
|
8485
|
+
|
|
8486
|
+
*Function Signature*
|
|
8487
|
+
```typescript
|
|
8488
|
+
function appendNotionUrlTagDescription(tagId: string, notionUrl: string): void
|
|
8489
|
+
```
|
|
8490
|
+
|
|
8491
|
+
*Parameter Table*
|
|
8492
|
+
| parameter | type | required | default | values |
|
|
8493
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
8494
|
+
| tagId | string | yes | | ID of the tag |
|
|
8495
|
+
| notionUrl | string | yes | | URL to append to tag description |
|
|
8496
|
+
|
|
8497
|
+
*Example:*
|
|
8498
|
+
```typescript
|
|
8499
|
+
import * as atwin from 'architwin'
|
|
8500
|
+
|
|
8501
|
+
const tagId = 'tag-123'
|
|
8502
|
+
const notionUrl = 'https://notion.so/page-123'
|
|
8503
|
+
|
|
8504
|
+
atwin.appendNotionUrlTagDescription(tagId, notionUrl)
|
|
8505
|
+
```
|
|
8506
|
+
-->
|
|
8507
|
+
|
|
8508
|
+
## Copy Object
|
|
8509
|
+
|
|
8510
|
+
Copy object functions for managing object duplication operations, allowing users to create copies of existing 3D objects with optional transformations. When copying objects, you can specify position and rotation offsets to place the duplicate relative to the original. The system generates new unique IDs for copied objects and integrates them into the scene. This utilities help track the last copied object position to optimize subsequent copy operations.
|
|
8511
|
+
|
|
8512
|
+
### clearLastCopiedObjectPosition()
|
|
8513
|
+
|
|
8514
|
+
Sets _lastCopiedObjectPosition to undefined.
|
|
8515
|
+
|
|
8516
|
+
*Function Signature*
|
|
8517
|
+
```typescript
|
|
8518
|
+
function clearLastCopiedObjectPosition(): void
|
|
8519
|
+
```
|
|
8520
|
+
|
|
8521
|
+
*Example:*
|
|
8522
|
+
```typescript
|
|
8523
|
+
import * as atwin from 'architwin'
|
|
8524
|
+
|
|
8525
|
+
// Clear the last copied object position
|
|
8526
|
+
atwin.clearLastCopiedObjectPosition()
|
|
8527
|
+
```
|