discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Parameters for Complex Constructions

PC
Patrick Callahan
Mon, Nov 22, 2021 3:19 PM

I am building assemblies with several parts, each of which has numerous and
sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that information
into comprehensible tables.

I'm calling a constructor function instead of simply specifying the values
of a vector, so I can label each measurement with a name without using a
table.
The constructor functions assemble the named parameters into a vector, and
accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".

I am building assemblies with several parts, each of which has numerous and sometimes complex features. I found several ideas for organizing a large number of individual measurements and wondered if there might be other approaches or if contemplated changes to OpenSCAD itself might also be helpful. First, organize the data in one file and geometry in a second file. Second, organize the data in columns form, using vectors as containers, labeling the columns of data in comments. Third, include a name and description in the vector. Fourth, when using the vector, provide accessor functions for the individual columns. I have an additional idea I'm using in my work. Constructors. I found it easy to identify features but more challenging to organize that information into comprehensible tables. I'm calling a constructor function instead of simply specifying the values of a vector, so I can label each measurement with a name without using a table. The constructor functions assemble the named parameters into a vector, and accessor functions provide the values by name. I'm still assessing whether a formal constructor is a good idea. I'm considering whether to apply the concept everywhere or to simply use it when deemed "necessary".
NH
nop head
Mon, Nov 22, 2021 3:29 PM

My library: NopSCADlib, works exactly like you describe. All my objects are
described by lists of properties that are accessed through accessor
functions. I also have constructor functions to make any lists that are
expected to be provided by clients of the library, e.g. for customisable
printed parts. The lists that represent fixed vitamins are defined by lists
in the library and don't have constructors.

On Mon, 22 Nov 2021 at 15:19, Patrick Callahan pat.callahan1@gmail.com
wrote:

I am building assemblies with several parts, each of which has numerous
and sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that information
into comprehensible tables.

I'm calling a constructor function instead of simply specifying the values
of a vector, so I can label each measurement with a name without using a
table.
The constructor functions assemble the named parameters into a vector, and
accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

My library: NopSCADlib, works exactly like you describe. All my objects are described by lists of properties that are accessed through accessor functions. I also have constructor functions to make any lists that are expected to be provided by clients of the library, e.g. for customisable printed parts. The lists that represent fixed vitamins are defined by lists in the library and don't have constructors. On Mon, 22 Nov 2021 at 15:19, Patrick Callahan <pat.callahan1@gmail.com> wrote: > I am building assemblies with several parts, each of which has numerous > and sometimes complex features. > > I found several ideas for organizing a large number of individual > measurements and wondered if there might be other approaches or if > contemplated changes to OpenSCAD itself might also be helpful. > > First, organize the data in one file and geometry in a second file. > Second, organize the data in columns form, using vectors as containers, > labeling the columns of data in comments. > Third, include a name and description in the vector. > Fourth, when using the vector, provide accessor functions for the > individual columns. > > I have an additional idea I'm using in my work. Constructors. I found it > easy to identify features but more challenging to organize that information > into comprehensible tables. > > I'm calling a constructor function instead of simply specifying the values > of a vector, so I can label each measurement with a name without using a > table. > The constructor functions assemble the named parameters into a vector, and > accessor functions provide the values by name. > > I'm still assessing whether a formal constructor is a good idea. I'm > considering whether to apply the concept everywhere or to simply use it > when deemed "necessary". > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
PC
Patrick Callahan
Mon, Nov 22, 2021 4:55 PM

Your library showcases the techniques I described and is the model for my
own library covering flight simulation parts.

My main question at this point is where to draw the line on using
constructors vs simply listing the data in a vector.  As I gain experience,
I'll know better where I'll be drawing the line, but wanted to ask how
others made that choice..
I haven't read your whole library but will take a look at your constructors
for guidance.

-Pat

On Mon, Nov 22, 2021 at 10:30 AM nop head nop.head@gmail.com wrote:

My library: NopSCADlib, works exactly like you describe. All my objects
are described by lists of properties that are accessed through accessor
functions. I also have constructor functions to make any lists that are
expected to be provided by clients of the library, e.g. for customisable
printed parts. The lists that represent fixed vitamins are defined by lists
in the library and don't have constructors.

On Mon, 22 Nov 2021 at 15:19, Patrick Callahan pat.callahan1@gmail.com
wrote:

I am building assemblies with several parts, each of which has numerous
and sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that information
into comprehensible tables.

I'm calling a constructor function instead of simply specifying the
values of a vector, so I can label each measurement with a name without
using a table.
The constructor functions assemble the named parameters into a vector,
and accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Your library showcases the techniques I described and is the model for my own library covering flight simulation parts. My main question at this point is where to draw the line on using constructors vs simply listing the data in a vector. As I gain experience, I'll know better where I'll be drawing the line, but wanted to ask how others made that choice.. I haven't read your whole library but will take a look at your constructors for guidance. -Pat On Mon, Nov 22, 2021 at 10:30 AM nop head <nop.head@gmail.com> wrote: > My library: NopSCADlib, works exactly like you describe. All my objects > are described by lists of properties that are accessed through accessor > functions. I also have constructor functions to make any lists that are > expected to be provided by clients of the library, e.g. for customisable > printed parts. The lists that represent fixed vitamins are defined by lists > in the library and don't have constructors. > > On Mon, 22 Nov 2021 at 15:19, Patrick Callahan <pat.callahan1@gmail.com> > wrote: > >> I am building assemblies with several parts, each of which has numerous >> and sometimes complex features. >> >> I found several ideas for organizing a large number of individual >> measurements and wondered if there might be other approaches or if >> contemplated changes to OpenSCAD itself might also be helpful. >> >> First, organize the data in one file and geometry in a second file. >> Second, organize the data in columns form, using vectors as containers, >> labeling the columns of data in comments. >> Third, include a name and description in the vector. >> Fourth, when using the vector, provide accessor functions for the >> individual columns. >> >> I have an additional idea I'm using in my work. Constructors. I found it >> easy to identify features but more challenging to organize that information >> into comprehensible tables. >> >> I'm calling a constructor function instead of simply specifying the >> values of a vector, so I can label each measurement with a name without >> using a table. >> The constructor functions assemble the named parameters into a vector, >> and accessor functions provide the values by name. >> >> I'm still assessing whether a formal constructor is a good idea. I'm >> considering whether to apply the concept everywhere or to simply use it >> when deemed "necessary". >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Mon, Nov 22, 2021 5:12 PM

I wouldn't want to forecast when it'll become available, but there's a
feature on the horizon that might interest you:  "objects".  These are
what other languages call dictionaries (Python), object (JavaScript), or
HashMaps (Java):  a data item containing named data items.

There is limited support in the development snapshots; OpenSCAD-internal
functions can create these and OpenSCAD programs can use the results.

tm = textmetrics("hello");
echo(tm);
echo(tm.position);
echo(tm["size"]);

yields

ECHO: { position = [0.96, -0.1408]; size = [27.8024, 10.208]; ascent
= 10.0672; descent = -0.1408; offset = [0, 0]; advance = [29.3443, 0]; }
ECHO: [0.96, -0.1408]
ECHO: [27.8024, 10.208]

What is not yet available is the ability for OpenSCAD programs to create
these objects.

I wouldn't want to forecast when it'll become available, but there's a feature on the horizon that might interest you:  "objects".  These are what other languages call dictionaries (Python), object (JavaScript), or HashMaps (Java):  a data item containing named data items. There is limited support in the development snapshots; OpenSCAD-internal functions can create these and OpenSCAD programs can use the results. tm = textmetrics("hello"); echo(tm); echo(tm.position); echo(tm["size"]); yields ECHO: { position = [0.96, -0.1408]; size = [27.8024, 10.208]; ascent = 10.0672; descent = -0.1408; offset = [0, 0]; advance = [29.3443, 0]; } ECHO: [0.96, -0.1408] ECHO: [27.8024, 10.208] What is not yet available is the ability for OpenSCAD programs to create these objects.
NH
nop head
Mon, Nov 22, 2021 5:33 PM

Constructors make it easy to define lists in the client code because they
have named parameters and can have defaults that stop the library breaking
if the list format changes.

For vitamins like screws that are all defined in the same file in the
library there isn't much point as they can be arranged in a table with
column headers in comments. If the list format changes it is easy to change
the lists to match, so the client code does not break as it only uses the
lists by name and doesn't care what is in them.

On Mon, 22 Nov 2021 at 16:57, Patrick Callahan pat.callahan1@gmail.com
wrote:

Your library showcases the techniques I described and is the model for my
own library covering flight simulation parts.

My main question at this point is where to draw the line on using
constructors vs simply listing the data in a vector.  As I gain experience,
I'll know better where I'll be drawing the line, but wanted to ask how
others made that choice..
I haven't read your whole library but will take a look at your
constructors for guidance.

-Pat

On Mon, Nov 22, 2021 at 10:30 AM nop head nop.head@gmail.com wrote:

My library: NopSCADlib, works exactly like you describe. All my objects
are described by lists of properties that are accessed through accessor
functions. I also have constructor functions to make any lists that are
expected to be provided by clients of the library, e.g. for customisable
printed parts. The lists that represent fixed vitamins are defined by lists
in the library and don't have constructors.

On Mon, 22 Nov 2021 at 15:19, Patrick Callahan pat.callahan1@gmail.com
wrote:

I am building assemblies with several parts, each of which has numerous
and sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that information
into comprehensible tables.

I'm calling a constructor function instead of simply specifying the
values of a vector, so I can label each measurement with a name without
using a table.
The constructor functions assemble the named parameters into a vector,
and accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Constructors make it easy to define lists in the client code because they have named parameters and can have defaults that stop the library breaking if the list format changes. For vitamins like screws that are all defined in the same file in the library there isn't much point as they can be arranged in a table with column headers in comments. If the list format changes it is easy to change the lists to match, so the client code does not break as it only uses the lists by name and doesn't care what is in them. On Mon, 22 Nov 2021 at 16:57, Patrick Callahan <pat.callahan1@gmail.com> wrote: > Your library showcases the techniques I described and is the model for my > own library covering flight simulation parts. > > My main question at this point is where to draw the line on using > constructors vs simply listing the data in a vector. As I gain experience, > I'll know better where I'll be drawing the line, but wanted to ask how > others made that choice.. > I haven't read your whole library but will take a look at your > constructors for guidance. > > -Pat > > > On Mon, Nov 22, 2021 at 10:30 AM nop head <nop.head@gmail.com> wrote: > >> My library: NopSCADlib, works exactly like you describe. All my objects >> are described by lists of properties that are accessed through accessor >> functions. I also have constructor functions to make any lists that are >> expected to be provided by clients of the library, e.g. for customisable >> printed parts. The lists that represent fixed vitamins are defined by lists >> in the library and don't have constructors. >> >> On Mon, 22 Nov 2021 at 15:19, Patrick Callahan <pat.callahan1@gmail.com> >> wrote: >> >>> I am building assemblies with several parts, each of which has numerous >>> and sometimes complex features. >>> >>> I found several ideas for organizing a large number of individual >>> measurements and wondered if there might be other approaches or if >>> contemplated changes to OpenSCAD itself might also be helpful. >>> >>> First, organize the data in one file and geometry in a second file. >>> Second, organize the data in columns form, using vectors as containers, >>> labeling the columns of data in comments. >>> Third, include a name and description in the vector. >>> Fourth, when using the vector, provide accessor functions for the >>> individual columns. >>> >>> I have an additional idea I'm using in my work. Constructors. I found it >>> easy to identify features but more challenging to organize that information >>> into comprehensible tables. >>> >>> I'm calling a constructor function instead of simply specifying the >>> values of a vector, so I can label each measurement with a name without >>> using a table. >>> The constructor functions assemble the named parameters into a vector, >>> and accessor functions provide the values by name. >>> >>> I'm still assessing whether a formal constructor is a good idea. I'm >>> considering whether to apply the concept everywhere or to simply use it >>> when deemed "necessary". >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org >>> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
CL
Chow Loong Jin
Tue, Nov 23, 2021 2:39 AM

If I'm understanding correctly what you mean by constructors, I've been
using a similar structure for my delta 3d printer, you can see the source
code here:

  • [1] for where the entire config tree is defined
  • [2] for how it's used

For what it's worth, it does result in quite a bit of boilerplate if
done purely in OpenSCAD, so I don't do this unless the project is
complex enough that the parameters are confusing to manage as just a
bunch of global variables.

[1] https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad
[2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad

-- Bob

On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote:

I am building assemblies with several parts, each of which has numerous and
sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that information
into comprehensible tables.

I'm calling a constructor function instead of simply specifying the values
of a vector, so I can label each measurement with a name without using a
table.
The constructor functions assemble the named parameters into a vector, and
accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

If I'm understanding correctly what you mean by constructors, I've been using a similar structure for my delta 3d printer, you can see the source code here: - [1] for where the entire config tree is defined - [2] for how it's used For what it's worth, it does result in quite a bit of boilerplate if done purely in OpenSCAD, so I don't do this unless the project is complex enough that the parameters are confusing to manage as just a bunch of global variables. [1] https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad [2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad -- Bob On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote: > I am building assemblies with several parts, each of which has numerous and > sometimes complex features. > > I found several ideas for organizing a large number of individual > measurements and wondered if there might be other approaches or if > contemplated changes to OpenSCAD itself might also be helpful. > > First, organize the data in one file and geometry in a second file. > Second, organize the data in columns form, using vectors as containers, > labeling the columns of data in comments. > Third, include a name and description in the vector. > Fourth, when using the vector, provide accessor functions for the > individual columns. > > I have an additional idea I'm using in my work. Constructors. I found it > easy to identify features but more challenging to organize that information > into comprehensible tables. > > I'm calling a constructor function instead of simply specifying the values > of a vector, so I can label each measurement with a name without using a > table. > The constructor functions assemble the named parameters into a vector, and > accessor functions provide the values by name. > > I'm still assessing whether a formal constructor is a good idea. I'm > considering whether to apply the concept everywhere or to simply use it > when deemed "necessary". > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
PC
Patrick Callahan
Tue, Nov 23, 2021 6:07 PM

did that "Single unified namespace" make things difficult for backward
compatibility?

On Mon, Nov 22, 2021 at 9:39 PM Chow Loong Jin hyperair@debian.org wrote:

If I'm understanding correctly what you mean by constructors, I've been
using a similar structure for my delta 3d printer, you can see the source
code here:

  • [1] for where the entire config tree is defined
  • [2] for how it's used

For what it's worth, it does result in quite a bit of boilerplate if
done purely in OpenSCAD, so I don't do this unless the project is
complex enough that the parameters are confusing to manage as just a
bunch of global variables.

[1]
https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad
[2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad

-- Bob

On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote:

I am building assemblies with several parts, each of which has numerous

and

sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that

information

into comprehensible tables.

I'm calling a constructor function instead of simply specifying the

values

of a vector, so I can label each measurement with a name without using a
table.
The constructor functions assemble the named parameters into a vector,

and

accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

did that "Single unified namespace" make things difficult for backward compatibility? On Mon, Nov 22, 2021 at 9:39 PM Chow Loong Jin <hyperair@debian.org> wrote: > If I'm understanding correctly what you mean by constructors, I've been > using a similar structure for my delta 3d printer, you can see the source > code here: > - [1] for where the entire config tree is defined > - [2] for how it's used > > For what it's worth, it does result in quite a bit of boilerplate if > done purely in OpenSCAD, so I don't do this unless the project is > complex enough that the parameters are confusing to manage as just a > bunch of global variables. > > [1] > https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad > [2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad > > > -- Bob > > On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote: > > I am building assemblies with several parts, each of which has numerous > and > > sometimes complex features. > > > > I found several ideas for organizing a large number of individual > > measurements and wondered if there might be other approaches or if > > contemplated changes to OpenSCAD itself might also be helpful. > > > > First, organize the data in one file and geometry in a second file. > > Second, organize the data in columns form, using vectors as containers, > > labeling the columns of data in comments. > > Third, include a name and description in the vector. > > Fourth, when using the vector, provide accessor functions for the > > individual columns. > > > > I have an additional idea I'm using in my work. Constructors. I found it > > easy to identify features but more challenging to organize that > information > > into comprehensible tables. > > > > I'm calling a constructor function instead of simply specifying the > values > > of a vector, so I can label each measurement with a name without using a > > table. > > The constructor functions assemble the named parameters into a vector, > and > > accessor functions provide the values by name. > > > > I'm still assessing whether a formal constructor is a good idea. I'm > > considering whether to apply the concept everywhere or to simply use it > > when deemed "necessary". > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
L
larry
Tue, Nov 23, 2021 6:58 PM

On Tue, 2021-11-23 at 13:07 -0500, Patrick Callahan wrote:

did that "Single unified namespace" make things difficult for
backward compatibility?

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

On Tue, 2021-11-23 at 13:07 -0500, Patrick Callahan wrote: > did that "Single unified namespace" make things difficult for > backward compatibility? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
CL
Chow Loong Jin
Wed, Nov 24, 2021 5:15 AM

Hmm? By "Single unified namespace", are you talking about OpenSCAD's
lack of namespace support?

It does make things a little more annoying, but there are other, older
languages (like C) with similar constraints, so some best practices can
be borrowed and adapter to OpenSCAD (e.g. adding a prefix to all your
symbols) from there to avoid name conflicts.

-- Bob

On Tue, Nov 23, 2021 at 01:07:50PM -0500, Patrick Callahan wrote:

did that "Single unified namespace" make things difficult for backward
compatibility?

On Mon, Nov 22, 2021 at 9:39 PM Chow Loong Jin hyperair@debian.org wrote:

If I'm understanding correctly what you mean by constructors, I've been
using a similar structure for my delta 3d printer, you can see the source
code here:

  • [1] for where the entire config tree is defined
  • [2] for how it's used

For what it's worth, it does result in quite a bit of boilerplate if
done purely in OpenSCAD, so I don't do this unless the project is
complex enough that the parameters are confusing to manage as just a
bunch of global variables.

[1]
https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad
[2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad

-- Bob

On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote:

I am building assemblies with several parts, each of which has numerous

and

sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as containers,
labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I found it
easy to identify features but more challenging to organize that

information

into comprehensible tables.

I'm calling a constructor function instead of simply specifying the

values

of a vector, so I can label each measurement with a name without using a
table.
The constructor functions assemble the named parameters into a vector,

and

accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use it
when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Hmm? By "Single unified namespace", are you talking about OpenSCAD's lack of namespace support? It does make things a little more annoying, but there are other, older languages (like C) with similar constraints, so some best practices can be borrowed and adapter to OpenSCAD (e.g. adding a prefix to all your symbols) from there to avoid name conflicts. -- Bob On Tue, Nov 23, 2021 at 01:07:50PM -0500, Patrick Callahan wrote: > did that "Single unified namespace" make things difficult for backward > compatibility? > > On Mon, Nov 22, 2021 at 9:39 PM Chow Loong Jin <hyperair@debian.org> wrote: > > > If I'm understanding correctly what you mean by constructors, I've been > > using a similar structure for my delta 3d printer, you can see the source > > code here: > > - [1] for where the entire config tree is defined > > - [2] for how it's used > > > > For what it's worth, it does result in quite a bit of boilerplate if > > done purely in OpenSCAD, so I don't do this unless the project is > > complex enough that the parameters are confusing to manage as just a > > bunch of global variables. > > > > [1] > > https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad > > [2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad > > > > > > -- Bob > > > > On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote: > > > I am building assemblies with several parts, each of which has numerous > > and > > > sometimes complex features. > > > > > > I found several ideas for organizing a large number of individual > > > measurements and wondered if there might be other approaches or if > > > contemplated changes to OpenSCAD itself might also be helpful. > > > > > > First, organize the data in one file and geometry in a second file. > > > Second, organize the data in columns form, using vectors as containers, > > > labeling the columns of data in comments. > > > Third, include a name and description in the vector. > > > Fourth, when using the vector, provide accessor functions for the > > > individual columns. > > > > > > I have an additional idea I'm using in my work. Constructors. I found it > > > easy to identify features but more challenging to organize that > > information > > > into comprehensible tables. > > > > > > I'm calling a constructor function instead of simply specifying the > > values > > > of a vector, so I can label each measurement with a name without using a > > > table. > > > The constructor functions assemble the named parameters into a vector, > > and > > > accessor functions provide the values by name. > > > > > > I'm still assessing whether a formal constructor is a good idea. I'm > > > considering whether to apply the concept everywhere or to simply use it > > > when deemed "necessary". > > > > > _______________________________________________ > > > OpenSCAD mailing list > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
PC
Patrick Callahan
Wed, Nov 24, 2021 5:21 PM

Bob,

A "Single Unified Namespace" was proposed back in discussions about
OpenSCAD2. You can find more on this and other stuff from the links Jordan
gave.

I think it would be "nice to have" as an optional feature.  The maintainers
would decide if that is or is not a good idea.  I know just enough about
computer language design and engineering to be dangerous.

Some of the proposals for OpenSCAD2 made it into the Curv project:
http://www.curv3d.org.  I don't know the details.

I don't know if formal namespaces are needed, but the objects would provide
an easy structured way to handle data. Having "objects" as described would
make code describing complex combinations of features code clearer and
easier to read and write.

My next step is getting the OpenScad sources to take a look.

-Pat

On Wed, Nov 24, 2021 at 12:15 AM Chow Loong Jin hyperair@debian.org wrote:

Hmm? By "Single unified namespace", are you talking about OpenSCAD's
lack of namespace support?

It does make things a little more annoying, but there are other, older
languages (like C) with similar constraints, so some best practices can
be borrowed and adapter to OpenSCAD (e.g. adding a prefix to all your
symbols) from there to avoid name conflicts.

-- Bob

On Tue, Nov 23, 2021 at 01:07:50PM -0500, Patrick Callahan wrote:

did that "Single unified namespace" make things difficult for backward
compatibility?

On Mon, Nov 22, 2021 at 9:39 PM Chow Loong Jin hyperair@debian.org

wrote:

If I'm understanding correctly what you mean by constructors, I've been
using a similar structure for my delta 3d printer, you can see the

source

code here:

  • [1] for where the entire config tree is defined
  • [2] for how it's used

For what it's worth, it does result in quite a bit of boilerplate if
done purely in OpenSCAD, so I don't do this unless the project is
complex enough that the parameters are confusing to manage as just a
bunch of global variables.

[1]

[2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad

-- Bob

On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote:

I am building assemblies with several parts, each of which has

numerous

and

sometimes complex features.

I found several ideas for organizing a large number of individual
measurements and wondered if there might be other approaches or if
contemplated changes to OpenSCAD itself might also be helpful.

First, organize the data in one file and geometry in a second file.
Second, organize the data in columns form, using vectors as

containers,

labeling the columns of data in comments.
Third, include a name and description in the vector.
Fourth, when using the vector, provide accessor functions for the
individual columns.

I have an additional idea I'm using in my work. Constructors. I

found it

easy to identify features but more challenging to organize that

information

into comprehensible tables.

I'm calling a constructor function instead of simply specifying the

values

of a vector, so I can label each measurement with a name without

using a

table.
The constructor functions assemble the named parameters into a

vector,

and

accessor functions provide the values by name.

I'm still assessing whether a formal constructor is a good idea.  I'm
considering whether to apply the concept everywhere or to simply use

it

when deemed "necessary".


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Bob, A "Single Unified Namespace" was proposed back in discussions about OpenSCAD2. You can find more on this and other stuff from the links Jordan gave. I think it would be "nice to have" as an optional feature. The maintainers would decide if that is or is not a good idea. I know just enough about computer language design and engineering to be dangerous. Some of the proposals for OpenSCAD2 made it into the Curv project: http://www.curv3d.org. I don't know the details. I don't know if formal namespaces are needed, but the objects would provide an easy structured way to handle data. Having "objects" as described would make code describing complex combinations of features code clearer and easier to read and write. My next step is getting the OpenScad sources to take a look. -Pat On Wed, Nov 24, 2021 at 12:15 AM Chow Loong Jin <hyperair@debian.org> wrote: > Hmm? By "Single unified namespace", are you talking about OpenSCAD's > lack of namespace support? > > It does make things a little more annoying, but there are other, older > languages (like C) with similar constraints, so some best practices can > be borrowed and adapter to OpenSCAD (e.g. adding a prefix to all your > symbols) from there to avoid name conflicts. > > -- Bob > > On Tue, Nov 23, 2021 at 01:07:50PM -0500, Patrick Callahan wrote: > > did that "Single unified namespace" make things difficult for backward > > compatibility? > > > > On Mon, Nov 22, 2021 at 9:39 PM Chow Loong Jin <hyperair@debian.org> > wrote: > > > > > If I'm understanding correctly what you mean by constructors, I've been > > > using a similar structure for my delta 3d printer, you can see the > source > > > code here: > > > - [1] for where the entire config tree is defined > > > - [2] for how it's used > > > > > > For what it's worth, it does result in quite a bit of boilerplate if > > > done purely in OpenSCAD, so I don't do this unless the project is > > > complex enough that the parameters are confusing to manage as just a > > > bunch of global variables. > > > > > > [1] > > > > https://github.com/hyperair/deltabob/blob/232761f/configuration/delta.scad > > > [2] https://github.com/hyperair/deltabob/blob/232761f/effector.scad > > > > > > > > > -- Bob > > > > > > On Mon, Nov 22, 2021 at 10:19:07AM -0500, Patrick Callahan wrote: > > > > I am building assemblies with several parts, each of which has > numerous > > > and > > > > sometimes complex features. > > > > > > > > I found several ideas for organizing a large number of individual > > > > measurements and wondered if there might be other approaches or if > > > > contemplated changes to OpenSCAD itself might also be helpful. > > > > > > > > First, organize the data in one file and geometry in a second file. > > > > Second, organize the data in columns form, using vectors as > containers, > > > > labeling the columns of data in comments. > > > > Third, include a name and description in the vector. > > > > Fourth, when using the vector, provide accessor functions for the > > > > individual columns. > > > > > > > > I have an additional idea I'm using in my work. Constructors. I > found it > > > > easy to identify features but more challenging to organize that > > > information > > > > into comprehensible tables. > > > > > > > > I'm calling a constructor function instead of simply specifying the > > > values > > > > of a vector, so I can label each measurement with a name without > using a > > > > table. > > > > The constructor functions assemble the named parameters into a > vector, > > > and > > > > accessor functions provide the values by name. > > > > > > > > I'm still assessing whether a formal constructor is a good idea. I'm > > > > considering whether to apply the concept everywhere or to simply use > it > > > > when deemed "necessary". > > > > > > > _______________________________________________ > > > > OpenSCAD mailing list > > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > > > OpenSCAD mailing list > > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >