I have a question related to 2d viewing and 3d viewing in cad and modeling products.
What is is 2d viewing and 3d viewing in Fusion ? or other modeling tools. Please explain.
Thank you
In a 3d modeler tool like Fusion360, a 3d view shows the 3d model. You can decide what renderer to use to show the model, but in general it would be wireframe, flat shading, silhouette, etc... in these view you can pan, orbit, zoom and this is the place where you do your 3d modelling.
2d views in these tools, usually derives from your 3d model, and could be of different nature. They can be sheets representing projections of your 3d model on various 2d projection plans, sections, annotations and/or dimensions, borders, title block, ... These views are usually needed to add additional information before you send them to a manufacturer, and/or illustrate/annotate your model. #d views are dynamic in a way, that the changes you do on the 3d view/model will update your 2 views automatically less some additional information you added by hand.
In a 2d package, there is no 3d views and the 2d view is the place where you design your 2d drawing, and you may have additional 2d sheeets view like in AutoCAD, where paper space sheets can contains model viewports to arrange special view of your drawing (note I took AutoCAD as an example even if the model space view can contain 3 objects).
Hope that helps,
Related
I'm creating a 3D model editor application using THREE.js where you can load a CAD model and have it display on the screen. You can pan, zoom, rotate the camera anywhere around in the scene to view the CAD model from any angle.
I want to add support to be able to draw an arbitrary rectangle on the screen (marquee select box) and anything inside this box I'd like to become selected.
What is a good algorithm to use for this operation?
My first thought was to take every loaded CAD part (that can be selected), and project its bounding box onto the screen. Then test each of these projected bounding boxes to the selection box drawn on the screen for matches. This should work, however I'm worried it would be very slow for large CAD models with 1000's of selectable parts.
Is there a better way to do marquee selections in 3D? Can raycasting somehow be used to speed up the selections?
Without knowing more details about your cad models it'll be a bit hard to give exactly relevant suggestions but I can suggest a few things I might try.
Use Hierarchical Bounding Boxes
If you have a multi-level tree of meshes you can generate bounding boxes for the non-leaf nodes of the tree. This isn't supported directly in THREE but you can manually create and check against these objects before checking if the child objects are within the marquee.
If your tree isn't spatially organized very well or is very flat then you can build an oct-tree and traverse the oct-tree nodes before checking the meshes.
Of course these data structures have to be updated whenever meshes move in your CAD model.
Cache World Bounds
If you cache versions of the bounding boxes on all the meshes in world space then instead of projecting the bounds into screen space you can create a frustum from the marquee in world space and check the all the mesh bounds without having to do any transformation of those boxes.
Asynchronous Checking
Instead of gathering all the intersected bounds on a single frame you could gather them up over multiple frames if it is taking a long time.
Unfortunately I don't think raycasting can do a whole lot for you here.
Hopefully that helps!
I am using AFrame to load some 3d models from a third-party (using the GLTF-Loader). Unfortunately some of the models have their origins set to random x,y,z coordinates so they look offset when they appear. Is there any way to null their offsets without moving the a-entity they get loaded into?
I don't think you can make a general assumption about what the center of a model is. Imperfect solutions are:
Apply a manual offset from observation of the particular model.
Edit the model center of coordinates in a 3D package like Blender or Maya and re-export to glTF.
I have a model of a human body, I am able to load that in threejs with the obj loader. Now after loading the model in threejs I need to do some post-processing like
scaling the length of arm
scaling the length of leg
Is it possible to do that, how can I do that ? I know that obj file store the necessary information to create meshes(i.e. vertices and faces) moreover material information if required. Can we add any extra information to achieve this?
You want to rig your model. You need to define the skeleton, and Three.js can then use "bones" to scale, position and stretch aspects of your mesh. A simple example of a rigged model in three.js is here:
https://threejs.org/docs/#api/objects/SkinnedMesh
Rigging your model in blender is available as a tutorial here: https://www.youtube.com/watch?v=eEqB-eKcv7k&index=15&list=PLOGomoq5sDLutXOHLlESKG2j9CCnCwVqg
I am visualizing a graph using Three.js and for each node of the graph I add a label using TextGeometry. It is a pretty small graph but when I add text my application gets really slow. What should I do about it?
TextGeometry is more suitable for cases when you are really interested in rendering the text in 3D. It will create complex geometry that will surely slow your app down specially when there is a lot of text or you use CanvasRenderer.
For labels, it is generally better to use 2D labels, which are way faster to render. There are many different approaches to this. These can go on top of the Three.js rendering canvas, on a separate canvas, or even normal HTML nodes positioned using CSS properties. Alternatively, you can dynamically create small canvases of your label texts, and use them as sprite textures always facing camera - this might be the easiest way as the labels would be part of the 3D scene as your other objects. For a separate layer approach, you need to use unprojectVector or such to figure out screen XY coordinates to match your 3D scene positions.
See these SO posts for example:
- Dynamically create 2D text in three.js
- Canvas and SpriteMaterial
- How do I add a tag/label to appear on top of several objects so that the tag always faces the camera when the user clicks the object?
I have model soucast1.3DS
If I open this model in CAD Autodesk Inventor it looks
model in Autodesk Inventor
if I use simple application using OpenGL it looks
model in OpenGL app
GL.Color3(Color.Aqua);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
DrawMatrix(); // draw model
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
GL.Enable(EnableCap.PolygonOffsetLine);
GL.PolygonOffset(-1.0f, -1.0f);
GL.Color3(Color.Black);
DrawMatrix(); // draw model
so, my question is:
How can I get same result in my application (OpenGL) as you can see from Inventor?
(Only edges of areas are black)
There are many approaches. You could use tricky shaders combination, stencil buffer or object scaling:
Draw slightly scaled-up model with black color, dropping front faces (e.g. GL_CULL_FACE=GL_CW). Then draw normal model with correct scale and colors, dropping back faces (GL_CCW).
Not a perfect solution, usable for cartoon-like shading in games; may be too unprecise for CAD. If it isn't fit for you - google opengl edge outline.
To clarify things: 3D modeling software always have information about edges in addition to faces, so they can just draw edge lines after model is drawn, and you getting an outline. If you don't have edges (or, like in games - don't even want to have edges because of memory consumption and other issues) - you have to perform some form of edge detection or hack.
I solved it. Change model to STL (contains triangles and normals), found areas (compare of normals) and write algorithm to find border.
And result is:
Opengl