exporting information from a module?

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

exporting information from a module?

fergald@gmail.com
I've recently started using OpenSCAD, I'm very impressed, thanks to all the people who made it real.

I think this is a feature request but I'm curious if there's something like it that I am missing or if this is a possibility in the future.

One thing I find is that I want to export calculations or measurements from inside a module to outside. E.g. the module builds a shape with a certain height, that height was computed based on parameters to the module. I'd like to be able to refer to that height outside, e.g. to pass a parameter for another module. I don't see a way to do this at the moment. It seems like it would also require being able to assign instances of modules to variables.

E.g. I want to drill a cylindrical hole that is wide enough to fit a countersunk bolt head and I'm using BOSL. So I use the exported function from BOSL get_metric_socket_cap_diam() but the programmer in me wants to encapsulate this in the bolt itself. E.g.

use <lib/BOSL/metric_screws.scad>
my_bolt = metric_bolt(size=5, l=30, headtype="countersunk"); // renders nothing
cylinder(r=bolt.head_diam); // renders a compatible cylinder

Also being able to access some positional information for an instance of a module e.g. the module's "origin" and alignment-vector would be really helpful for correctly positioning things relative to each other.

Is there already something I'm missing that would do this? If not, is there any chance of such features?

F

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

Re: exporting information from a module?

nophead
There isn't a way to do that currently but I use a different way to represent objects in my library. I describe everything with a list and pass that as the first parameter to all functions and modules that operate on it.

Your example then becomes

include <NopSCADlib/screws.scad>
my_bolt = M5_cs_cap_screw; // assigns object description list to my_bolt

cylinder(r = screw_head_radius(my_bolt), h = screw_head_height(my_bolt));  // Draws a compatible cylinder

screw(my_bolt, 30); // Draw a 30mm screw

My screws always have their origin at the part of the head that mates with the surface and they always point down. So for a countersunk screw it would be the top of the head, for a cap head screw it would be the top of the stem. So they are always translated and rotated to the top of the screw hole. No need for origin information or alignment vectors as all objects have the most convenient origin by convention.

On Sat, 20 Jun 2020 at 10:51, Fergal Daly <[hidden email]> wrote:
I've recently started using OpenSCAD, I'm very impressed, thanks to all the people who made it real.

I think this is a feature request but I'm curious if there's something like it that I am missing or if this is a possibility in the future.

One thing I find is that I want to export calculations or measurements from inside a module to outside. E.g. the module builds a shape with a certain height, that height was computed based on parameters to the module. I'd like to be able to refer to that height outside, e.g. to pass a parameter for another module. I don't see a way to do this at the moment. It seems like it would also require being able to assign instances of modules to variables.

E.g. I want to drill a cylindrical hole that is wide enough to fit a countersunk bolt head and I'm using BOSL. So I use the exported function from BOSL get_metric_socket_cap_diam() but the programmer in me wants to encapsulate this in the bolt itself. E.g.

use <lib/BOSL/metric_screws.scad>
my_bolt = metric_bolt(size=5, l=30, headtype="countersunk"); // renders nothing
cylinder(r=bolt.head_diam); // renders a compatible cylinder

Also being able to access some positional information for an instance of a module e.g. the module's "origin" and alignment-vector would be really helpful for correctly positioning things relative to each other.

Is there already something I'm missing that would do this? If not, is there any chance of such features?

F
_______________________________________________
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: exporting information from a module?

cacb
In reply to this post by fergald@gmail.com
On 2020-06-20 11:50, Fergal Daly wrote:
> One thing I find is that I want to export calculations or measurements
> from inside a module to outside. E.g. the module builds a shape with a
> certain height, that height was computed based on parameters to the
> module. I'd like to be able to refer to that height outside, e.g. to
> pass a parameter for another module. I don't see a way to do this at
> the moment. It seems like it would also require being able to assign
> instances of modules to variables.

You cannot do that in OpenSCAD, the language does not offer/allow
retrieval of parameters. The typical way to do it would be to let each
cube, cylinder etc, be instances of classes with member functions to
retrieve the construction parameters. AngelCAD does exactly that, but
OpenSCAD does not.

> E.g. I want to drill a cylindrical hole that is wide enough to fit a
> countersunk bolt head and I'm using BOSL. So I use the exported
> function from BOSL get_metric_socket_cap_diam() but the programmer in
> me wants to encapsulate this in the bolt itself. E.g.

You want the ability to create user defined classes in addition to
built-in ones. You can do that in AngelCAD.

> Also being able to access some positional information for an instance
> of a module e.g. the module's "origin" and alignment-vector would be
> really helpful for correctly positioning things relative to each
> other.

One (partial) solution to this is to offer computation of bounding
boxes, which AngelCAD has.

> Is there already something I'm missing that would do this? If not, is
> there any chance of such features?

The OpenSCAD language is said to be a 'functional language', i.e. a
declarative style which by design does not allow retrieval of the kind
of information you are asking for. So I think there is a very low
probability that such features will appear in OpeSCAD.

Carsten Anrholm

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

Re: exporting information from a module?

OpenSCAD mailing list-2
In reply to this post by fergald@gmail.com
My work-around for this sort of thing is to have a second/parallel program which imports all the parameters from the JSON file which the Customizer saves which then calculates the list of parts:

http://tug.org/TUGboat/tb40-2/tb125adams-3d.pdf

William


-----Original Message-----
From: Fergal Daly <[hidden email]>
To: [hidden email]
Sent: Sat, Jun 20, 2020 5:50 am
Subject: [OpenSCAD] exporting information from a module?

I've recently started using OpenSCAD, I'm very impressed, thanks to all the people who made it real.

I think this is a feature request but I'm curious if there's something like it that I am missing or if this is a possibility in the future.

One thing I find is that I want to export calculations or measurements from inside a module to outside. E.g. the module builds a shape with a certain height, that height was computed based on parameters to the module. I'd like to be able to refer to that height outside, e.g. to pass a parameter for another module. I don't see a way to do this at the moment. It seems like it would also require being able to assign instances of modules to variables.

E.g. I want to drill a cylindrical hole that is wide enough to fit a countersunk bolt head and I'm using BOSL. So I use the exported function from BOSL get_metric_socket_cap_diam() but the programmer in me wants to encapsulate this in the bolt itself. E.g.

use <lib/BOSL/metric_screws.scad>
my_bolt = metric_bolt(size=5, l=30, headtype="countersunk"); // renders nothing
cylinder(r=bolt.head_diam); // renders a compatible cylinder

Also being able to access some positional information for an instance of a module e.g. the module's "origin" and alignment-vector would be really helpful for correctly positioning things relative to each other.

Is there already something I'm missing that would do this? If not, is there any chance of such features?

F
_______________________________________________
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: exporting information from a module?

fergald@gmail.com
In reply to this post by nophead
Thanks. Yeah, I was thinking about something like that. You could also have
your own translate and rotate that you can apply to these lists and manage
all of that but that's just all getting very clunky,

F


nophead wrote

> There isn't a way to do that currently but I use a different way to
> represent objects in my library. I describe everything with a list and
> pass
> that as the first parameter to all functions and modules that operate on
> it.
>
> Your example then becomes
>
> include &lt;NopSCADlib/screws.scad&gt;
> my_bolt = M5_cs_cap_screw; // assigns object description list to my_bolt
>
> cylinder(r = screw_head_radius(my_bolt), h = screw_head_height(my_bolt));
> // Draws a compatible cylinder
>
> screw(my_bolt, 30); // Draw a 30mm screw
>
> My screws always have their origin at the part of the head that mates with
> the surface and they always point down. So for a countersunk screw it
> would
> be the top of the head, for a cap head screw it would be the top of the
> stem. So they are always translated and rotated to the top of the screw
> hole. No need for origin information or alignment vectors as all objects
> have the most convenient origin by convention.
>
> On Sat, 20 Jun 2020 at 10:51, Fergal Daly &lt;

> fergald@

> &gt; wrote:
>
>> I've recently started using OpenSCAD, I'm very impressed, thanks to all
>> the people who made it real.
>>
>> I think this is a feature request but I'm curious if there's something
>> like it that I am missing or if this is a possibility in the future.
>>
>> One thing I find is that I want to export calculations or measurements
>> from inside a module to outside. E.g. the module builds a shape with a
>> certain height, that height was computed based on parameters to the
>> module.
>> I'd like to be able to refer to that height outside, e.g. to pass a
>> parameter for another module. I don't see a way to do this at the moment.
>> It seems like it would also require being able to assign instances of
>> modules to variables.
>>
>> E.g. I want to drill a cylindrical hole that is wide enough to fit a
>> countersunk bolt head and I'm using BOSL. So I use the exported function
>> from BOSL get_metric_socket_cap_diam() but the programmer in me wants to
>> encapsulate this in the bolt itself. E.g.
>>
>> use &lt;lib/BOSL/metric_screws.scad&gt;
>> my_bolt = metric_bolt(size=5, l=30, headtype="countersunk"); // renders
>> nothing
>> cylinder(r=bolt.head_diam); // renders a compatible cylinder
>>
>> Also being able to access some positional information for an instance of
>> a
>> module e.g. the module's "origin" and alignment-vector would be really
>> helpful for correctly positioning things relative to each other.
>>
>> Is there already something I'm missing that would do this? If not, is
>> there any chance of such features?
>>
>> F
>> _______________________________________________
>> OpenSCAD mailing list
>>

> Discuss@.openscad

>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.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: exporting information from a module?

fergald@gmail.com
In reply to this post by cacb
cacb wrote

> On 2020-06-20 11:50, Fergal Daly wrote:
>> One thing I find is that I want to export calculations or measurements
>> from inside a module to outside. E.g. the module builds a shape with a
>> certain height, that height was computed based on parameters to the
>> module. I'd like to be able to refer to that height outside, e.g. to
>> pass a parameter for another module. I don't see a way to do this at
>> the moment. It seems like it would also require being able to assign
>> instances of modules to variables.
>
> You cannot do that in OpenSCAD, the language does not offer/allow
> retrieval of parameters. The typical way to do it would be to let each
> cube, cylinder etc, be instances of classes with member functions to
> retrieve the construction parameters. AngelCAD does exactly that, but
> OpenSCAD does not.
>
>> E.g. I want to drill a cylindrical hole that is wide enough to fit a
>> countersunk bolt head and I'm using BOSL. So I use the exported
>> function from BOSL get_metric_socket_cap_diam() but the programmer in
>> me wants to encapsulate this in the bolt itself. E.g.
>
> You want the ability to create user defined classes in addition to
> built-in ones. You can do that in AngelCAD.

Well not exactly, since you can't query the built-in ones either because you
cannot refer to them. Missing piece #1 is the ability to refer to a
constructed object, not just immediately add it to the tree. Then ideally
you would be able to query any of it's input parameters any of the
calculated parameters it chooses to expose and some standard parameters like
origin and orientation.


cacb wrote

>> Also being able to access some positional information for an instance
>> of a module e.g. the module's "origin" and alignment-vector would be
>> really helpful for correctly positioning things relative to each
>> other.
>
> One (partial) solution to this is to offer computation of bounding
> boxes, which AngelCAD has.
>
>> Is there already something I'm missing that would do this? If not, is
>> there any chance of such features?
>
> The OpenSCAD language is said to be a 'functional language', i.e. a
> declarative style which by design does not allow retrieval of the kind
> of information you are asking for. So I think there is a very low
> probability that such features will appear in OpeSCAD.

There's nothing fundamentally non-declarative about adding structure and
extra information, it's common in pure functional languages.

Anyway, I'll take a look at AngelCAD, looks like it does some or all of what
I'm talking about.

Thanks,

F


cacb wrote
> Carsten Anrholm
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.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: exporting information from a module?

nophead
My property lists describe objects, they have size information, but no coordinates, so I can't apply transformations to them. To position something I translate and rotate the module that draws it, possibly using functions to get its size.

I have functions to get all the information from the list without needing to know anything about its layout or contents. It is just a name I pass to all the rated functions and modules. I can also put it in the property lists of other objects. For example a fan has a screw property, a screw has nut and washer properties.

If I have a new requirement for some information about an object I add a function to calculate it, or expand the property list. It doesn't change any client code because the property lists are all in the library and only ever referenced by name in the client.

Since the list has all the information needed to draw the object, make holes for it, etc, I always have all the information I need about an object, without ever needing to ask OpenSCAD anything. I know the width and height of a fan, what screws it takes, where the screw holes are, the shape of the aperture needed in a panel and have modules to generate fan guards, grills and gaskets.

It is just home rolled object orientation but it fits OpenSCAD because I always specify geometry, I never need to ask questions about what gets generated.

On Sun, 21 Jun 2020 at 07:25, [hidden email] <[hidden email]> wrote:
cacb wrote
> On 2020-06-20 11:50, Fergal Daly wrote:
>> One thing I find is that I want to export calculations or measurements
>> from inside a module to outside. E.g. the module builds a shape with a
>> certain height, that height was computed based on parameters to the
>> module. I'd like to be able to refer to that height outside, e.g. to
>> pass a parameter for another module. I don't see a way to do this at
>> the moment. It seems like it would also require being able to assign
>> instances of modules to variables.
>
> You cannot do that in OpenSCAD, the language does not offer/allow
> retrieval of parameters. The typical way to do it would be to let each
> cube, cylinder etc, be instances of classes with member functions to
> retrieve the construction parameters. AngelCAD does exactly that, but
> OpenSCAD does not.
>
>> E.g. I want to drill a cylindrical hole that is wide enough to fit a
>> countersunk bolt head and I'm using BOSL. So I use the exported
>> function from BOSL get_metric_socket_cap_diam() but the programmer in
>> me wants to encapsulate this in the bolt itself. E.g.
>
> You want the ability to create user defined classes in addition to
> built-in ones. You can do that in AngelCAD.

Well not exactly, since you can't query the built-in ones either because you
cannot refer to them. Missing piece #1 is the ability to refer to a
constructed object, not just immediately add it to the tree. Then ideally
you would be able to query any of it's input parameters any of the
calculated parameters it chooses to expose and some standard parameters like
origin and orientation.


cacb wrote
>> Also being able to access some positional information for an instance
>> of a module e.g. the module's "origin" and alignment-vector would be
>> really helpful for correctly positioning things relative to each
>> other.
>
> One (partial) solution to this is to offer computation of bounding
> boxes, which AngelCAD has.
>
>> Is there already something I'm missing that would do this? If not, is
>> there any chance of such features?
>
> The OpenSCAD language is said to be a 'functional language', i.e. a
> declarative style which by design does not allow retrieval of the kind
> of information you are asking for. So I think there is a very low
> probability that such features will appear in OpeSCAD.

There's nothing fundamentally non-declarative about adding structure and
extra information, it's common in pure functional languages.

Anyway, I'll take a look at AngelCAD, looks like it does some or all of what
I'm talking about.

Thanks,

F


cacb wrote
> Carsten Anrholm
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.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: exporting information from a module?

Peter
In reply to this post by fergald@gmail.com

to me it looks pretty much like another use case for my "constructive"
library again. it will do that with nice concise syntax.all the
translate, rotate, cube,etc.. have been reimplemented for use of
vectors,more concise syntax and more features like alignment.. i am
using it for years now, almost never go back to plain vanilla openscad
syntax anymore.
 
i am still saving the effort of clening up and publishing, perhaps the
potential use of it to others will outweigh the price of effort to do
it. perhaps not.
it is just the question if anybody would actually be ready to learn and
get used to something something made by others, instead of comfortably
going his own ways and reimplementing parts he needs in every project.
that is the perpetual dilemma: what do you think folks?how are the chances?
for instance i personally never use MCAD, i do not know it well, so i
think i have reimplemented some parts of it in some projects for sure.

On 21.06.20 08:08, [hidden email] wrote:

> Thanks. Yeah, I was thinking about something like that. You could also have
> your own translate and rotate that you can apply to these lists and manage
> all of that but that's just all getting very clunky,
>
> F
>
>
> nophead wrote
>> There isn't a way to do that currently but I use a different way to
>> represent objects in my library. I describe everything with a list and
>> pass
>> that as the first parameter to all functions and modules that operate on
>> it.
>>
>> Your example then becomes
>>
>> include &lt;NopSCADlib/screws.scad&gt;
>> my_bolt = M5_cs_cap_screw; // assigns object description list to my_bolt
>>
>> cylinder(r = screw_head_radius(my_bolt), h = screw_head_height(my_bolt));
>> // Draws a compatible cylinder
>>
>> screw(my_bolt, 30); // Draw a 30mm screw
>>
>> My screws always have their origin at the part of the head that mates with
>> the surface and they always point down. So for a countersunk screw it
>> would
>> be the top of the head, for a cap head screw it would be the top of the
>> stem. So they are always translated and rotated to the top of the screw
>> hole. No need for origin information or alignment vectors as all objects
>> have the most convenient origin by convention.
>>
>> On Sat, 20 Jun 2020 at 10:51, Fergal Daly &lt;
>> fergald@
>> &gt; wrote:
>>
>>> I've recently started using OpenSCAD, I'm very impressed, thanks to all
>>> the people who made it real.
>>>
>>> I think this is a feature request but I'm curious if there's something
>>> like it that I am missing or if this is a possibility in the future.
>>>
>>> One thing I find is that I want to export calculations or measurements
>>> from inside a module to outside. E.g. the module builds a shape with a
>>> certain height, that height was computed based on parameters to the
>>> module.
>>> I'd like to be able to refer to that height outside, e.g. to pass a
>>> parameter for another module. I don't see a way to do this at the moment.
>>> It seems like it would also require being able to assign instances of
>>> modules to variables.
>>>
>>> E.g. I want to drill a cylindrical hole that is wide enough to fit a
>>> countersunk bolt head and I'm using BOSL. So I use the exported function
>>> from BOSL get_metric_socket_cap_diam() but the programmer in me wants to
>>> encapsulate this in the bolt itself. E.g.
>>>
>>> use &lt;lib/BOSL/metric_screws.scad&gt;
>>> my_bolt = metric_bolt(size=5, l=30, headtype="countersunk"); // renders
>>> nothing
>>> cylinder(r=bolt.head_diam); // renders a compatible cylinder
>>>
>>> Also being able to access some positional information for an instance of
>>> a
>>> module e.g. the module's "origin" and alignment-vector would be really
>>> helpful for correctly positioning things relative to each other.
>>>
>>> Is there already something I'm missing that would do this? If not, is
>>> there any chance of such features?
>>>
>>> F
>>> _______________________________________________
>>> OpenSCAD mailing list
>>>
>> Discuss@.openscad
>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss@.openscad
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
>
> --
> Sent from: http://forum.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: exporting information from a module?

JordanBrown
In reply to this post by fergald@gmail.com
On 6/20/2020 11:25 PM, [hidden email] wrote:
Well not exactly, since you can't query the built-in ones either because you cannot refer to them. Missing piece #1 is the ability to refer to a constructed object, not just immediately add it to the tree. Then ideally you would be able to query any of it's input parameters any of the calculated parameters it chooses to expose and some standard parameters like origin and orientation.

Could you give an example of how it would be useful to query the origin or orientation of an object?

I'm not even understanding what it would mean.


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

Re: exporting information from a module?

Peter
In reply to this post by cacb
the angelcad thing looks very promising to me, thanks forit and
thedemvideo Arnholm!
https://www.youtube.com/watch?v=4JJDHR0ATBs
On 20.06.20 13:53, [hidden email] wrote:

> On 2020-06-20 11:50, Fergal Daly wrote:
>> One thing I find is that I want to export calculations or measurements
>> from inside a module to outside. E.g. the module builds a shape with a
>> certain height, that height was computed based on parameters to the
>> module. I'd like to be able to refer to that height outside, e.g. to
>> pass a parameter for another module. I don't see a way to do this at
>> the moment. It seems like it would also require being able to assign
>> instances of modules to variables.
>
> You cannot do that in OpenSCAD, the language does not offer/allow
> retrieval of parameters. The typical way to do it would be to let each
> cube, cylinder etc, be instances of classes with member functions to
> retrieve the construction parameters. AngelCAD does exactly that, but
> OpenSCAD does not.
>
>> E.g. I want to drill a cylindrical hole that is wide enough to fit a
>> countersunk bolt head and I'm using BOSL. So I use the exported
>> function from BOSL get_metric_socket_cap_diam() but the programmer in
>> me wants to encapsulate this in the bolt itself. E.g.
>
> You want the ability to create user defined classes in addition to
> built-in ones. You can do that in AngelCAD.
>
>> Also being able to access some positional information for an instance
>> of a module e.g. the module's "origin" and alignment-vector would be
>> really helpful for correctly positioning things relative to each
>> other.
>
> One (partial) solution to this is to offer computation of bounding
> boxes, which AngelCAD has.
>
>> Is there already something I'm missing that would do this? If not, is
>> there any chance of such features?
>
> The OpenSCAD language is said to be a 'functional language', i.e. a
> declarative style which by design does not allow retrieval of the kind
> of information you are asking for. So I think there is a very low
> probability that such features will appear in OpeSCAD.
>
> Carsten Anrholm
>
> _______________________________________________
> 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: exporting information from a module?

OpenSCAD mailing list-2
In reply to this post by JordanBrown
In TeX it it possible to measure a box, and based on that measurement place things.

Being able to measure an object would allow one to for example place a hole relative to the object --- cadquery allows that sort of thing for instance.

I've been trying to do coopered boxes, and it would have been nice to measure a slat after cutting off the edges at an angle rather than having to do the trigonometry to determine how wide the slats were.

William


-----Original Message-----
From: Jordan Brown <[hidden email]>
To: OpenSCAD general discussion <[hidden email]>; [hidden email] <[hidden email]>
Sent: Sun, Jun 21, 2020 12:28 pm
Subject: Re: [OpenSCAD] exporting information from a module?

On 6/20/2020 11:25 PM, [hidden email] wrote:
Well not exactly, since you can't query the built-in ones either because you cannot refer to them. Missing piece #1 is the ability to refer to a constructed object, not just immediately add it to the tree. Then ideally you would be able to query any of it's input parameters any of the calculated parameters it chooses to expose and some standard parameters like origin and orientation.


Could you give an example of how it would be useful to query the origin or orientation of an object?

I'm not even understanding what it would mean.


_______________________________________________
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: exporting information from a module?

JordanBrown
On 6/21/2020 3:44 PM, William F. Adams via Discuss wrote:
On 6/20/2020 11:25 PM, [hidden email] wrote:
Well not exactly, since you can't query the built-in ones either because you cannot refer to them. Missing piece #1 is the ability to refer to a constructed object, not just immediately add it to the tree. Then ideally you would be able to query any of it's input parameters any of the calculated parameters it chooses to expose and some standard parameters like origin and orientation.
Could you give an example of how it would be useful to query the origin or orientation of an object?

I'm not even understanding what it would mean.
In TeX it it possible to measure a box, and based on that measurement place things.

Being able to measure an object would allow one to for example place a hole relative to the object --- cadquery allows that sort of thing for instance.

I've been trying to do coopered boxes, and it would have been nice to measure a slat after cutting off the edges at an angle rather than having to do the trigonometry to determine how wide the slats were.

Extracting various dimensions (e.g. bounding boxes) I understand.

But I don't understand extracting orientation and origin.


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