discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Automatic reading of coordinates of vertices

O
openscadfan
Thu, May 4, 2017 10:49 AM

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!

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]);

--
View this message in context: http://forum.openscad.org/Automatic-reading-of-coordinates-of-vertices-tp21401.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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! 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]); -- View this message in context: http://forum.openscad.org/Automatic-reading-of-coordinates-of-vertices-tp21401.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Thu, May 4, 2017 2:42 PM

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 professor.pearce@gmail.com:

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!

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 <professor.pearce@gmail.com>: > 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! >
CA
Carsten Arnholm
Thu, May 4, 2017 3:58 PM

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

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
P
Parkinbot
Thu, May 4, 2017 9:46 PM

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 see what I mean I translated your code into "functional OpenSCAD". You
will have to pick out 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);

--
View this message in context: http://forum.openscad.org/Automatic-reading-of-coordinates-of-vertices-tp21401p21404.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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 see what I mean I translated your code into "functional OpenSCAD". You will have to pick out 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); -- View this message in context: http://forum.openscad.org/Automatic-reading-of-coordinates-of-vertices-tp21401p21404.html Sent from the OpenSCAD mailing list archive at Nabble.com.
O
openscadfan
Fri, May 5, 2017 9:10 PM

Thank you all!

--
View this message in context: http://forum.openscad.org/Automatic-reading-of-coordinates-of-vertices-tp21401p21411.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thank you all! -- View this message in context: http://forum.openscad.org/Automatic-reading-of-coordinates-of-vertices-tp21401p21411.html Sent from the OpenSCAD mailing list archive at Nabble.com.