Manifold Geometry // Многообразная Геометрия

Analysis Situs 1.0 is out

/ Просмотров: 768

Well, it took quite a while for the new release to come. As promised, I was waiting for the recent number of downloads to reach the previous release figure. And then waited even more, because the number of new features was not satisfying enough. I was also thinking to surround these dry and boring release notes with some comments so that it becomes more like a status update. That's the idea I stole from Chris Taylor and his Kanoogi gaming platform.

You can download Analysis Situs 1.0.0 on its landing page as usual.

CI/CD

Yep, we have it now. Only for Windows so far, but we'll extend the automatic builds to Linux once I sort it out. Still, Analysis Situs is operational on Linux and works quite well there. The documentation you can find at www.analysissitus.org is now being published nightly and is always up-to-date. The tests are now decoupled from the build procedure and run independently, unlocking future heavy testing. The CI/CD process is Jenkins-based if you're curious how all this is done.

For end-users

Hidden line removal

The hidden line removal (HLR) mode can now be activated right away by pressing the "h" keyboard button. Read more in the corresponding user's guide's section. HLR is useful for generating engineering drawings that are required by manufacturers. Personally, I'd love to use this feature for scientific publishing whenever I need to insert a CAD model's image into a paper. This would require SVG export, and that's definitely on the roadmap.

 Hidden Line Removal view for generating drawings.

Save 2D DXF

There's now a simplistic tool for exporting 2D DXF files. DXF (Drawing Exchange Format) is a popular vector format used for the manufacturing and exchange of engineering data. A bunch of manufacturing-oriented software speaks the "DXF language." DXF files are typically used for sheet metal fabrication. In such scenarios, a full drawing with tables, layers, and styles is often not required or even unacceptable. A DXF file with cutting lines only (a "cut file") is something you can generate with Analysis Situs from now on. Read more on this subject in the related blog post.

 DXF drawing exported from Analysis Situs and imported to Autodesk DWG TrueView.

Find several faces by their indices

If you know the indices of feature faces, e.g., from a unit testing report or whatever persistent data source, you can now locate the corresponding faces visually. Both whitespace and comma-separated list formats are acceptable.

 Locate multiple faces (features) in Analysis Situs.

Persistent selection

Once you're done with the interactive selection of faces in the 3D viewer, you can save the corresponding faces' indices in the project tree. Like this, you can return to your selection later on. This functionality is useful in feature recognition scenarios as it allows us to navigate over the extracted model's features.

 Persistent features in Analysis Situs.

Assemblies

Although Analysis Situs has been initially designed for working with single parts, there is a certain demand in supporting assemblies as well. This requirement comes along with the CAD formats support, such as STEP, which is capable of representing hierarchical CAD products. Ignoring assemblies in Analysis Situs would inevitably lead to lossy data exchange as you unlikely want to have your CAD assembly as a single piece of geometry (although there are some cases when it can be advantageous).

Supporting assemblies is a two-fold problem. First, the UI of Analysis Situs is not really tailored to assemblies, and it won't go that way. At the time being, I don't see a good architecture for mixing up the part-scale analysis with assembly-scale processing algorithms. But, there's another side of the issue. Analysis Situs is also a CAD framework, so it cannot ignore assemblies. The solution to this is to treat assemblies as the extra data sources for the GUI framework we have.

 Working with assemblies.

So, as the first stage, we added support of open-source OpenCascade's XDE framework. Although this framework comes with its inherent downsides, it still allows for a quick jump into the world of assemblies, and, interestingly enough, it unlocks data exchange scenarios. A brilliant example here is CAD Exchanger SDK with its XDE Converter that can be plugged at the input port of your data processing pipeline.

FBX export

Gaming is a growing industry, as well as AR/VR that finds more and more use in engineering applications. Both fields are kind of accelerated thanks to the availability of decent game engines, such as Unity, which is becoming amazingly popular these days. It's not surprising as Unity offers a visual development environment, where flexibility is achieved through embedding your own logic written in C#. And, yes, C# is much more friendly than C++ after all.

 KAMAZ truck having 391 components exported to FBX and imported in Unity. Courtesy of Rapisarda Antonino via GrabCAD.

Preparing 3D data for games and AR/VR scenes is quite a problem. There is no direct way of effortless commuting CAD and gaming worlds, and the existing solutions are quite costly. Speaking about Unity, it is not that awful though. You might be aware of Unity's capability of importing FBX files that are feature-rich asset containers holding not only meshes but also animations, visual properties and possibly even NURBS. Fortunately, there is a free C++ SDK by Autodesk that allows reading and writing FBX files royalty-free. So, long story short, we now integrate this SDK to Analysis Situs to be able to write FBX files with assembly structure and colours preserved. The script to do this is a three-liner:

> asm-xde-load -model M -filename your_input.stp
> asm-xde-generate-facets -model M -normal
> asm-xde-save-fbx -model M -filename your_output.fbx

So we first load the document as an assembly into the internal data structure, then generate facets of a certain quality, and finally write these facets in the FBX format.

Distance measurement

That's a must-have feature for engineering inspection of shapes. The distance can be measured between a couple of vertices, edges, or faces.

 Distance measurements in Analysis Situs.

Shape browser

One user story that was pretty hard to accomplish before is the exploration of compound shapes (those having TopoDS_Compound type). We now have a brand new "shape browser" to inspect the contents of topological variables.

 Shape browser for topological objects.

Facets to faces

One solution for turning mesh-based 3D models into CAD shapes is as simple as converting all facets to faces and maximizing the result. Of course, such an approach will not bring you any precise analytic shapes, but it would certainly unlock downstream applications. E.g., you will be able to export STEP files, apply modelling operators and do whatever you're used to in a CAD system.

 Turn facets into faces.

For software developers

Plugins

Not many, but some have already adopted Analysis Situs as an open-source SDK for building up their own products. People tend to fork, copy, and paste the pieces of the Analysis' code, which's completely fine in most cases. But there is now a better way of customization: plugins. The possibility to load dynamic libraries was there since the early days of the project (I remember coding it in my car at night, waiting for sunrise to start fishing). As practice shows, it was unusable. But now, Analysis Situs will try to load everything you put in the "asi-plugins" directory. That's a pretty convenient way of extending the software with your own commands. The plugins have access to all UI/batch objects, so you can manage the Analysis' desktop in case of need. Read more on how to write your neat little plugin here.

Build algorithms alone

Analysis Situs is full of features. But sometimes, you don't need all these visualization pipelines, UI controls, and data model things. If what you're looking for is just a set of algorithmic libraries, you can build them alone by setting the "DISTRIBUTION_TYPE" CMake variable to "Algo."

 Build algorithms only.

Tcl variables

We can now set and unset Tcl variables programmatically in C++. This feature is exploited when working with assemblies by giving the corresponding XDE documents their distinct names:

> asm-xde-load -model M -filename <filename>
> asm-xde-browse -model M

To know the type of a variable, use the dedicated whatis command:

> whatis M

Server and CLI versions

Running data processing pipelines without UI is a must-have feature for scriptable software. Since ver.1.0, we have a command-line interface (CLI) where all commands are still available, though, without any visualization and UI panels.

 Analysis Situs CLI.

For running on a server, we support UDP (universal datagram protocol), so that you can send Analysis Situs Tcl commands for execution remotely. This feature has been tested in production already and it works nicely.

 Analysis Situs server communicating via UDP.

Read more on this in the user's guide.

Improvements in isomorphism

 I'm practicing my Wacom tablet for hand drawings.

The isomorphism algorithm, which is a backbone of feature matching functionality, has got some improvements for production use. Here is what was done:

1. History is now exposed in the interface of isomorphism, so you can match pattern's and global faces' IDs without much pain.
2. Different matching strategies were introduced. One useful strategy is to disable the check of subshapes' quantities, this way generalizing the isomorphism logic to non-isolated features.
 Non-isolated features can now be matched with isolated patterns.

Serialize shapes to base64-encoded binary buffers

Feature matching requires having a dictionary of persistent feature patterns. You may want to organize such a dictionary as a folder in the filesystem, a JSON/XML file, or even a remote database. To store feature patterns, the corresponding AAG should be serialized into a buffer. The way we do so is via using the newly introduced Shape Serializer utility class. You can now define feature patterns interactively as the following animation shows.

 Serialize selected feature as base64-encoded binary buffer.

Wrapping up and more news

Started off back in 2015 for educational purposes, Analysis Situs is becoming my primary indie project. It's fun as hell to develop open-source toolboxes helping people in solving their real issues, ranging from visualization to manufacturing. I want to thank all the folks who provide their feedback on the software — they tolerate a lot of crap in there. Being open-source is not an excuse to deliver a somewhat shitty product, so let's make another significant leap in 2021 towards making things more mature.

And here are some updates not directly related to Analysis Situs:

• Our youtube channel has been given a new breath. Check out our educational CAD programming course in C++.
• The look & feel of Manifold Geometry (this blog) has been adjusted for better readability. I was also doing some tiny housekeeping things at the backend of the underlying MaxSite CMS, which is by the way a cool alternative to WordPress.