Measure distances of a parametric design - and create a report

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

Measure distances of a parametric design - and create a report

YigalB
Is it possible to get an output report of distances between pre-set defined
points (e.g. between A1-A2, B1-B2 etc.) of a parametric design?

So if I run it with X=10, Y=25, A specific report will be generated, and if
I run with X=22, Y=17 - a different report will be generated.

A text file report is fine, a 2D drawing with the distances on it (like in a
spec) would be great.



--
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: Measure distances of a parametric design - and create a report

nophead
You can create a text report with echo() and str() and output it to a .echo file but you need a bit of post processing to make it look pretty. I.e. remove ECHO: and the quotes.

You can also generate dimension lines yourself by making a line of length A1-B2 with text of A1-B1 on it placed at A1 going to B1. You can then generate a png with those on.

On Wed, 21 Oct 2020 at 07:05, YigalB <[hidden email]> wrote:
Is it possible to get an output report of distances between pre-set defined
points (e.g. between A1-A2, B1-B2 etc.) of a parametric design?

So if I run it with X=10, Y=25, A specific report will be generated, and if
I run with X=22, Y=17 - a different report will be generated.

A text file report is fine, a 2D drawing with the distances on it (like in a
spec) would be great.



--
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: Measure distances of a parametric design - and create a report

bassklampfe
In reply to this post by YigalB
I am working on a 3D-Measure tool, which renders only in in preview, but not
in final render.
Give me one more week or so, you'll be surprised ;-)




--
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: Measure distances of a parametric design - and create a report

OpenSCAD mailing list-2
This is one of the things I was touching on in:

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

Basically, given the limitations in OpenSCAD (can't cleanly write out text files, can't generate arbitrary vectors, esp. unclosed paths and curves as curves) the most expedient thing to do seems to be to program in parallel and use a second tool such as METAPOST to address the lacunae.

William

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

Re: Measure distances of a parametric design - and create a report

YigalB
In reply to this post by nophead
 I am not sure I follow:

Can I place a virtual line (i.e. it will not be 3D printed), tie the ends of the lines to pre-defined points (such as the cnetr of circle 1 to the center of circle 2  , bith circles are parametric ), and generate the length into echo? 

If yes, then it will serve my needs.


<nop head  wrote:>

You can create a text report with echo() and str() and output it to a .echo file but you need a bit of post processing to make it look pretty. I.e. remove ECHO: and the quotes.

You can also generate dimension lines yourself by making a line of length A1-B2 with text of A1-B1 on it placed at A1 going to B1. You can then generate a png with those on.

On Wed, 21 Oct 2020 at 07:05, YigalB <[hidden email]> wrote:
Is it possible to get an output report of distances between pre-set defined
points (e.g. between A1-A2, B1-B2 etc.) of a parametric design?

So if I run it with X=10, Y=25, A specific report will be generated, and if
I run with X=22, Y=17 - a different report will be generated.

A text file report is fine, a 2D drawing with the distances on it (like in a
spec) would be great.



--
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: Measure distances of a parametric design - and create a report

nophead
If you place two circles then you must have specified the centres of the circles so you can write an expression for that.

E.g.

c1 = [ some complex expression ];
c2 = [ some complex expression ];  

translate(c1) circle();
translate(c2) circle();

echo(c2 - c1);

You can draw a line between centres by translating tiny circles there and taking the hull. You can use $preview to only show it in the preview and not appear in the render for STLs.



On Thu, 22 Oct 2020 at 06:41, Yigal B <[hidden email]> wrote:
 I am not sure I follow:

Can I place a virtual line (i.e. it will not be 3D printed), tie the ends of the lines to pre-defined points (such as the cnetr of circle 1 to the center of circle 2  , bith circles are parametric ), and generate the length into echo? 

If yes, then it will serve my needs.


<nop head  wrote:>

You can create a text report with echo() and str() and output it to a .echo file but you need a bit of post processing to make it look pretty. I.e. remove ECHO: and the quotes.

You can also generate dimension lines yourself by making a line of length A1-B2 with text of A1-B1 on it placed at A1 going to B1. You can then generate a png with those on.

On Wed, 21 Oct 2020 at 07:05, YigalB <[hidden email]> wrote:
Is it possible to get an output report of distances between pre-set defined
points (e.g. between A1-A2, B1-B2 etc.) of a parametric design?

So if I run it with X=10, Y=25, A specific report will be generated, and if
I run with X=22, Y=17 - a different report will be generated.

A text file report is fine, a 2D drawing with the distances on it (like in a
spec) would be great.



--
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

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

Re: Measure distances of a parametric design - and create a report

JordanBrown
On 10/21/2020 11:57 PM, nop head wrote:
If you place two circles then you must have specified the centres of the circles so you can write an expression for that.

E.g.

c1 = [ some complex expression ];
c2 = [ some complex expression ];  

translate(c1) circle();
translate(c2) circle();

echo(c2 - c1);

You can draw a line between centres by translating tiny circles there and taking the hull. You can use $preview to only show it in the preview and not appear in the render for STLs.

But, to be clear, *you* have to know where the points are.  OpenSCAD won't tell you.

For instance:
translate([10,0,0]) sphere(1);
rotate(27) translate([10,0,0]) sphere(1);

You'd have to do your own trigonometry to find the centerpoint of the second sphere.

More complicated:

module barsphere() {
    translate([0,-.5,-.5]) cube([10,1,1]);
    translate([10,0,0]) sphere(2);
}

barsphere();
rotate(40) barsphere();

You would not only have to do your own trigonometry, but you'd also have to "know" what barsphere() does; you'd have to "know" that it puts the sphere at [10,0,0].


    

  


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

Re: Measure distances of a parametric design - and create a report

bassklampfe
In reply to this post by nophead
nophead wrote

> If you place two circles then you must have specified the centres of the
> circles so you can write an expression for that.
>
> E.g.
>
> c1 = [ some complex expression ];
> c2 = [ some complex expression ];
>
> translate(c1) circle();
> translate(c2) circle();
>
> echo(c2 - c1);

What you want, is norm(c2-c1)

// two random positions
p1=rands(-50,50,3);
p2=rands(-50,50,3);
// spheres at each point
translate(p1)sphere(r=1,$fn=10);
translate(p2)sphere(r=1,$fn=10);
// calculate distance
distance=norm(p2-p1);
echo(p1=p1,p2=p2,distance=distance);



--
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: Measure distances of a parametric design - and create a report

nophead
> You would not only have to do your own trigonometry, but you'd also have to "know" what barsphere() does; you'd have to "know" that it puts the sphere at [10,0,0].

Yes you have to tell OpenSCAD where things are. It doesn't tell you anything in return. And yes you frequently need to do trig to place things. 

If you want to find where things are after transformations you can write the transformations as functions on matrices and call multmatrix to do the positioning and use the same matrix to transform a point like the origin.





On Thu, 22 Oct 2020 at 17:45, jjvbhh <[hidden email]> wrote:
nophead wrote
> If you place two circles then you must have specified the centres of the
> circles so you can write an expression for that.
>
> E.g.
>
> c1 = [ some complex expression ];
> c2 = [ some complex expression ];
>
> translate(c1) circle();
> translate(c2) circle();
>
> echo(c2 - c1);

What you want, is norm(c2-c1)

// two random positions
p1=rands(-50,50,3);
p2=rands(-50,50,3);
// spheres at each point
translate(p1)sphere(r=1,$fn=10);
translate(p2)sphere(r=1,$fn=10);
// calculate distance
distance=norm(p2-p1);
echo(p1=p1,p2=p2,distance=distance);



--
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