Automatic reading of coordinates of vertices

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

Automatic reading of coordinates of vertices

openscadfan
Hi all,

I am trying to use OpenSCAD as the foundation to optimize the design of solar PV system. I need an easy way to read off the (x,y,z) location of the red corners (see image)


when I send the following through loops to change the main angles. Any help you could give me to point me in the right direction would be most appreciated. Thank you!

pvLength = 10;
pvHeight = 10;
pvTiltAngle = 35;
pvAzimuthAngle = 0;

reflectorLength = 15;
reflectorHeight = 15;
reflectorTiltAngle = 55;
reflectorAzimuthAngle = 60;

rotate([180-pvTiltAngle,0,pvAzimuthAngle+180]) color([0,0,0.8]) cube([pvLength, pvHeight, 2]);
rotate([reflectorTiltAngle,0,-reflectorAzimuthAngle]) translate([0,0,-10]) cube([reflectorLength, reflectorHeight, 10]);
Reply | Threaded
Open this post in threaded view
|

Re: Automatic reading of coordinates of vertices

Ronaldo
There is no way to make queries to a model with OpenSCAD language. In your specific case, it would be easy to compute the needed coordinates since there is no boolean operations to build the model.

2017-05-04 7:49 GMT-03:00 openscadfan <[hidden email]>:
Hi all,

I am trying to use OpenSCAD as the foundation to optimize the design of
solar PV system. I need an easy way to read off the (x,y,z) location of the
red corners (see image)
<http://forum.openscad.org/file/n21401/finding_corners-red_dot.jpg>

when I send the following through loops to change the main angles. Any help
you could give me to point me in the right direction would be most
appreciated. Thank you!


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

Re: Automatic reading of coordinates of vertices

cacb
In reply to this post by openscadfan
On 04. mai 2017 12:49, openscadfan wrote:
> Hi all,
>
> I am trying to use OpenSCAD as the foundation to optimize the design of
> solar PV system. I need an easy way to read off the (x,y,z) location of the
> red corners (see image)
> <http://forum.openscad.org/file/n21401/finding_corners-red_dot.jpg>

You can't do that in the OpenSCAD language.

What you could do is to export the model to AMF and use some XML reader
to get the coordinates there. OpenSCAD was not made for model queries.

Carsten Arnholm




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

Re: Automatic reading of coordinates of vertices

Parkinbot
This post was updated on .
In reply to this post by openscadfan
Our friend thehans published a library called functional.scad, which can be used to find what you are seeking. Indeed your code is an almost perfect use case for it. But don't expect too much, as the lib does not support any boolean operations.
To show what I mean, I translated your code into "functional OpenSCAD". You will have to pick the information you are interested in from the console output.

use <functional.scad> // https://raw.githubusercontent.com/thehans/FunctionalOpenSCAD/master/functional.scad

pvLength = 10;
pvHeight = 10;
pvTiltAngle = 35;
pvAzimuthAngle = 0;

reflectorLength = 15;
reflectorHeight = 15;
reflectorTiltAngle = 55;
reflectorAzimuthAngle = 60;

A = cube([pvLength, pvHeight, 2]);
B = cube([reflectorLength, reflectorHeight, 10]);

C = rotate([180-pvTiltAngle,0,pvAzimuthAngle+180], poly=A);
D = rotate([reflectorTiltAngle,0,-reflectorAzimuthAngle], poly=translate([0,0,-10], B));

color([0,0,0.8]) poly3d(C);
color("green") poly3d(D);
echo(C=C);
echo(D=D);
Reply | Threaded
Open this post in threaded view
|

Re: Automatic reading of coordinates of vertices

openscadfan
In reply to this post by openscadfan
Thank you all!