Model orentation/view translating MAX files - autodesk-forge

GOAL:
Our goal is to load a translated .MAX file in perspective view.
WHAT HAPPENS: The translated .MAX files chooses the following view from the view selections inside 3ds Max, and loads the model in top viewport and top orientation:
SIMILAR QUESTION: A similar question has been asked, though there's a slight variation in our situation. We learned in that question that we can orient the starting view but our objective is to modify the main scene/view.
ONE SOLUTION: Is to manipulate the top/top view by rotating this view to have it look like a perspective view, and the model loads in seemingly a perspective view - but it still retrieves the top orientation, which results in wrong behavior when we navigate/orbit the model.
We would preferably have the viewer to pick the lower right view from the viewport selection illustrated above (perspective) - as we have found it will choose the upper left view (top/top) every time. We've tried to change this view from "top" to perspective and saved a new "home"-state on the view cube, like this:
But it still sets the view and orientation to top. Any guidance would be highly appreciated.

To have a control on what view will be set as default/home view when opening a translated .max file, in 3ds Max follow these steps:
Remove all cameras from the scene, if any.
Select the perspective view, rotate, pan, zoom, in other words position the view as you wish, then press Ctrl+C to create a Physical Camera From View.
Select the Front View, go to Create -> Cameras -> Free Camera and click on Front View (anywhere) to create the Free Camera.
Now if you translate the .max file with this setup, the Camera you create at step 2 will be set as the default/home view.
I just finished writing a blog post on this trick. You can find it here.

Related

gizmo based on Three.js is not visible

I created Forge viewer app w/ Transformation Extension based on GitHub sample "forge-extensions", for unknown reason, gizmo is not visible after I click on element, only very small yellow dot after zoom in, I believe it's element center point and gizmo size is too small, so my question is how to control it? in fact, all the coding is copied from that GitHub sample "forge-extensions", I must miss something simple!
Have you tried your code with different types of models, and does it behave the same for all of them? I believe it may have something to do with the scale of the particular model, especially when looking at these lines of code from the viewer extension:
_transformControlTx.setSize(
bbox.getBoundingSphere().radius * 5);
Try and put a breakpoint there, and see what the radius is. Or try adjusting the hard-coded value.

How can I add objects by drag and drop on autodesk forge viewer

how can I add the objects we have produced on the viewer by drag and drop. Like adding a window to the wall of the house? Is there an example or application made for this? or a resource you can recommend?
As shown in https://forge.autodesk.com/blog/dynamic-model-placement you can load and move models around using their placementTransform: model.getPlacementTransform() / model.setPlacementTransform()
You can also combine this with the drag and drop functionality of the browser. Once the user reached the Viewer while dragging, we can start loading the given model. Once the model is loaded, as the user keeps dragging around we can modify the placement of the dragged model.
See https://forge.autodesk.com/blog/drag-and-drop-models-viewer

Autodesk Forge - Revit New Dimension added but not visible

I wrote a tool which draws model curves on a view and adds dimensions to it. The tool when run locally on my computer it works fine, lines are drawn and dimension are added and visible.
But, when I upload the code to Forge Design Automation, the lines are drawn and dimensions added. However the dimensions are not visible. After I downloaded the rvt file I can see the dimension through Revit Lookup, but not directly on the view.
Any suggestions where I might be going wrong?
Here is my code...
mCurve.LineStyle = buildingLineStyle;
//Adding dimension
ReferenceArray references = new ReferenceArray();
references.Append(mCurve.GeometryCurve.GetEndPointReference(0));
references.Append(mCurve.GeometryCurve.GetEndPointReference(1));
Dimension dim = doc.Create.NewDimension(groundFloor, line, references);
//Moving dimension to a suitable position
ElementTransformUtils.MoveElement(doc, dim.Id, 2 * XYZ.BasisY);
Thanks for your time in looking into this issue.
Thank you for your query and sorry to hear you are encountering this obscure problem.
I have no complete and guaranteed solution for you, but similar issues have been discussed in the past in the pure desktop Revit API, and two workarounds were suggested that might help in your case as well:
Newly created dimensioning not displayed
Dimension leader remains visible after removal
One workaround consists in creating a new dimension using the Reference objects obtained from the non-visible one.
The other one, in moving the dimension up and down within the same transaction to regenerate it.

Save picture of current screen to disk AS3

I want to add a button to my flash game (AS3) and on click it saves a picture of the current users whole screen and saves it to pictures/disk automatically, but I don't know how to do that, I know how to add the button to the UI and add a click event and all that, just need to know how to make it save a picture of the current screen to disk (doesn't have to be just the flash screen, can be the WHOLE screen of the users pc, either way works!)
I was on my way writing you the answer but I found this post have a better explaination: Is it possible to capture the screen and save the image in actionscript 3?
"Yes, it's possible.
Draw some display object to a BitmapData (the stage, for example) and crop it if neccesary (the second param of BitmapData::draw will help you out here).
Then, convert the raw pixel data to JPEG or PNG using some encoder. I'm sure up to this point, this is what those tutorials will explain you how to do.
Now, the third step is different but simple enough. Instead of sending the image data to a server side script, use a FileReference object. Since Flash Player 10, it has a method called save, that prompts the user to save a file locally.
Since this is a desktop app, you could also make it an AIR app. This will give more direct access to the file system and other features, in case you need them."

TileMap not generated; add to stage?

I'm failrly new to LibGDX and I'm running into a problem.
I'm building a classically styled RPG/Adventure game in which I'm using a TiledMap(-Renderer) to create the map. I've followed different tutorials but can't get it to work. (last one was DPG's: Full working example link)
What I need, is a column of buttons on the right side of the screen (implemented that through ImageButtons). One of these buttons lead to a settings-kind of screen and another one should lead to the game map. Under a ClickListener of the button I've added DPK's code of
MapHelper map = new MapHelper();
map.setPackerDirectory("data/packer");
map.loadMap("data/world/level1/level.tmx");
map.prepareCamera((int)stage.getWidth(), (int)stage.getHeight());
map.getCamera().update();
map.render();
The MapHelper class is an exact copy of dpk's, only change above is the setting of the width and height of the camera. Any suggestion what I'm doing wrong here?
I don't think you want to invoke map.render() in the ClickListener callback. That would mean the map is only rendered when you click, and then not re-rendered (generally everything gets re-rendered on every screen re-fresh).
I think you need to track the map in your application class, and in the ClickListener callback you need to set a flag or somehow "enable" the map (perhaps setting it to something other than null). Then in the application's render() method you can check to see if the map should be rendered or not, and render it if so.
Specifically, move the calls to prepareCamera, getCamera and render out of the ClickListener.