discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Dimension/Parameter labeling for part diagrams

HL
Hans L
Tue, Dec 15, 2015 12:05 PM

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:
http://us.misumi-ec.com/item/10300258330/img/drw_01.gif

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://www.ucl.ac.uk/earth-sciences/people/personalpages/bowles/images/Tech_Drawing.jpg

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

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: http://us.misumi-ec.com/item/10300258330/img/drw_01.gif 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://www.ucl.ac.uk/earth-sciences/people/personalpages/bowles/images/Tech_Drawing.jpg 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
TP
Torsten Paul
Tue, Dec 15, 2015 12:49 PM

Von: "Hans L" thehans@gmail.com

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.

Von: "Hans L" <thehans@gmail.com> > 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.
PF
Peter Falke
Tue, Dec 15, 2015 4:45 PM

There is also a OpenSCAD Measurement tool from wifibum
http://www.thingiverse.com/wifibum on Thingiverse:

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

2015-12-15 13:49 GMT+01:00 Torsten Paul Torsten.Paul@gmx.de:

Von: "Hans L" thehans@gmail.com

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 also a OpenSCAD Measurement tool from wifibum <http://www.thingiverse.com/wifibum> on Thingiverse: http://www.thingiverse.com/thing:280469 2015-12-15 13:49 GMT+01:00 Torsten Paul <Torsten.Paul@gmx.de>: > Von: "Hans L" <thehans@gmail.com> > > 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
R
runsun
Tue, Dec 15, 2015 5:59 PM

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

@ 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.
HL
Hans L
Tue, Dec 15, 2015 6:49 PM

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 runsun@gmail.com 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <runsun@gmail.com> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
N
Neon22
Wed, Dec 16, 2015 2:49 AM

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.

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.
D
ds
Wed, Dec 16, 2015 3:03 AM

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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
PR
Peter Ragosch
Wed, Dec 16, 2015 9:58 AM

Am Tue, 15 Dec 2015 19:03:47 -0800
schrieb ds ds@sidorof.com:

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

Am Tue, 15 Dec 2015 19:03:47 -0800 schrieb ds <ds@sidorof.com>: > 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