Material module

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
crashfridh
Posts: 143
Joined: Thu Jan 03, 2013 1:42 pm

Re: Material module

Post by crashfridh »

It seems we're in one line here, good :-)

I see it that every object has a (possible) property, called Material, which is a link to a Material object. This Material object should be extensible using Python Property's since every user will have different requirements or would like to add different material properties.
At some point it could become useful to have some way to manage the materials of a document. I think for example, if you have a document which contains objects with a steel material, and you merge into it objects from another document which also have another steel material defined. I suppose we're going to define some default behaviour, for example rename the imported one as steel001. After a while, you'll want to see all the materials in your document, and clean up, rename, reattribute, etc. That might be a primary task of a materials module, reorganize materials and edit their contents... How do you plan to store the materials information? For example if I have 2 objects, each one with a steel material. Will each object store a complete copy of that material? Or will their material property actually link to another structure, so both objects can link to the same material?
I think the default behavior would indeed be to automatically rename the Name as is done now as well when creating new objects. When in the MaterialWorkBench I would like to be able to drag and drop a material on an object, or be able to make a selection and apply that material. This is quite straightforward. The most important thing to have first, is a Material property in those objects, so we can actually start implementing these things :-)
I see it that the Materials are objects themselves, and thus they can be linked to by many other objects.
What about individual surfaces/faces? Is there any way a special surface finish (color or other mechanical/optical property) can be applied?
I suppose you mean that you can see from the colors which material is applied? I would love such a feature and would definitely reuse that kind of code since I need it for my SEA module to show the acoustic temperature and vibration levels.
Frederik
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Material module

Post by jmaustpc »

Hi everyone
Just a quick thought, does this mean that because we are handling "materials" at the Assembly level that we would or would not need to add code to intelligently handle materials data to Part Boolean operations?

E.g.
1) A box of steel has a hole created by Boolean Cut of a cylinder of "Default or Undefined material" (or for that matter any material in this example) the result would be made of the same steel as the original Box
2) A box of "steel" has a Boolean Fuse of a handle made from a cylinder of anything other than "steel" result, error message and no output, or ask which material to define the result as, or leave result with default blank material with or without an error message etc.

Forgive me if this is a silly question? :)

Jim
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Material module

Post by jriegel »

Ok,

@Yorik
The idea is to have three levels of Material definition.
1. There is the Material (FreeCAD-)property which is a key/value map which can have a indefinite number of material-properties in it. But the only mandatory is the "Name" of the material. It is attached to DocumentObjects which need to handle Material.

2. A set of build in materials in FreeCAD, which are accessibly throughout the "Name". In this build in set we can define the most common/used standard materials. With the (FreeCAD-)property (1.) you can override every material-property from 2. for a single object

3. A extensive material DB hosted somwhrere in the future and have a extensive material definition. A OpenSource material data base. It is contacted if you need more specific stuff then we have in 2.

@eivindkvedalen
It make physically no sense to handle material to others then finit volumes of geometrical shapes. If you have a box, the surfaces of the box can not have different material! They can have different colors, but thats an other story. There fore I think about a seperate "View" object, which can handle visibility and color/appearance for a whole tree of objects. But thats in planing.

@crashfridh
Basically yes, but 1. can also fully define the material (have all material-properties defined). But for the sake of document size and later correcting and adding material-properties, the most common way should be, that 1. have only the Name defined and the rest is retrived from 2.

@jmaustpc
IMO it makes no sense to have Material on all Features. In the new PartDesign will be a Body object which bundles all the geometrical features of PartDesign. That will be the first place where material definition makes sense.

@all
There will be a lot of work around the basic material definition. Attaching material, managing material, generating Bills of Materials, some kind of editor for the material-properties (tree based I think). Let go the first work of defining enough kinds of material-properties so every Application has enough information to do useful work!
Stop whining - start coding!
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Material module

Post by jmaustpc »

jriegel wrote:@jmaustpc
IMO it makes no sense to have Material on all Features. In the new PartDesign will be a Body object which bundles all the geometrical features of PartDesign. That will be the first place where material definition makes sense.
OK Juergen. So if I am understanding correctly, a simple way of looking at Assembly "Body" is it is the most basic single real world component of an object.

For example lest say we are modelling a shovel, its basic fundamental real world components are
1) a shovel head - material is steel_pressed_steel_gradeXYZ
2) a handle - material is wood_hardwood_speciesXYZ
3) a screw to hold the head on the handle material brass

So each item 1, 2, and 3, would be modelled as a "thing" in PartDesign with its own Body, each body can have its own material, then the relative to each other placement (and then the global placement of the whole shovel) would be set in Assembly work bench.

Does that all sound about correct?


Another question, do we need an icon for materials some where? If so, what should it look like? I don't really know where to start so I came up with a few ideas and variations on those ideas. I have no idea if I am on the right track or not. Of course, any input or ideas are welcome.

https://sites.google.com/site/austpcpub ... ials_icons

Here is all 9 variations zipped up together for your convenience, should anyone so desire.
materials_01.svg.zip
(17.16 KiB) Downloaded 32 times
Jim
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Material module

Post by jriegel »

You got it exactly right!

And we need always Icons!! :)

I wouldn't use the ones which implies that you could set material to a face.
Stop whining - start coding!
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Material module

Post by jmaustpc »

jriegel wrote:You got it exactly right!
OK. :) Once I understand it and have used it a bit, I was thinking of writing something in the wiki along the lines of "basic Assembly for Dummies". Something aimed at newcomers to both FreeCAD and modelling in general.
jriegel wrote:I wouldn't use the ones which implies that you could set material to a face.
Ah! An interesting response, your interpretation isn't what I was thinking, the logic was supposed to be a broken brick showing its inside, that is, what it is made of, hence its material. But now that you have said it, I can see that it certainly could appear to be implying a face. :)

Jim
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Material module

Post by eivindkvedalen »

jriegel wrote: @eivindkvedalen
It make physically no sense to handle material to others then finit volumes of geometrical shapes. If you have a box, the surfaces of the box can not have different material! They can have different colors, but thats an other story. There fore I think about a seperate "View" object, which can handle visibility and color/appearance for a whole tree of objects. But thats in planing.
Of course, but it important to be able to specify what's on the surface, and a simple "color" is not enough. This could e.g be simple paint (in a given color system), and/or a specific surface finish (e.g polished). I would say that this is not a part of the presentation, but actual properties for the surfaces, with a default given by the selected material for the solid itself.

btw, how does other solid modellers handle this?

Eivind
eivindkvedalen
Posts: 602
Joined: Tue Jan 29, 2013 10:35 pm

Re: Material module

Post by eivindkvedalen »

jriegel wrote:Hi crashfridh,
your right, material is now really needed.

I have already implemented a key/value property in the Assembly branch. Every Item in the assembly framework will have a key/value map called Material. This will be the container
for all material related values. I think we should do a wiki page where we have a table of material property key names and a description.
I thought about material a long time now and its completely impossible to have a fixed set of properties for that. Let alone the name by itself, which differ from Application to Application.

The property map and saving/loading/undo/redo will be a C++ feature. On the other hand its a good idea to have a python module called Material.py as a proxy and interface to that data-map. This module could do some translation and calculation and would be easily extensible from interested Parties.

https://sourceforge.net/apps/mediawiki/ ... e=Material
What about this page: https://sourceforge.net/apps/mediawiki/ ... data_model

Should they be merged?

Eivind
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Material module

Post by yorik »

Great! This is coming along well.
Jim I liked most your icon nr 2. Maybe we can change the color of the wall icon, so that color really means "materials" throughout freecad...
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Material module

Post by jmaustpc »

yorikvanhavre wrote:Jim I liked most your icon nr 2. Maybe we can change the color of the wall icon, so that color really means "materials" throughout freecad...
Hi Yorik, could be a good idea, I have used the colours from your preferences-arch.svg, your Arch_Wall.svg is the same picture but yellow in colour.

You can see I have made my icons having started from your existing icons. :)

I have posted a few more icons that I have been looking at for a few things missing icons in Part.
  • Part_Create_Shape_from_Mesh
    Part_Refine_Shape
    Part_Reverse_Shape
Part Shape from Mesh, is just a couple of versions of a modification of your Arch_Mesh_to_Shape.

Part_refine_shape, I came to the conclusion that it was too hard to show enough detail on 2 solids but I think its OK to show to faces (or can be seen as a 2d view of a 3D solid)

Part_Reverse_Shape, as I understand it, this tool end over ends an edge, flips over a face or in effect turns a solid inside out. So I tried to show an edge being flipped, and the third attempt is what you get if you "create a ruled surface" from two parallel edges if you "Part_Reverse" one of those edges before you run the create ruled surface tool.

See this link, if you like?
https://sites.google.com/site/austpcpub ... al_icons_2

This is all 8 SVG files zipped up together
Part_Create_Shape_from_Mesh_03.svg.zip
(15.07 KiB) Downloaded 31 times
good night

Jim
Post Reply