How to create a nested stencil with rappid? - rappid

my application is based on the kitchensink demo. I would like to create a nested stencil but I can't figure out how to do it. Is this possible - any help?
Regards
Dieter

(I'm not sure about what you mean as "a nested stencil".)
there are basically two options to do "multi level accordion" for shapes in stencil:
create accordion on your own and use many stencil instances
use actual stencil and override renderGroup method to render group in group
group will have as content paper with its own shapes + group (before or after)
please let me know if I understood well and where exactly you are stucked

Related

Archilogic material preset choices in 3d.io viewer

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.

CSS Variable arrays - possible?

I understand how to use variables in CSS. They have helped heaps with speeding up my work flow for my clients' sites.
I have noticed on more than a few occasions I would write down variables with a number next to it to assign to a particular color or look because there is no array system in place. I ended up creating a quasi-array so to speak.
Like this
--c1: color:#ddd; //link color
--c2: color:#aaa; //quote color
--c3: color:#444; //body text
Is it possible to do something like this in CSS?
--c new array (color:#ddd, color:#aaa, color:#444);
Then call array
arr(--c,3);
instead of
var(--c3);
I get that CSS is not a OOP, but it would be nice to be able to handle data like this, especially if I can extend it across two dimensions. I also understand this may be a pointless exercise in theory as typing --c3 is faster than doing --c,3 or even --c[3]. Food for thought.
Properties in CSS cannot be grouped in arrays in the way you describe. This includes custom properties. Preprocessors such as Sass and LESS have maps and lists, but the way custom properties work (see section 3 of the spec) means it's not possible to group them and index off of them using the same syntax found in preprocessors.

How to use crossfilter with sigma.js and canvas

I'm really not sure how to get started trying to use crossfilter to change my network visualisation (generated using sigma.js - which uses canvas to draw the visualisation). I'm relatively new to js.
Basically I want the size of my nodes to reflect values tied to dates which I want to filter using crossfilter.
Is this possible?
Any help would be much appreciated.
You could use linkurious.js (a fork of sigma) and it's filter plugin. Here's a demo: https://rawgit.com/Linkurious/linkurious.js/develop/examples/filters.html

Learning Qt: Which methodology to be used for this "advanced UI"?

I am learning Qt5 using PyQt.
My goal is to create a UI with several goals (I will base my need on the screenshot below).
So here are my goals:
My need
Add directories to a list of directories to be scanned (I know how to use QFileDialog.getExistingDirectory for that). For this I'd like to have a "+" button.
When pressed the QFileDialog would open and a new row would be added.
Then I would scan the directory to look for files. It won't be my first implementation but I'd like to have a circular progress bar being displayed during the scan (at the place of the classic progress bar).
When the scan is done, the UI would display the number of files found during the scan. And the progress bar would be replaced by a tick mark icon (not shown on the screenshot...).
At the beginning of each row, I'd like to have a "-" button to delete the row.
My goal is to learn
This is important, I know I am not the first one to have the idea of such a UI.
So I not looking for a third party lib on top of Qt.
My goal is to learn Qt5 (with PyQt) with this example.
But if its unrealistic, please tell me!
My knowledge
Mode View: I implemented some basic model view widgets to display strings, and I understand how to extend the idea to tables or trees.
In this case the number of rows in the table would be handled automatically.
But is it possible to created a table that would display not only strings but also widgets?
Widget Mapper: I read that another methodology is the QDataWidgetMapper. In this case, I would have to deal with creation of news rows by myself, and then I would map data onto them.
But it seems to be a hard and long job.
So, is it a good idea?
So finally could someone tell what is the best direction for that?
I am not looking for code, but since it takes a lots of time to learn new concepts, I'd like to learn and use the correct one before starting coding.
Thank you for your help :)!
After so more searches, I found that I need to use the delegate methodology.
In Qt5 it's QStyledItemDelegate and in Qt4 it's QItemDelegate.
I could find a nice tutorial at the moment, but I started coded it.

How to do chalk style drawing with Qt

I want to use Qt to draw lines in chalk style, as you typically see on a blackboard. Here is an example of what I have in mind:
What is the best way to achieve this rendering style? Do I need to draw a lot of little lines with a special brush, or is there a better way to get the "curvy" style you see in the sample image?
And where is the best place to integrate this? Theoretically it would be ideal to get this underneath QPainter, e.g. in a custom QPaintEngine, so that e.g. all the various QPainter::drawLine calls end up using the chalk style. However, it seems while the QPaintEngine interface looks perfect for this, the class itself isn't meant to be used for this purpose...
Thanks in advance for any help.
Greetings,
Fabian
I have solved the problem in a different way. Using textured brushes didn't provide good results (maybe my fault). QGraphicsEffect was unfortunately not an option since my rendering is not based on QGraphicsView.
What I have done in the end:
Derived an own class from QPainter (i.e. ChalkPainter)
Added a new drawChalkLine() method to ChalkPainter. This method takes the passed line, splits it into smaller chunks and renders these chunks as bezier curves via QPainter::drawPath. For each bezier curve chunk I randomly shift the control point orthogonal to the line.
Next I added additional rendering methods to the ChalkPainter class, such as drawChalkRect(), all internally using the drawChalkLine() method.
This is not the most elegant method since I can't use the QPainter methods directly, but it provides good results for my purpose. Here is an example:
I would start looking in QGraphicsEffect's way.. I think it should be possible to develop such a filter which will produce similar effect..
I'll update in here answer on your comment.
No, QGraphicsEffect can be applied 'per graphics item'. If you have a look on QGraphicsItem you will see that there is a setGraphicsEffect method, so you can design an effect which works on QGraphicsLineItem for example and set it only on lines you want to look chalky..
Important thing is that you don't have to operate on pre-drawn image, you can either make it completely owner-draw item with graphicsEffect (for example make an assumption that effect is only applicable on QGraphicsLineItem) pre-draw it using drawSource() and then modify OR draw it completely from scratch..
I would love to help you with some coding, probably will do it somewhere around next week, since I will need similar thing for project I am working on now.. but physically don't have time next few days..
I'll update an answer with sources link as soon as it's done.
Custom brush also looks really promising..

Resources