Parameterlist Excel export to OpenSCAD

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Parameterlist Excel export to OpenSCAD

Johan Jonker
This post was updated on .
I have an Openscad file for a saxophone key with a lot of parameters, that can change depending on the brand of the saxophone and the type of key that I want to add in the future. (Thanks to Parkinbot for the very nice Spline and sweep functions).

To keep the code readable I made a separate scad file with parameters that is imported in the head of the scad. I wonder if there is an easy way to maintain the whole serie of parameters in an excel file and import a selected file or set of parameters to Openscad.



So I made an excel file where the set of parameters is selectable and in one column the code appears that I can copy and paste to openscad. (Yes, the ";" is missing).

Is there a better way to link Excel to Openscad?


Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

Stefan Göttsche
I am sure there are people that have more knowledge about this than me,
but Excel can export to txt file, and OpenSCAD can be set to
surveillance changes in a scad file.

Eventually, if you could get Excel (Via macro automation or VBA, or
manually if all fails) to calculate and export to file what you want,
OpenSCAD would then notice the change in that file and recompile?


On 30. des. 2015 13:54, Johan Jonker wrote:

> I have an Openscad file for a saxophone key with a lot of parameters, that
> can change depending on the brand of the saxophone and the type of key that
> I want to add in the future.
>
> To keep the code readable I made a separate scad file with parameters that
> is imported in the head of the scad. I wonder if there is an easy way to
> maintain the whole serie of parameters in an excel file and import a
> selected file to Openscad.
> <http://forum.openscad.org/file/n15363/parameters.jpg>
> So I made an excel file where the set of parameters is selectable and in one
> column the code appears that I can copy and paste to openscad.
>
> Is there a better way to link Excel to Openscad?
> <http://forum.openscad.org/file/n15363/parameters2.jpg>
>
>
>
> --
> View this message in context: http://forum.openscad.org/Parameterlist-Excel-export-to-OpenSCAD-tp15363.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

nophead
You can do it all in the OpenScad file by putting the parameters in names lists, one for each model of saxaphone and simply passing that named list to a module to draw it or assigning it to a global variable.

On 30 December 2015 at 13:04, Stefan Göttsche <[hidden email]> wrote:
I am sure there are people that have more knowledge about this than me,
but Excel can export to txt file, and OpenSCAD can be set to surveillance changes in a scad file.

Eventually, if you could get Excel (Via macro automation or VBA, or manually if all fails) to calculate and export to file what you want, OpenSCAD would then notice the change in that file and recompile?



On 30. des. 2015 13:54, Johan Jonker wrote:
I have an Openscad file for a saxophone key with a lot of parameters, that
can change depending on the brand of the saxophone and the type of key that
I want to add in the future.

To keep the code readable I made a separate scad file with parameters that
is imported in the head of the scad. I wonder if there is an easy way to
maintain the whole serie of parameters in an excel file and import a
selected file to Openscad.
<http://forum.openscad.org/file/n15363/parameters.jpg>
So I made an excel file where the set of parameters is selectable and in one
column the code appears that I can copy and paste to openscad.

Is there a better way to link Excel to Openscad?
<http://forum.openscad.org/file/n15363/parameters2.jpg>



--
View this message in context: http://forum.openscad.org/Parameterlist-Excel-export-to-OpenSCAD-tp15363.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

William Adams-2
In reply to this post by Stefan Göttsche
I've just been doing something similar --- I have an Excel spreadsheet which has several worksheets w/ the client data in it, and a ``customization'' worksheet which imports all the settings specified by the customer, in the proper order and wrapped up w/ conditional cells which only populate w/ TeX commands if the matching cell has content:

=IF(B13="","",1) --- repeated all the way down in a column

=IF(SUM(F13:F16)=4,"\fouruppage{",IF(SUM(F13:F16)=3,"\fouruppageThree{",IF(SUM(F13:F16)=2,"\fouruppageTwo{",IF(SUM(F13:F16)=1,"\fouruppageOne{",IF(SUM(F13:F16)=0,"")))))

&c.

(It was a lot easier than reading the customer files into lualatex and redefining the macros there)

William


On Wed, Dec 30, 2015 at 8:04 AM, Stefan Göttsche <[hidden email]> wrote:
I am sure there are people that have more knowledge about this than me,
but Excel can export to txt file, and OpenSCAD can be set to surveillance changes in a scad file.

Eventually, if you could get Excel (Via macro automation or VBA, or manually if all fails) to calculate and export to file what you want, OpenSCAD would then notice the change in that file and recompile?



On 30. des. 2015 13:54, Johan Jonker wrote:
I have an Openscad file for a saxophone key with a lot of parameters, that
can change depending on the brand of the saxophone and the type of key that
I want to add in the future.

To keep the code readable I made a separate scad file with parameters that
is imported in the head of the scad. I wonder if there is an easy way to
maintain the whole serie of parameters in an excel file and import a
selected file to Openscad.
<http://forum.openscad.org/file/n15363/parameters.jpg>
So I made an excel file where the set of parameters is selectable and in one
column the code appears that I can copy and paste to openscad.

Is there a better way to link Excel to Openscad?
<http://forum.openscad.org/file/n15363/parameters2.jpg>



--
View this message in context: http://forum.openscad.org/Parameterlist-Excel-export-to-OpenSCAD-tp15363.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

Johan Jonker
In reply to this post by Stefan Göttsche
I made a macro in the excel file that reacts on just a button click and exports the table to an scad file.
So it is just two clicks to modify: One in the excel and then F5 to refresh Openscad.

This is the macro listing:
Sub Macro1()
Dim myFile As String, rng As Range, cellValue As Variant, i As Integer, j As Integer

myFile = Application.ActiveWorkbook.Path & "\" & Cells(5, 4).Value
Cells(6, 4) = myFile

ActiveSheet.Range("D9:D100").Select

Set rng = Selection

    Open myFile For Output As #1
        For i = 1 To rng.Rows.Count
                cellValue = rng.Cells(i, 1).Value
                    Print #1, Replace(cellValue, ",", "."), vbCrLf,
        Next i
    Close #1
End Sub


Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

kintel
Administrator
In reply to this post by nophead
nophead’s suggestion sounds decent to me.
I’d be interested in what your ideal solution would look like.

As a teaser: We’ve been discussing introducing dictionary-style objects as a core datatype in OpenSCAD. This would allow us to import e.g. JSON documents and store the resulting object as an OpenSCAD value.
This is just one idea. If you have others, please share!

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

jdawgaz
can you give some examples of usage of the dictionary objects would be?


--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. 
- Anonymous

If writing good code requires very little comments, then writing really excellent code requires no comments at all!
- Ken Thompson


On Wed, Dec 30, 2015 at 9:00 AM, Marius Kintel <[hidden email]> wrote:
nophead’s suggestion sounds decent to me.
I’d be interested in what your ideal solution would look like.

As a teaser: We’ve been discussing introducing dictionary-style objects as a core datatype in OpenSCAD. This would allow us to import e.g. JSON documents and store the resulting object as an OpenSCAD value.
This is just one idea. If you have others, please share!

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

Johan Jonker
Here are the files:

parameters_palm_keys.xlsm

palmkey_saxophone.scad

You also need spline and nacasweep in the same directory
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

doug.moen
In reply to this post by jdawgaz
Marius may be referring to my OpenSCAD2 proposal, in which "dictionary objects" are just called "objects".
The OpenSCAD2 docs are in github: https://github.com/doug-moen/openscad2/

The object proposal is here:
   https://github.com/doug-moen/openscad2/blob/master/rfc/Objects.md
   https://github.com/doug-moen/openscad2/blob/master/rfc/Programming_With_Objects.md

There are lots of use cases given: you might as well click through and read about them in the linked documents.

On 30 December 2015 at 11:52, Jerry Davis <[hidden email]> wrote:
can you give some examples of usage of the dictionary objects would be?


--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. 
- Anonymous

If writing good code requires very little comments, then writing really excellent code requires no comments at all!
- Ken Thompson


On Wed, Dec 30, 2015 at 9:00 AM, Marius Kintel <[hidden email]> wrote:
nophead’s suggestion sounds decent to me.
I’d be interested in what your ideal solution would look like.

As a teaser: We’ve been discussing introducing dictionary-style objects as a core datatype in OpenSCAD. This would allow us to import e.g. JSON documents and store the resulting object as an OpenSCAD value.
This is just one idea. If you have others, please share!

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

doug.moen
In reply to this post by Johan Jonker
Thanks for sharing your code. This is a cool example of curved surfaces and splines in a real engineering type of model.

On 30 December 2015 at 12:00, Johan Jonker <[hidden email]> wrote:
Here are the files:

parameters_palm_keys.xlsm
<http://forum.openscad.org/file/n15370/parameters_palm_keys.xlsm>

palmkey_saxophone.scad
<http://forum.openscad.org/file/n15370/palmkey_saxophone.scad>

You also need spline and nacasweep in the same directory



--
View this message in context: http://forum.openscad.org/Parameterlist-Excel-export-to-OpenSCAD-tp15363p15370.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

kintel
Administrator
In reply to this post by doug.moen
Yes, I was referring to the OpenSCAD2 proposal. Thanks for the actual links!
In that document, perhaps we should add some more concrete use-cases the kind of dictionary usage discussed here, or even hint at things like JSON import?

 -Marius

> On Dec 30, 2015, at 12:05 PM, doug moen <[hidden email]> wrote:
>
> Marius may be referring to my OpenSCAD2 proposal, in which "dictionary objects" are just called "objects".
> The OpenSCAD2 docs are in github: https://github.com/doug-moen/openscad2/
>
> The object proposal is here:
>    https://github.com/doug-moen/openscad2/blob/master/rfc/Objects.md
>    https://github.com/doug-moen/openscad2/blob/master/rfc/Programming_With_Objects.md
>
> There are lots of use cases given: you might as well click through and read about them in the linked documents.
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

runsun
In reply to this post by Johan Jonker
Johan Jonker wrote
I made a macro in the excel file that reacts on just a button click and exports the table to an scad file.
So it is just two clicks to modify: One in the excel and then F5 to refresh Openscad.
Really nice work. That's probably the most you can get outta excel-controlled openscad. (I was trying to see if openscad has any dll that I can insert into Excel as Add-in. Guess not).

You can also turn on the "Automatically Reload and Preview" in OpenSCAD. Then, have excel and openscad opened side by side, you can enjoy one click on the [Export to SCAD file] button and see it changed automatically. Comparing to other approach, which focus only on data, this excel-approach has the advantage of using Excel as both a data holder and a GUI like the button you put on there.  


$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

runsun
In reply to this post by jdawgaz
jdawgaz wrote
can you give some examples of usage of the dictionary objects would be?
Besides what are proposed for the OpenSCAD2, you can also refer to the hash approach that I've been using: here and here
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: Parameterlist Excel export to OpenSCAD

doug.moen
In reply to this post by kintel
I am happy to accept contributions :)

On Wednesday, 30 December 2015, Marius Kintel <[hidden email]> wrote:
Yes, I was referring to the OpenSCAD2 proposal. Thanks for the actual links!
In that document, perhaps we should add some more concrete use-cases the kind of dictionary usage discussed here, or even hint at things like JSON import?

 -Marius

> On Dec 30, 2015, at 12:05 PM, doug moen <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;doug@moens.org&#39;)">doug@...> wrote:
>
> Marius may be referring to my OpenSCAD2 proposal, in which "dictionary objects" are just called "objects".
> The OpenSCAD2 docs are in github: https://github.com/doug-moen/openscad2/
>
> The object proposal is here:
>    https://github.com/doug-moen/openscad2/blob/master/rfc/Objects.md
>    https://github.com/doug-moen/openscad2/blob/master/rfc/Programming_With_Objects.md
>
> There are lots of use cases given: you might as well click through and read about them in the linked documents.
>


_______________________________________________
OpenSCAD mailing list
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;Discuss@lists.openscad.org&#39;)">Discuss@...
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org