Yeah, no that’s not what I meant.
My script will do the following:
load STEP file list from given folder
check hashfile if any file needs conversion
load the STEP file
modify scale of part, change lines to shaded
safe as VRML
new: create preview with povray
modify STEP file preamble and add license
modify VRML file preamble and add license
repeat 3. for any other file not done yet
write new hash file
So once I scaled and saved the part as VRML I then scale it again and create a povray scene, which is then rendered (directly) or I do that afterwards… depends on how I go.
Anyhow, once I found a camera position and relative part size that works and gives nice results I just scale the part and don’t mess with the camera anymore… should be easier that way, no?
I have updated the step files within my repo.
I’m currently implementing the better vrml export. @maui: I think i will write a separate file with the color definitions and maybe even a handler class. This should make it a bit easier to manage colors. Would this be ok for you?
this is done importing the VRML file generated by kicad StepUp script exporter with material properties, and importing directly the materials in Blender
@Joan_Sparky, with the new exporting routines you will not need scaling in FC anymore Draft.scale(part, delta=App.Vector(0.3937,0.3937,0.3937), center=App.Vector(0,0,0), legacy=True)
the scaling is done numerically on coordinates …
that is avoiding size increasing that would be done by a new tessellation factor because of the scaling…
I also got marmnis code working (exports with colored faces as expected, pretty neat and how it should be), just fiddling with the camera and light at the moment as the settings that come out of that macro are not useful.
Also his tessellation setting was at 1, the 0.03 you suggested is better.
Made me a 10x10x10 mm test object for this…
Do you know how to get surface smoothing for the renderer set up?
One can still see the edges of the faces on that sphere…
You can specify both flat and smooth triangles in the same mesh. To do this, specify the smooth triangles first in the face_indices section, followed by the flat triangles. Then, specify normal indices (in the normal_indices section) for only the smooth triangles. Any remaining triangles that do not have normal indices associated with them will be assumed to be flat triangles.
Looks like it needs to be done in that FCmacro, that builds the povray file… but I have no clue how.
@maui: I started the implementation of the new vrml export routine.
I just need to test the changes. Then I will extract the export part from the Freecad Macro file, and use it as import for the cadquery script. (I try to have this functionality only at one place.)
Do you have some test parts, which i can use?
Plans for the next days (I plan to be finished by Sunday):
Testing, exporting of my xh connectors with this script (extraction from Macro file), merge with master (if necessary) and pull request.
If this all works, i will extract the color part and implement it similar to http://pyopengl.sourceforge.net/pydoc/vrml.csscolors.html (I will use a dict for the color definitions. Unique name as key. Content: a new class for the management of colors.)
Should we open another communication channel for future questions regarding this script? (If yes: how can i reach you?)
So yeah, pretty straight forward…
Once I exported the VRML I grab the mesh-pieces again, get their boundingbox, calculate center and max dimension, then adjust position to get the mesh-center to <0,0,0> and scale it, so it’s longest dimension is 10mm and then it goes into a pov ray scene that has a camera and 2 lights set up (one yellowish camera light, one blueish backlight), to take a nice shot of a 10x10x10 mm big something.
Things that would be pretty cool:
material setup to have bells and whistles (I think I leave this to @maui )
automate povray rendering (I’ll do that)
mesh triangle smoothing (no idea, do you think marmni could lend a helping hand there?)
@maui, I never want to see those ugly FreeCAD overview previews again
that’s fine … I would start with a small dictionary adding colors that have already material properties as i.e. the list material_properties_names=["as is","metal grey pins","gold pins","black body","resistor black body","grey body","dark grey body","brown body","light brown body","blue body","green body","orange body","red_body","pink body","yellow body","white body","light brown label","led red","led green","led blue", "led white"]
detailed at the beginning of the exportPartToVRMLwMaterials.FCMacro
those materials have been generated following Mario Guidelines doc…
Most of the models are the ones I already share… and @maui should have some of them even refined with specularity/reflections…
I used the new script of @maui to upgrade my VRML exports, then he pointed me to a script from some bloke on FreeCAD forums that can export FreeCAD meshes to povray with colors (not materials or surface smoothing unfortunately) and now I’ve got povray rendering automated:
I could do this all day
I’ll upload the script next so you can have a play with it.
The models I need to go over again, as some of them have legacy issues.
If you don’t mind, i will use the license adding stuff from this script within the step and wrl export features for the scripted 3d parts. I should be finished by later today.
@Rene_Poschl@Joan_Sparky
if it is fine for both of you, I would add to the module 3D license something like gEDA:
As a special exception, if you create a design which uses this symbol, and embed this symbol or unaltered portions of this symbol into the design, this symbol does not by itself cause the resulting design to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the design itself might be covered by the GNU General Public License. If you modify this symbol, you may extend this exception to your version of the symbol, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version
This is also in planning to be done for KiCad libraries too…
Maurice