Create sketchfab annotations with API - api

Our company would like to use the Sketchfab API to show building constructions to clients. This works perfect, but we would like to use the feature to create annotations on the 3D models within Sketchfab.
I couldn't find anything about creating/editing annotations with the API they provide. This is possible on the site itself.
Does someone know how to create those annotations with Sketchfab from another site (embedded or with API), or knows about a 3D web modeling program/framework which can do that?
Thanks in advance!

This is now possible with new annotation functions:
https://sketchfab.com/developers/viewer/functions#api-section-annotations
Annotations are notes positionned in 3D space. They allow authors to provide information on a specific part of the model and tell a story.
Specifically https://sketchfab.com/developers/viewer/functions#api-createAnnotation
createAnnotation( positionStart, positionEnd, eye, target, title, text, callback, [callback] )
Create the annotation with the given parameters. Callback will be passed (err,index).
And also https://sketchfab.com/developers/viewer/functions#api-updateAnnotation
updateAnnotation( index, {title: title, content: content, eye: eye, target: target}, [callback] )
Updates the annotation information for the given index. Callback will be passed (err, information).

It's not possible yet. But the viewer api should be updated 'soon' to support more feature.

Related

Polarion for admins, custom widgets, Velocity, Lucene etc

I'm starting to create custom widgets, like adding up the 'remaining time' of some work items and showing that on a live report page for instance. Google and SO helped for this but is there some resource available with examples of the most common Velocity functions etc?
Also trying to use the Polarion parameters like $date, $info and $message to create a live doc page, but I can't find the full list of these variables anywhere.
Thanks
Velocity is a rather simple template programming language and it holds only some variables in its context: see Polarion help, for more details:
$calendarTool
$me
$page
$platformService
$projectService
$securityService
$testManagementService
$trackerService
$transactionService
$wikiService
Depending on the location of the invoked script you can have one of the following variables in your context as well:
$testRun
$document
$plan
But most important is the $trackerService as the main entry point to the Polarion API only the API will give you the power to do stuff on the wiki pages (like Traceability Analysis, calculating sums, etc.)
For Plan-pages you can use the newer Rendering API which helps to show fields and links to WIs without messing with too much HTML code

Add new media format to spartacus mediaModel

I added a new type of image format 3d in my commercewebservices-spring.xml.
I want to access this new format in my product-images.component in Product Detail page, something like:
<ng-container *ngIf="mainImage$ | async as main">
<div *ngIf="main.3d as 3d">
But I get an 'unresolved variable', so I guess I need to add this new format elsewhere in spartacus or there is something I'm missing.
Could anyone help with this? Thanks a lot in advance.
there are a couple of steps you'd need to do:
Make sure that the image has been exposed in the OCC api. The OCC endpoints has a configurable fields mapping, that you can use to control the response. You need to verify if your 3d property is exposed. I'm also not sure if you add this as a new property to the backend product model and if it's a media container or a media. But I assume you figure that out.
Make the Spartacus adapter aware of the new field mapping, this is documented in https://sap.github.io/spartacus-docs/connecting-to-other-systems/#configuring-endpoints. You basically configure the required field, so that the data is requested and automatically stored inside the product state in Spartacus.
Implement the UI. I'm not sure if you like to add the 3d image as part of other thumbs/images, or that you need a dedicated UI for 3d images. If it's completely replacement of the product images, the easiest thing is to replace the current cms ProductImagesComponent mapping, i.e.:
providers: [
provideDefaultConfig(<CmsConfig>{
cmsComponents: {
ProductImagesComponent: {
component: Custom3dImagesComponent
}
}
})
]
This is documented at https://sap.github.io/spartacus-docs/customizing-cms-components/
There are alternatives for each step, but these are most straightforward.
If you look at ProductImageNormalizer (https://sap.github.io/spartacus/injectables/ProductImageNormalizer.html#source) you can see that the mapping is slightly different: either image.primary.<format> or image.gallery[n].<format>
Also, bear in mind that the format codes used in the DTO are mapped in the SAP Commerce side. There is an ImageFormatMapping concept, which maps from the actual media format used in the data model in SAP Commerce to the format strings used in the DTO.

Where to put database Model for extensions?

I want to write a small extension that is able to take some informations from the database, based on some user filter preference, and show them on the main page.
I have read: PHPBB extensions development and took a look at: ACME DEMO extension but i didn't find an answer to where the database handling should be placed. Normally this should go into a Model that will handle the data to a Controller, in this case I was not able to figure out where the Model should be placed in to the structure and how it should work.
How should an extension database model should be handled? Where should it sit in to the extension structure?
I'm guessing you would need an event listener.
PHP event listeners work with core events to inject code into phpBB.
Core events are like hooks, and they can be found throughout phpBB’s
codebase at key points. They give your extension access to phpBB’s
variables and allow you to use and modify them or to inject additional
PHP code during phpBB’s execution. -per the Skeleton Extension
Page

Hypermedia Api - Presenting picklist data

I am creating a hypermedia api that conforms to the HAL spec
When a user submits a payment they need to specify what type of card they are using (Visa, Master Card etc)
So for a particular field that is submitted there is a specific list of values that can be used
How do I present that pick list to the user?
As embedded data?
Is there generally a way to associate a field with a given set of data?
I realise the HAL spec is very small and doesnt cover this issue specifically. But in general hypermedia apis how do people usually present this data?
Or should I simply explain the field in the CURIE link?
thanks
You are right, HAL does not specifically cover this issue. You can solve this by essentially copying HTML. There are different widgets defined in HTML to present stuff, for example a combobox with listed options.
You can define a media-type that has similar controls in it, and you can define the processing model for the media-type as well. It can be a json representation of course, does not need to be xml.
For example
{
...
"cardType": {
"inputType": "select",
"possibleValues": ["Visa", "MasterCard", ... ]
}
...
}
There is no ready-made format that I know of unfortunately.

How do you change the parameter description in StrongLoop?

Building our first API in StrongLoop. By default our id parameters all show up as "Model id" or "PersistedModel Id". (See example in screenshot)
I would like to replace these with something more meaningful to the API users, but can't figure out where this is done.
Thanks.
Since there is no elegant way to overwrite description of built-in API methods, I created a simple model mixin which can achieve your requirement.
Please follow the documentation to integrate the mixin into your project.
For custom API methods, please read remoteMethods. It's very easy to define your own description for them.