How to set Straighten Model Property Of Viewer Using Viewer API

(Avinash Srivastava) #1

Hi, Can any one help me to set Straighten Model property i.e. X/Y/Z axel value using viewer api. Actually the model i am uploading is coming as vertical rather than horizontal. When i manually set X axis to 1 of Straighten Model setting under general section of 3d settings from sketchfab then it comes as horizontal but i am not able to do the same using viewer api becoz i haven't find such property to set via api. Please find below model url as reference for issue.



You cannot permanently change settings with the Viewer API. You'll need to use the Data API:!/models/patch_v3_models_uid_options

(Avinash Srivastava) #3

Hi James,
Thanks for your quick response. As you had suggested, i used Data API to change 3D Settings of model like background color, orientation and shading but i am having some issue with background and orientation property. I am using Advance rest client tool to test the api. First i tried to change shading and i successfully changed it. But while changing background color, i am getting error as "Options key background is not json".

When i am changing the same from Swagger UI, then it is working fine. Can you please help me out if i am doing something wrong?

Also as i am new to this, i am not much aware about orientation. Actually i am trying to make my model

horizontally currently it is vertical. But i am not sure what values i should set in orientation i.e.{"axis": [1, 1, 0], "angle": 34}.

Please help.



Quick note that you should never display your API Token publicly. I just reset it for you, so you'll need to get the new one from

At the moment, the endpoint takes a JSON, but the parameters must be strigified JSON (i.e. the background object)

{'background': '{"color": "#ffffff "}'

In the future we may change this to accept both.


Regarding the orientation, if it's just an up-axis issue, you probably just need to rotate one axis 90°, maybe X.

{"axis": [1, 0, 0], "angle": -90} or something like that.

(Avinash Srivastava) #6

Hi James,

First of all thanks a lot for your quick response. As you have mentioned in your response regarding orientation, I tried all axis with different angles but no gain. Here i am attaching 2 screen shots for your reference.

1: First screen shot is default orientation i.e. the actual orientation when i am uploading the 3d model.
2: Second screen shot is the one i am expecting my 3D model should look by default. This screenshot is taken just by increasing "X" value by 1 click under Straighten Model while manually setting 3D settings.
Since X/Y/Z values are not visible on the screen thats why i am not able to actually figure out the angle value.

1st Screenshot

2nd Screenshot

Please Help.

Default Background
(Avinash Srivastava) #7

Hi James,

I tried your suggestion but i am sorry to say that i haven't got 204 response. I tried below steps with Advance Rest Client Chrome extension.

1: I passed {'background':'{"color":"#ffffff"}'} as raw data but i am getting below error.

"detail": "JSON parse error - Expecting property name enclosed in double quotes: line 1 column 2 (char 1)"

2: Then i passed {"background":'{"color":"#ffffff"}'} as raw data but i am getting below error.

"detail": "JSON parse error - No JSON object could be decoded"

Can you do me a favour, if you could test the same using Advance Rest Client or Postman Chrome extension and let me know if you get success. I also tried with Orientation but same error i am getting with that also.

My Model URL is:


Sorry I haven't had a chance to look at this yet. It seems similar to your other discussion with @tribble42

(Avinash Srivastava) #9

Hi James,

Ya i had posted the same thread to @tribble as well. Since you couldn't look into this due to your priorities then during my googling for its solution i found a similar post by @tribble so i forwarded this post to him as well. If you have its solution please let me know as i really need it for customer delivery.


(Avinash Srivastava) #10

Hi James,

I haven't got solution to my problem yet. Have you got a chance to look into this ?

Please help.



We made some fixes and the axis + angle workflow should be working now.

(Avinash Srivastava) #15

Hi James,

Still no gain. Is it possible to show X/Y/Z axis and its angle value on the screen somewhere if we increase or decrease axis values using arrow keys < & > . This will atleast help user to know what values are being change while changing X/Y/Z axis.


You can use getCamera() to find the camera position and target, then calculate the angle from there. Would that help?