'Export Variables to CSV' - Issue? ... More of a Suggestion!

Hello dear Application Gurus,

I have had cause in the past and currently, to Export my locals variables for checking - easier than scrolling through the tables in Seamly2D - I actually found some vars that needed updating and it occurred to me that it would be ‘nice’ to be able to edit these externally in the .CSV file and subsequently Import the data into the original (or any other for that matter, and choosing with Add / Update (replace) options.

This would greatly ease the updating of multiple .SM2D files where I keep a stock of my favourite standard variables. Currently I edit the raw XML data in my standard TextEditor (Notepad++), but having an Import function would make life easier.

Would an additional Export / Import functionality for individual measurement table(s) be feasible, I realise that this would be very seldom used by most and, in addition, I could write this for myself in python, but I would need to know of any specific constraints in the XML semantics / syntax, that may be involved - forbidden characters / string lengths etc … etc.

2 Mi Piace

PS: Aside from the misspelling of my title (shame on me!), if would be a great addition if the export of the local variables also contained the ‘Description’ field.

As I said above, this is all in aid my my own laziness, and purely a suggestion.:roll_eyes:

2 Mi Piace

Hi, @DavidDeb

It’s complicated. All sorts of checks need to be put in place for impoting .csv files to protect the integrity of all patterns for everyone.

However, since you are already using Notepad++, you can copy the Variables section to other pattern files very easily, edit them to your hearts content, save the file and open it in Seamly without any problems… I do it all the time.

2 Mi Piace

I’ll work on it.

3 Mi Piace

@DavidDeb If you don’t mind, would you add this as an issue for a feature request in our GitHub repo?

2 Mi Piace

I could be wrong but I think there already is one.

1 Mi Piace

@DavidDeb Check if there’s already an issue on Github – search the issues for keywords, etc. – and add comments to the issue if it doesn’t clearly describe the functionality that you need.

2 Mi Piace

I checked… a really old issue already exists. Import/Export Table of Variables #177

4 Mi Piace

I totally agree, that’s why I currently do this on the raw data, and ease this by creating my own .CSV import routine - this is why I would really like to to know what (if at all) Seamly2D demands. As far as the XML structure as I currently see it, I can deal with the imports without issue. However if there are ‘edge’ syntax / semantic cases, I would wish to know of these … just to be sure :wink:

Thanks for the remarks and greetz from ‘Sunny Germany’.

David D.

2 Mi Piace

Hi @Sue ,

I trust that @Douglas ‘s response was sufficient ?

2 Mi Piace

Just to note… with that issue the “Export” part was apparently implemented , issue closed and then reopened because the “Import” aspect was not implemented. Which is understandable, because importing a CSV is not an easy task unless the CSV to be imported is written EXACTLY as you expect.

Personally I would have initially taken the approach to be able to “import / merge” the variables from 1 pattern into another… this way all the XML validation remains in place. There could also be an “Export Variables as XML” which basicslly strips down a pattern to only the necessary header elements and the <variables> block. This would satisfy the majority of users by being able to share variables between patterns WITHIN Seamly.

Secondarily the CSV Export / Import would be imlemented, with the caveat that an outside application may change and invalidate the CSV, which would have to be accounted for. Personally I don’t see much use for importing variables in CSV format. Unlike the measurements - which one may recieve as an Excel file (like we use to get at the shop all the time), who is going to send you varibles? What external app is generating or needed to manipilate the variables? It would be like using Inkscape to export as a PNG, just to load it back in to work on an SVG.

3 Mi Piace

I may have done exactly that within the last couple weeks. It was a… learning experience… I’m not sure what all I did. :sweat_smile:

:unicorn:

2 Mi Piace

HI,

interesting aspect - exporting directly as XML - since the current export mode is to .CSV, my concentration (sometimes easily sidetracked!) was set upon the current format :roll_eyes: One could just as easily export the whole required block as .XML, modify that and re-import to a target file. As you say - and assuming the targeted file is at the same ‘data-revision’ as the source - consistency would be maintained.

Great Idea! :+1:

2 Mi Piace

Exactly. Other than to remain a valid pattern, the XML needs to contain these elemements before the <variables>, and to be safe a basically empty draftblock with all it’s empty elements after the variables. Like:

<?xml version="1.0" encoding="UTF-8"?>
<pattern>
    <!--Pattern created with Seamly2D v0.6.0.1 (https://seamly.io).-->
    <version>0.7.3</version>
    <unit>inch</unit>
    <description/>
    <notes/>
    <measurements/>
    <variables>
        <variable description="" formula="0" name="#Variable_1"/>
        <variable description="" formula="0" name="#Variable_2"/>
        <variable description="" formula="0" name="#Variable_3"/>
    </variables>
    <draftBlock name="Draft block 1">
        <calculation>
            <point id="1" mx="0.0520833" my="0.104167" name="A" showPointName="true" type="single" x="0.3125" y="0.416667"/>
        </calculation>
        <modeling/>
        <pieces/>
        <groups/>
        <images/>
    </draftBlock>
</pattern>

It only makes sense to use XML if one is only working within Seamly to export / import / merge the variables. And yes one could make the argument for a JSON export / import. IMO the only need for CSV is if you have a need to use the data in an outside application. Again.. as I stated previously I can see using the measurements elsewhere or using another application to input measurement the data, but I see little use for the variables outside of Seamly other than in technical documention, and no use to import CSV if there is an XML import. In other words… the main reason for importing variables is simply to save typing… no one is really creating variable names in Excel to import into Seamly.

3 Mi Piace

My intention is the unification and or correction of data within Seamly itself, thus editing exported .XML data would seem to be, at least for now, the ideal solution.

4 Mi Piace