I'm using ForgeViewer to display both IFC models and custom geometry (point clouds and meshes using THREE.js directly), and I'm using the Section tool to cut away parts of the model.
Is there anyway I can set the size of the planes in the UI. I want the arrows and planes to be centered around specific models making them easier to use. Also, it would be nice to be able to set the default size and position of the cutting box.
The size of the cutting plane/box as well as the position of the manipulating gizmo are estimated by the section tool based on the bounding box of all visible objects. There's no UI to change that behavior, but you might be able to reverse engineer the official Section tool and perhaps modify it to your needs.
Edit: alternatively, you could retrieve the THREE.js geometry representing the cutting plane after it's been created by the Section tool (and placed into viewer.impl.sceneAfter) and customize it as needed.
Adding to Petr's answer...
Use the 'box section' tool (see screenshot) and manually adjust the box size by clicking on each of the box faces to adjust.
Then use Augusto's blog post (below) to programmatically capture (using viewer.getState();) and replay your box section (viewer.setCutPlanes(planes);).
https://forge.autodesk.com/blog/viewer-setcutplanes
Related
We currently use the model derivatives API to upload 3D models and later visualize them in a browser with the Autodesk Viewer v7 (previously Forge Viewer).
For different reasons we have been trying to hide and show parts of the model, but to do so in some cases we need to be able to hide geometric pieces of some elements while still being able to see the rest. For example if we had an element in gray (see image below) we would like to make the part of the element in red transparent.
I have looked into the Viewer API docs and there are functions that allow showing and hiding complete elements, but not cutting elements along a custom path.
While the docs mention the overlay functionality which enables us to add custom geometries by interacting with the THREE library that the Viewer runs on, drawing a copy of the whole model seems inefficient and prone to giving bad results.
Searching in SO I found that the THREE v71 library (which is the version the Viewer uses) has the possibility of occluding elements with the colorWrite option. See these links for reference:
three.js transparent object occlusion
Occlusion of real-world objects using three.js
I tried implementing something similar by using the colorWrite key when creating a new Three Material in an overlay, but nothing happens. This makes me think that either the Autodesk Viewer overwrites the render order (which makes sense) or openly ignores the colorWrite option. Does anyone know why and if there is a workaround for this? Or does anyone know if there is another way to cut an element that I'm not considering?
Please note that we have to do this with multiple elements at the same time and that reuploading the model periodically is not an option for us.
I got the following feedback:
The approach linked in the SO thread doesn't work, because we ignore both the colorWrite material property and the renderOrder mesh property. I also think that the approach would not work as expected in general, because using an invisible object to occlude a part of another object would always be view-dependent, and also occlude other objects in the background (so it wouldn't just 'cut out' a part of a single object).
Generally, this is not really a use-case for LMV, because it's a viewing tool, not a solid modelling tool.
Cut planes might help to get some of what you want, but they also have limitations:
It's possible to define multiple section planes to construct a 'shape' (that's also what the section box does internally). But since they are infinite, you wouldn't be able to cut away parts of one object, but not other objects (or other parts of the same object that intersect the cutplane). They're also designed to be 'outward' facing. The section box, for example, can only be used to narrow the scene down to some elements of interest. It's not possible to do the opposite, i.e. cut out some inner part of the design and keep everything around it.
This is what the section box could offer:
When using the section tools in the Forge viewer on models that cover a large area it's very difficult to use. Is there any way I can move the section gizmo to a certain point in the model? I would prefer it to be in the center of current view, not in the center of the bounding box of the entire model.
Unfortunately there's no official way to change the behavior of the section tool and its gizmo. I do agree that moving the gizmo relative to the view would make more sense than just using the bounding box, and I will report this request to the dev. team.
I'm using VBA to programmatically create a dynamic form in Access 2007. However, this post concerns a basic feature of Access, and is not specific to VBA. When creating a forms or report, the label control has the property Vertical, which if enabled displays the text rotated 90 degrees...in the opposite direction from what I would like.
The Vertical property rotates the text 90 degrees clockwise. Is there any way to make it rotate counter-clockwise..?? It seems goofy to rotate it that way, and I find it difficult to read and comprehend. In Excel, in Format Cells > Alignment > Orientation, it provides the ability to rotate in both directions from +90 to -90 degrees. Can Access do this..?
If the Access label control cannot do as I wish, I'm open to any and all suggestions, including the use of other controls such as MSForms, MSOffice, etc, and even layering with Subforms. But there's one technique I would rather not make use of: a graphical image that's been rotated. I tried it and it's rather beastly, especially with a gradient form background.
Here's a screenshot of what I mean. The first six labels are what Access gives me, but the last two I used GIMP to rotate selected areas of the image to show what I hope to achieve.
No, it cannot be done using MS Access built-in features. But you can use third party ActiveX components for text rotating at any angle, here is one of examples. Also you can use API functions for creating rotated text, see an example for instance here
Yes you can, properties:other -> vertical
I've started trying the autodesk-forge samples and I would like to customize how elements show up on the viewer.
So my question is: Is it possible to show the plan elements' dimensions (as shown in the picture below) with Autodesk-viewer?
I can see this dimensions if I click on an element, but I'm trying to get something like this when the viewer starts:
Thanks in advance.
There is no API to create dimensions at the moment, but you can use custom implementation to add Three.js lines like the dimension command is doing. You can basically add any 2D/3D custom graphic element to the viewer scene.
Unfortunately we have no sample that illustrates how to achieve that, you may take a look at the code of the Measure Extension, see line#60358 in viewer3D.js, but there is quite a bit of work to achieve...
Hope that helps.
I would like to face a problem for which I haven't seen a solution looking around in Internet. This is: I need to save the elements drawn by WEB users on a canvas space not as a flat image, but each one singularly. This in order to let the same user, or even other users, to modify every single element (drag-and-drop, erase, erase partially, ecc.) in a second moment. This should also help to eventually save a drawing history and restore it in next working sessions. All the examples I found were intended to save just a canvas flat image.
Update:
To better clarify: not necessary as layers, but for sure I thought to realize several different driving tools; a drawing element is the singular application/istance of a tool: a circle, a box, a added image, a straight line or even a free hand drawing that start from the moment of right button mouse click till it is released. Then the chance to save the elements state allowing to modify each one in a second moment.
You can't do this natively with canvas. You should look at using a third party library. Fabric is a library that was built to do what you want.
The base idea was to use convans as a container for vectorial shapes (triangles, squares, cirlces, etc.), manual drawn figures (see example http://www.williammalone.com/articles/create-html5-canvas-javascript-drawing-app/) and inserted images giving the chance to users to save/upload the content not as serialized image, but with each distinguished element in its original format in order to continue to work on them in a future work session.