Open Neon22 opened 3 years ago
Added ability to ignore extra treadles in Tieup. Some files include full treadle plan even though the draft uses only the first few.
Added ability to load the Author etc metadata as well as Notes. Made available via stats command Also added Source program and version - but not currently propagating to json file as maybe its now this program which is generating them. Especially if a wif file is saved eventually.
The branch grows:
Added Tartan and twill generators to pyweaving menu. more changes coming here with render options and stats.
Also outfile will use directory from infile if no directory defined in outfile.
Added ability to load wif files with liftplans. They were getting in but not rendering. wif reader adjust to pass liftplan setting in.
Started on render renaming for clarity but these changes totally superseded in next commit
Fairly large set of changes.
Color class modified for wider use and can load Colors as well as tuples.
Found problem where warp thread colors and drawdown were reversed horizontally. The Threading section was correct. Turns out this problem is invisible if the draft is symmetric.
Large number of changes. Added a Drawstyle class - this defines the layout, spacing and flags different modes of showing the draft,
More coming to try to maximise info that can be extracted from a wif.
Add fix to get liftplan option back into render (still only png)
Also enhanced tartan generator to use the STA styles and deal with mirrrored and asymmetrical as wel as rectangles with sep warp and weft counts. Setup for Z and S twill but not propagated through yet
Major refactor too make all sections have a startpos and return an endpos. Can now rearrange layout.
Exercising the refactor to add a Title to the top of the draft
Added spacings to renderer. now can render warp and weft with variable spacing. I need a few more samples to ensure its all good.
Two styles - "Clarity" where a progression of larger boxes for larger threads.
two pass approach - finds all the spacings and fill sin defaults, finds ratios, determines box sizing and then stores on each thread as yarn_width iv.
Added Prelim satin generator. Calculates the satin numbers for regular satins. Not yet doing the two irregular ones 4,6 Also not yet drawing drafts.
Added ministats section under title with summary of warp,weft,yarns, floats, warp/weft balance Also heddle counts on LHS of the Threading. Listing number of heddles need for each shaft.
somewhere render without an outfile stopped working - fixed.
Updated the twill generator to take a shape string instead of a 2/2, 3/3, etc
So can do a 1/3 or a 3/2 or a 3/2S for an S shaped twill Can also combine complex twills. E.g. 1/3 2/2 3/1 1/1 will make an 18 shaft/treadle twill
Z is the default if no suffix on end of shape string
One day will add points, staggers, etc in eth threading section instead of a straight draw.
A few changes to support faulty wif files from various vendors. Also twill generator almost same as Tartan. usage: pyweaving twill [-h] [--render] [--renderfile RENDERFILE] [--renderstyle {solids,blobs,colors,numbers}] shape outfile where shape is something like "1/3 2/2Z" and "--renderfile auto" will autoname based on wif and put in same dir as wif.
Some refactoring and comment adjustments
Float length now correctly being presented. (was short by 1) Added Floating selvedge detection into ministats section.
Found neat trick used by Fiberworks to embed creation date into TEXT section as a comment. Will probably use/maintain ourselves. Required changes to RawConfigParser to read/write comments
Added Notes section under drawdown. If some notes then they are printed there under a heading. Last line is added if notes exist which indicates the source program and version
Render option can take an autopng or autosvg in place of the outfile. n image file named after the wif will be created.
More mods to RawConfigParser so we can read in creation date as comment. Revealed failure to load wif files from TempoWeave program. Wifs from this program have no blank lines and sprinkle comments everywhere even line 1. But end result is more robust so fine :)
Also fixed bug in auto option to render which was overzealous.
Added Tartans by Name
Can now generate a tartan using a name. E.g.
pyweaving.exe tartan "Abercrombie" --direction S foo.wif --render --renderfile foo.png
will find all the tartans containing Abercrombie and list them.
A user can then select a unique tartan and get that generated:
pyweaving.exe tartan "Abercrombie - TI" --direction S foo.wif --render --renderfile foo.png
The tartans taken from the weddslist website with permission. These are not impeccably sourced and cannot be relied upon for accuracy. Will add note in NOTES to indicate this.
Added named styles in a styles.json file. Ends up in a user folder .pyweaving commands modified to take --style name so a style can be used when generating or rendering
Just trying to get a few things straightened out and go for a 0.1 release where its stable and can offer working command line options and reads loads of wif files. Todo:
Then will begin work on extracting the structure by careful examination and a few more features
now have named styles for render, twill, tartan commands. Can reference a style defined in .pyweaving/styles. Master of this file is in data directory for distro and copied in when used initially. Omitting a style will use the Defaults style defined in styles.json
E.g. pyweaving.exe render --style mincolor "ashford echo1.wif" foo.png
will render using the mincolor style.
Second feature is proper naming and refusal tooverwrite when using teh autopng or autosvg convention in render.
E.g.pyweaving.exe render "ashford echo1.wif" autopng
will try to name the render as: "ashford echo1.png" if that file exists then it will add a suffix and name it:
"ashford echo1-01.png" if that exists then -02 etc.
alas svg not hooked up yet same as png but coming...
used Creation date trick from some wif files as a comment. we now read and add this info to the Notes report we also write out creation date if not already defined (e.g. in generators
Also fixed Tartan disorder (twill tieup/warp) and shortened tartan names - too many spaces
Been unavailable for a while but back now. Several motley changes and drawdown presentation options. Bit of a side track from v0.1 stated goals. trying to get back on track.
Added:
Interlace option to drawdown. Shows under/over more clearly.
interlace_width
option in styleAdded "shading" option to drawdown styles.
Therefore Color class now generates a shadow and highlight color if requested - for shading.
added render option structure which overrides drawdown colors to be warp black, weft white
twill generator - added repeats
Added more styles to default install
Fixes:
Some svg renderer changes but all WIP
Optimize wif saving for smaller files by finding most used colors and referencing those as per first post so long ago in this thread..
Tartans:
Twill:
Render:
Only have python3 and svg on my list for official? work before new release ready...
OK big change - rewrote the SVG renderer to use svgwrite. Also hashed all yarns in the drawdown so only minimal set created then all referenced and drawn. So a large drawdown may only have 12 actual differently drawn threads in eth thousands that need to be displayed. E.g. plain weave. Having said that I was surprised that redraws in the browser are not as fast as I had hoped. so interactive adjustment of a large SVG file is not going to work if this program ever went interactive.
Also: If a style is selected which does not exist then a list of partial matching styles is presented at the CLI
Some cleanup of styles as vector shading options added.
Some classes now have repr defined.
CSS is precalculated for all colours and shading highlights/shadows
box sizing calculations for part placement in the renderers has been refactored out of the Imagerender class. Positional calcs refactored also in Renderers
Starting indicator position is cleaned up but still not autocalculating where it should really be for any given draft.
Next is refactoring for Python 3.
What should we name this. Version 0.8 ? I'd like to determine repeats and reflections in the warp and weft and present like Handowven mag does but maybe this should be a v0.9 then 1.0 would be bugfixes. ??
Added small commit to improve help when no args specified. Working on docs and python3
Python3 reorganisation done. now python 3.8 or above Also init has been refactored. So Draft, Drawstyle, Color in own files and init is very small
So will work on docs but need some input from you now Scott about releasing
Adding new feature to create a wif from an image of a drawdown.
Some minor changes to presenting color and in Draft.
So two commands added:
minor addition to reporting which files get created.. cleaned up the generators in cmd.py to factor common code
Changes added to support flake8. now working on tox/setup/manifest - what a nightmare :(
Basically testing now working
tox
Docs now building using Sphinx
Docs added for Color, Drawstyle, and more to come Fixes to Color as revealed by test coverage Moved Drawstyle initiation into package init
No progress yet on packaging
Hi @Neon22,
Thanks for this work. I'm trying to synthesize the micro 3D geometry of a fabric based on the weave pattern.
I tried this repo as well as your fork. For some WIF files, it seems that some color in the palette is missing. I just replace it with [255, 255, 255]. Wanted to ask you if there is a better solution. I would have attached my WIF file but github isn't letting me.
Hope to hear from you soon! Thanks.
Hi @Vrroom, I have been continually improving the wif reader. if you have a wif with a problem, please try to raise an issue and include it. Otherwise just paste it into a comment. I'll have a go.
Thanks for your @Neon22. I can't attach the WIF here but this is the download link:
https://www.eatough.net/weave/WIF%20files/rosepath1.wif
The error I get is:
File "*****/pyweaving/pyweaving/wif.py", line 209, in read
self.put_warp(draft, wif_palette)
File "*****/pyweaving/pyweaving/wif.py", line 72, in put_warp
color = wif_palette[warp_color_map[thread_no]]
KeyError: 1
Hmm. I have no trouble reading it. Here it is with emphasised style Are you using my branch ?
wif-missing-warp is the correct branch on my github
Ok ok. I'll try it out. Yeah I was using your master
branch!
@Vrroom There are a few existing papers about modelling the fibres. Are you doing new research, extending an existing approach, or making a solution from existing approaches.
Reason I ask is recently also been working with https://github.com/gniknyh who has been making a cloth BSDF shader for his thesis?
So we now have a support tool that makes a normal and tangent map of a wif. Needs a bit more work to finish. Is it useful to you ?
Definitely very useful. In fact, I have been using your library, blender and mitsuba to make displacement and normal maps. The aim is to tile these on an arbitrary surfaces.
So far, we just want to reproduce existing research which is very hard to do. We have been playing with ThunderLoom but have found it difficult to get it working. Hence, we want to make our own rendering pipeline so that we maximally understand the nitty-gritties of it.
I have a stupid question? Why do we need tangent maps for rendering in general?
I think I see where you're coming from. Happy to discuss which approaches might suit you best. The reason we have a tangent map is because a realtime shader needs to go as fast as possible and so precalculating the normals/tangents means we can save precious time when calculating.
You can see latest webGL version of work done by Link here:
The second link is on my page and I have started to enhance it to what I need for a realtime viewer. I need to do work on the normal mapping code to get a better under/over warp/weft transitions and remove thw sharp edges. Unless you'd like to help of course :)
Sent you an email
Thanks to covid lockdowns for the time to work on this. Always bothered me I could not use this module with handweaving.net sample wif files. Finally tracked it down.
There are lines missing in the WARP and WEFT COLOR sections which the spec says if not supplied should be using the default as defined (optionally) in the COLOR param in the WARP or WEFT section.
I am working in 3.9.7 FYI and all looking good so far. Addressed in Pull Request #4