Dimension/Parameter labeling for part diagrams

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

Dimension/Parameter labeling for part diagrams

thehans
When making parametric scripts, sometimes its hard to describe what each parameter does without a visual aid.  So I thought it would be nice if there was some modules to help label parameters.

The idea is to be able to create technical part diagrams such as this:

The various part dimensions are given variable names, then those names could correspond to the variables in the script itself. 

Alternatively to showing variable names, you could make display the actual dimensions in unit values:

http://img1.wikia.nocookie.net/__cb20110503165248/lego/images/5/5a/Technical_drawing_minifigure.png

(all linked pics are more or less randomly pulled from google image search)

I'm not aware of any other libraries designed to do this so, I developed my own module.  Attached is an example that mostly does what I have in mind.  I still need to create something for labeling angles, and probably another for labeling radii.

the module signature right now is:
module dimension(txt, l, size=1, offset1=0, offset2=0, dir=[1,0,0], angle=0, color1="red")

-txt is the label string
-l is the length of dimension being labeled
-size is the size of the label text; the line width and arrows etc are also derived from this
-offset1 determines where the text is put along the dimension, 0 is centered, and positive or negative values go on either side outside the dimension bounds
-offset2 is how far the "vertical" lines extend, perpendicular to the dimension itself
-dir is a vector in the direction along the dimension
-angle is how the label is rotated about the dir vector

In the script I have attempted to demonstrate the various configurations for using it.

Let me know if you find this useful, if the parameters make sense, or other suggestions for improvements.  

Thanks,
Hans

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

dimensions.scad (4K) Download Attachment
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Dimension/Parameter labeling for part diagrams

tp3
Von: "Hans L" <[hidden email]>
> I'm not aware of any other libraries designed to do this so, I developed
> my own module.  Attached is an example that mostly does what I have in
> mind.  I still need to create something for labeling angles, and probably
> another for labeling radii.
>
There is http://www.cannymachines.com/entries/9/openscad_dimensioned_drawings
but I never used it myself so far.

ciao,
 Torsten.

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

Re: Dimension/Parameter labeling for part diagrams

Peter Falke
There is also a OpenSCAD Measurement tool from wifibum on Thingiverse:

http://www.thingiverse.com/thing:280469



2015-12-15 13:49 GMT+01:00 Torsten Paul <[hidden email]>:
Von: "Hans L" <[hidden email]>
> I'm not aware of any other libraries designed to do this so, I developed
> my own module.  Attached is an example that mostly does what I have in
> mind.  I still need to create something for labeling angles, and probably
> another for labeling radii.
>
There is http://www.cannymachines.com/entries/9/openscad_dimensioned_drawings
but I never used it myself so far.

ciao,
 Torsten.

_______________________________________________
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: Dimension/Parameter labeling for part diagrams

runsun
In reply to this post by thehans
@ thehans: Pretty cool, especially the "following cam" one.

I've tried both libs mentioned by Torstan and Peter. The one by Don Smiley is, in my mind, the godfather of dimension drawing in OpenSCAD. It can do a lot of different drawings, produces clean and well spaced (relatively speaking) output (the font is ugly, though). It is a bit hard to use (for me).  But in my opinion, for anyone wants to develop a dimension lib, this is the one worth studying.

wifibum's version has much more limited use comparing to Smiley's. Also the displayed font doesn't look comfortable.

Both versions are out-dated 'cos they use 3rd-party text writing lib but not the current text() built-in.

I also have developed a dimension feature as part of my lib, used in a thread earlier:



The most significant difference of my approach is that -- instead of writing a string around the origin ( [0,0,0] ) then moving it to destination -- it measures the distance between two given points and display it. The function call is like:
Dim( [P,Q,R], options )
where P,Q are the distance to be measured and R determines the plane to draw on.

Certainly, this approach makes sense only if P,Q are readily available, which is not the case in most OpenSCAD applications unless you are working on polyhedron objects.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: Dimension/Parameter labeling for part diagrams

thehans
Wow I guess I should have asked on the lists instead of on IRC before making it.  Didn't know its been done so many times.

On Tue, Dec 15, 2015 at 11:59 AM, runsun <[hidden email]> wrote:
@ thehans: Pretty cool, especially the "following cam" one.

I've tried both libs mentioned by Torstan and Peter. The one by  Don Smiley
<http://www.cannymachines.com/entries/9/openscad_dimensioned_drawings>   is,
in my mind, the godfather of dimension drawing in OpenSCAD. It can do a lot
of different drawings, produces clean and well spaced (relatively speaking)
output (the font is ugly, though). It is a bit hard to use (for me).  But in
my opinion, for anyone wants to develop a dimension lib, this is the one
worth studying.

wifibum's version
<http://www.cannymachines.com/entries/9/openscad_dimensioned_drawings>   has
much more limited use comparing to Smiley's. Also the displayed font doesn't
look comfortable.

Both versions are out-dated 'cos they use 3rd-party text writing lib but not
the current text() built-in.

I also have developed a dimension feature as part of my lib, used in a
thread <http://forum.openscad.org/OpenSCAD-and-Woodworking-td13966.html>
earlier:

<http://forum.openscad.org/file/n13966/201509_CornerShelf_Dim.png>

The most significant difference of my approach is that -- instead of writing
a string around the origin ( [0,0,0] ) then moving it to destination -- it
measures the distance between two given points and display it. The function
call is like:

> Dim( [P,Q,R], options )

where P,Q are the distance to be measured and R determines the plane to draw
on.

Certainly, this approach makes sense only if P,Q are readily available,
which is not the case in most OpenSCAD applications unless you are working
on polyhedron objects.



-----

$  Runsun Pan, PhD

$ libs:

doctest ,

faces ( git ),

offline doc ( git ),

runscad.py( 1 , 2 , git );


 $ tips:

hash( 1 , 2 ),

sweep ,

var( 1 , 2 ),

lerp ,

animGif ,

precision( 1 , 2 )








--
View this message in context: http://forum.openscad.org/Dimension-Parameter-labeling-for-part-diagrams-tp15172p15178.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
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: Dimension/Parameter labeling for part diagrams

Neon22
canny machines zip file program can be converted to new text by editing dimlines.scad:
- removing this line:
use <TextGenerator.scad>

- add this module:
module drawtext(string) {
        text(string);
}

Then the two included samples run.
ds
Reply | Threaded
Open this post in threaded view
|

Re: Dimension/Parameter labeling for part diagrams

ds
I look at this list wistfully once in awhile, but have been sidelined
for more than a year on another project. But today I see my website.

I had just gotten a question from someone else about the same thing and
made some changes.

Here is an updated version of my dimlines.scad file. It uses the text()
function with OpenSCAD now so the text is more attractive. Note that
there is an additional feature that enables the possibility to insert
text within dimension lines to perhaps document a variable name, should
the need arise.

I'll at some point stick up on cannymachines.com, but here it is in the
meantime.

Don

On 12/15/2015 06:49 PM, Neon22 wrote:

> canny machines zip file program can be converted to new text by editing
> dimlines.scad:
> - removing this line:
> use <TextGenerator.scad>
>
> - add this module:
> module drawtext(string) {
> text(string);
> }
>
> Then the two included samples run.
>
>
>
> --
> View this message in context: http://forum.openscad.org/Dimension-Parameter-labeling-for-part-diagrams-tp15172p15184.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> 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

dimlines.scad (37K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Dimension/Parameter labeling for part diagrams

Peter Ragosch
Am Tue, 15 Dec 2015 19:03:47 -0800
schrieb ds <[hidden email]>:

> Here is an updated version of my dimlines.scad file.

Many thanks for sharing, ds.

One little remark: Line 161 should be changed from
        color(GREY)
to
        color("GREY")
..
--
Mit freundlichen Grüßen
Kind Regards

Peter Ragosch


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