Archilogic material preset choices in 3d.io viewer - aframe

I would like to create a web app that lets the user choose between different presets for floors and walls in an archilogic 3D scene.
https://spaces.archilogic.com/model/template/new?modelResourceId=f67ffde0-278e-11e4-9f8c-7dda0d61ae4a&mode=edit&view-menu=camera-bookmarks&main-menu=interior&logo=false
Just like in this editor, however, I need the materials menu to be simpler (user chooses from different preset textures which were uploaded earlier by the admin with the corresponding diffuse, spec, normal, and alpha maps).
I was browsing through all the repos of archilogic but couldn't find the source code of the 3D editor in order to make it simpler.
Does anyone know if it's available, if not, which direction should I be headed in order to develop such an app?

This is a feature that still is on the roadmap and not done yet, but there are ways to accomplish something similar.
So above all, the following description is due to all this not being ready and polished yet. It's an experimental way of getting to your goal.
Let's break this down.
Predefined materials
Archilogic has a long list of pre-defined materials right now that you can pick from. They're agnostic to the type of architectural element, so you can use any material on any element. Here is the list of available materials.
Floor & ceiling
Floors and ceilings are contained in a single element with an io3d-floor component.
So assuming you've got your floor and ceiling in the elem element, you can do the following to select a pre-defined material:
elem.components['io3d-floor'].data.material_top = 'wood_parquet_oak';
elem.components['io3d-floor'].update()
this will change the floor material to the given pre-defined material, in this case "wood_parquet_oak". For the ceiling material, change material_top to material_ceiling.
Walls
Walls work pretty much the same, but the properties are material_front and material_back instead of material_top and material_ceiling.
Other architectural elements
For other elements, you can probably work it out by looking what is available as properties in .data of the associated component (e.g. io3d-wall for walls).
Custom materials
This is a little harder to get right as there's a bunch of properties involved in making a custom material.
Assuming you have uploaded textures somewhere, you'd define the material like this:
elem.components['io3d-floor'].data.material_top = {
mapDiffuse: "https://example.org/texture.hi-res.gz.dds",
mapDiffusePreview: "https://example.org/texture.lo-res.jpg",
mapDiffuseSource: "https://example.org/texture.source.jpg"
}
You can also give it additional parameters, such as size: [3,3] scaling the texture to cover 3x3 meters in the model before repeating itself or passing normal maps or specular maps, but I exclude these for brevity.
Note: You can use this kind of material definition for anything that also accepts the pre-defined materials mentioned above. It's important to follow the naming convention and you need to have a gzipped DDS texture available as well as JPEG versions.
The 'Source' image is optional, but the other two have to be present or it won't work.
Summing it up: This functionality isn't fully ready yet (as you can tell by the quite contrived way of getting this to work) but this workaround will do until a better way is going to be available.

Related

Need to outline several contiguous areas on map

I am working with maps that are based upon the lot and block survey system. So, for example, my house could be a parcel identified by block 34, lot 2. For every block, there are usually multiple lots and they are all within the same contiguous area. My users can query for block and lot, and the map will zoom in and display that exact block/lot and outline it. What they want to do is to show all lots for a specified block and draw an outline around the entire block.
I can use the JavaScript API and QueryTask execute() method to get all of the lots/features for a block. However, I do not know if there is a way to aggregate the feature data such that I can calculate and draw a border surrounding them all.
I have tried the executeForExtent() method and it works, but the extent, of course, is a rectangle, which means that while the outline will encompass all of the lots, the edges will have partials of other blocks and lots.
I know it's possible because I have seen it, but I do not have access to that code or the folks who developed it.
Does anybody know of a way to create an outline such as the one I'm describing?
TIA
I think you're looking for a way to calculate a convex hull which you can do with the geometry engine in the ArcGIS API for JavaScript. See https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#convexHull
Update: or maybe better the union method as suggested by #cabesuon in a comment below. Same basic principle - use the GeometryEngine :)

Sketchup API for navigating around a model (eventually to integrate with Leap Motion)

I'm trying to use to SketchUp API to navigate around 3D models (zoom, pan, rotate, etc). My ultimate aim is to integrate it with a Leap Motion app.
However, right now I think my first step would be to figure out how to control the basic navigation gestures via the Sketchup API. After a bit of research, I see that there are the 'Camera' and the 'Animation' interfaces, but I think they would be more suited to 'hardcoded' paths and motions within the script.
Therefore I was wondering - does anyone know how I can write a plugin that is able to accept inputs from another program (my eventual Leap Motion App in this case) and translate it into specific navigation commands using the Sketchup API (like pan, zoom, etc). Can this be done using the 'Camera' and the 'Animation' interfaces (in some sort of step increments), or are there other interfaces I should be looking at.
As usual, and examples would be most helpful.
Thanks!
View, Camera and the Animation class is what you are looking for. Maybe you don't even need the Animation class, you might just be ok with using the time in the UI class. Depends on the details of what you will be doing.
You can set the camera directly like so:
Sketchup.active_model.active_view.camera.set(ORIGIN, Z_AXIS, Y_AXIS)
or you can use View.camera= which also accept a transition time argument if you find that useful.
For bridging input you could always create a Ruby C Extension that takes care of the communication between the applications. There are some quirks in getting C Extensions work for SketchUp Ruby as oppose to regular Ruby though - depending on how you compile it.
I wrote a hello world example a couple of years ago: https://bitbucket.org/thomthom/sketchup-ruby-c-extension
Though note that I have since found a better solution for Windows, using the Development Kit from Ruby Installers: http://rubyinstaller.org/
This answer is related to my comment above regarding the view seemingly 'jumping' when I assign a new camera to the current view using camera=, but not if I use camera.set.
I figured out this was happening because the camera FOV for the original camera was different, and the new camera was defaulting to an FOV of 30. By explicitly creating the camera with the optional perspective and FOV arguments from the initial camera solves this problem:
new_camera = Sketchup::Camera.new new_eye, new_target, curr_camera.up, curr_camera.perspective?, curr_camera.fov
Hope people find this useful!

Documentation Generation - What boxes should I aim to tick?

I'm looking at requiring my team to document their code more thoroughly for some major upcoming projects and to make life a little less painful, I am steering towards XML documentation generators such as Sandcastle, Doxygen or Box Live Documenter.
What are the key considerations I should keep in mind when evaluating the best option and what experiences have led you to a particular decision?
For me the key considerations would be:
Fully automated: Can it be set up in such a way so that pretty much
no outside work is required to
create or edit the documentation.
Fully styled: Can the documentation be fully styled so
that it looks great in a wiki or pdf
after it’s generated. I should be
able to change colors, font sizes,
layouts, etc.
Good Filtering: Can I select only the items I want to be
generated. I should be able to
filter the namespaces, file types,
classes, etc.
Customization: Can I include headers, footers, custom elements,
etc.
I found Doxygen could do all of this. Our workflow is as follows:
Developer makes a change to the code
They update the documentation tags right above the code they just changed
We click a generate button
Doxygen will then extract all the XML documentation from the code, filter it to only include the classes and methods we want, and apply the CSS styling we’ve pre-made for it. Our end result is an internal wiki that looks the way we want, and doesn’t require editing.
Extra: We have all our projects in various git repositories. We pull all these down to one root folder and generate the docs form this root folder..
Would be interested to know how others are automating even further..?
Who is paying for the documentation and why? (is the system stable enough, does it add enough value)
Who is going to read it, and why is she not using a more effective communication channel?
(if correct mostly distance in time/place)
Who is going to keep it up to date.
When are you going to destroy it? (Automatically if it hasn't been read or updated in the past three months?)
I mostly prefer better code to make my life less painful, over more documentation, but I like scenario & unit tests and a high level architecture description.
[edit] Documentation costs time and money to write and keep up to date. JavaDoc style documentation has a serious detrimental effect on the amount of code simultaneously visible and might be a good idea for the developers using the code, but not for those writing it.

What good graph layouting, editing & drawing tools are there?

While doing software development I periodically come across the need to draw some graphs for my own use. Sometimes they illustrate relationships in a DB, sometimes they illustrate relationships of code files or classes, other times there are other objects... Anyway, the basic need is the same - I've got some set of nodes & edges that I would like to lay out neatly, add some informative colors/texts/styles and optionally print it out in the end (over several pages if necessary).
Is there a tool that would allow me to do this easily? Features that I would expect:
Import basic node/edge information from a file (the raw data that I have extracted from the DB/code/whatever);
Automatically layout some or all nodes in the graph;
Allow to manually adjust node and edge placements;
Node group manipulation features (relayout, rotate, scale) would also be very nice;
Ability to manipulate visual aspects of the picture - change lines, colors and fonts; add arbitrary texts and pictures (possibly attaching them to nodes/edges);
Ability to modify node contents (sometimes I need just a simple text; sometimes it's a little table; sometimes it's a bulleted list; etc.)
Save/load/print (including to several pages with overlapping areas for gluing together)/export to image (both vector and raster with anti-aliasing).
Added: Here is a sample graph I tried to visualise most recently. I'd like to get a useable layout that needs minimal tweaking before it can be printed.
Graphviz is a long-standing popular one.
I really like yEd's layout engine, which I feed GML data to (but it supports other formats).
You can use Cytoscape, that's a graph visualization tool. I like the forced directed lay out.
I find Gephi very nice, mainly for two tasks:
Browsing the graph, i.e. hidding some parts, moving nodes, trying to understand its properties by playing with it.
Rendering it to export it for a presentation or article?
There are nice layout algorithms included by default, and you can easily install plugins from within the tool.
And if your goal is to get an informative and readable representation of your graph, you might consider using hive plots. Description, examples and tools are available from this page. The basic idea is to use a deterministic method (by opposition to force-based layouts) to place nodes, based on a few attributes or topological measures. The resulting representation allow efficiently comparing different graphs, or even the same graph considered from different perspectives.

Latitude/Longitude Qt4 widget?

What is the best starting point for a Qt4 widget for entering Latitude/Longitude in DD:MM:SS format (degrees, minutes, seconds)? Customize a QLineEdit? A series of spin boxes?
There are some variants:
QLineEdit with Validator - wasn't good enough for us, we couldn't achieve usable editing and proper view (with ', '' and degree symbols in place and ability to forbid incorrect values and still allow semi-correct states, and the target behaviour is not to mark errors and force user to fix them, but to allow user to enter only valid values).
Three spin edits in a line with the proper symbols between them grouped as a single widget and some code to move keyboard input from one no next when needed etc. Looks good enough in some cases, and you can find the variant of realization in the famous Marble project.
Still, my boss said that this approach is almost as ugly as first, so here is another approach: subclass QAbstractSpinBox, as Trolltech did in their QDateTimeEditor. In fact, behaviour of such a widget is near similar to one, implemented in QDateTimeEditor.
I, myself didn't do it yet, cause of task priorities, but will have to do.
I would use a QValidator, attaching it to a QLineEdit using QLineEdit::setValidator().
You'll need to subclass so you can implement the validate() function and possibly the fixup() function for your particular case, since the two validators included with Qt only cover integers and doubles.
It's a bit friendlier, in my opinion, to provide a single input box for this rather than three separate spin boxes (which could look cluttered and isn't as nice to type in).
[Edit: One other alternative is to set a "validation input mask" on your QLineEdit using QLineEdit::setInputMask(). You might want a line edit with symbols already in place and placeholders for other characters, for example, and this approach will give you something similar to that. The QtDemo app has an example of this which you can check out by choosing Widgets->Line Edits (Widgets is on the second page).]

Resources