New site for "omdl" (A Mechanical Design Library)

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

New site for "omdl" (A Mechanical Design Library)

royasutton
...a collection of documented design primitives inspired by MCAD.

It is now hosted on GitHub Pages Here.

Be sure to browse the primitive functions, modules, and shapes in the library reference. Also, check out the Modules tab. The base primitives are validated when the documentation is built. The latest addition to the library is an additive edge generator for constructing moldings. Its still in it infancy, but taking shape...

Thanks for looking!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

royasutton
Added some tools for working with polygons...

script:

include <tools_polytope.scad>;
include <math_utility.scad>;

pc = reverse([[0,0], [10,0], [10,3], [3,3], [3,10], [0,10]]);
sc = [[1,1], [2,1], [2,2], [1,2]];
np = len(pc);
ns = len(sc);

cc =  [
        for(i=pc) i,
        for (j=[2,4,6]) for(i=translate_vp(sc,[0,j])) i,
        for (j=[2,4,6]) for(i=translate_vp(sc,[j,0])) i
      ];

cp =  [
        consts(np),
        for (y=[0:5]) consts(ns)+consts(ns,np+ns*y)
      ];

c = rotate_vp(scale_vp(cc, 100), 30);
p = cp;

tp = [-50,200];

echo( faceverticies_hist=hist(polytope_faceverticies(p)) );
echo( edgelengths_hist=hist(sround(polytope_edgelengths(c, polytope_faces2edges(p)))) );
echo( edgeangles_hist=hist(sround(polytope_edgeangles(c, p))) );
echo( arefacesregular=polytope_arefacesregular(c, p) );
echo( arefacesregular=polytope_arefacesregular(c, [p[1]]) );
echo( bbox_polygon=polygon2d_bbox_pp(c, p) );
echo( perimeter=polygon2d_perimeter(c, p) );
echo( area=polygon2d_area(c, p) );
echo( area=polygon2d_area(c, [p[0]]) );
echo( centroid=polygon2d_centroid(c, p) );
echo( centroid=polygon2d_centroid(c, [p[0]]) );
echo( is_cw=polygon2d_is_cw(c, p) );
echo( is_cw=polygon2d_is_cw(c, [p[1]]) );
echo( is_convex=polygon2d_is_convex(c, p) );
echo( is_convex=polygon2d_is_convex(c, [p[1]]) );
echo( is_pip=polygon2d_is_pip_wn(c, [p[0]], tp) );

color("snow") polygon_bbox(c, p);
polygon(c, p);
translate(polygon2d_centroid(c, [p[0]])) color("brown") circle(r=10);
translate(tp) color("red") circle(r=10);
polygon_number(c, p, tr=30);

image output:

output

console output:

Compiling design (CSG Tree generation)...
ECHO: faceverticies_hist = [[6, 1], [4, 6]]
ECHO: edgelengths_hist = [[300, 2], [700, 2], [1000, 2], [100, 24]]
ECHO: edgeangles_hist = [[-90, 5], [90, 25]]
ECHO: arefacesregular = false
ECHO: arefacesregular = true
ECHO: bbox_polygon = [[[-500, 0], [-500, 1016.03], [866.025, 0], [866.025, 1016.03]], [[0, 1, 3, 2]]]
ECHO: perimeter = 6400
ECHO: area = 450000
ECHO: area = 510000
ECHO: centroid = [130.549, 487.216]
ECHO: centroid = [130.262, 486.144]
ECHO: is_cw = true
ECHO: is_cw = false
ECHO: is_convex = false
ECHO: is_convex = true
ECHO: is_pip = true
Compiling design (CSG Products generation)...
Geometries in cache: 33
Geometry cache size in bytes: 52144
CGAL Polyhedrons in cache: 0
CGAL cache size in bytes: 0
Compiling design (CSG Products normalization)...
Normalized CSG tree has 71 elements
Compile and preview finished.
Total rendering time: 0 hours, 0 minutes, 0 seconds

(currently in devel branch)...
RAS
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

royasutton
In reply to this post by royasutton
Over the past several weeks significant effort has gone into reorganizing the library.

Please have a quick look at the latest version of omdl on Git Hub (currently v0.6).

The full API can be browsed at the site.

Thanks!
Roy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

kwankung
This post has NOT been accepted by the mailing list yet.
In reply to this post by royasutton
Appreciate the great effort developing omdl.

However, the following line failed to compile under Windows OpenSCAD + omdl v0.6.1 .

cc =  [
        for(i=pc) i,
        for (j=[2,4,6]) for(i=translate_vp(sc,[0,j])) i,
        for (j=[2,4,6]) for(i=translate_vp(sc,[j,0])) i
      ];

i can compile only after cutting the last 2 for-loop lines and dropped the 6 squares.

cc =  [
        for(i=pc) i
      ];

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

kwankung
This post has NOT been accepted by the mailing list yet.
This post was updated on .
finally fixed compilation errors for latest v0.6.1, reporting to owner

1. diff between compilers in various platforms
2. much change after v0.5


math_utility.scad (fixed for Windows platform)
    lstr
    ([
      for (i=[0:len(hv)-1])
        lstr_html
        (
          [s1, first(hv[i]), s2, second(hv[i]), s3,  ((i<(len(hv)-1)) || fm) ? fs : empty_str],
          b=fb, p=fp, a=fa, f=ff, d=d
        )
    ]);



original
    lstr
    ([
      for (i=[0:len(hv)-1])
        lstr_html
        (
          [s1, first(hv[i]), s2, second(hv[i]), s3, if ((i<(len(hv)-1)) || fm) fs],
          b=fb, p=fp, a=fa, f=ff, d=d
        ),
    ]);



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

royasutton
In reply to this post by kwankung
There were many name changes between the time of the above example and v0.6.1. I try to be responsible in the commit descriptions to warn of such changes. The commit logs can be reviewed at the development repository (here).

For v0.6.1 the following should get you going.

cc =  [
        for(i=pc) i,
        for (j=[2,4,6]) for(i=translate_lp(sc,[0,j])) i,
        for (j=[2,4,6]) for(i=translate_lp(sc,[j,0])) i
      ];

More Info: A distinction was made between vectors and lists. This change effects several functions and parameter names. A set of assumptions and conventions have been added to v0.6.1. They can be found in the "Related Pages" tab of the documentation under "Data types."

Roy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

royasutton
In reply to this post by kwankung
This is an important fundamental issue that you point out. The library needs to get clear about base OpenSCAD requirements/expectations.

As identified, it currently makes use of a list comprehension feature that has been added to OpenSCAD. I am guessing this issue exists in other parts of the omdl library as well.

Just out of curiosity as I work on an approach to address this issue, what version(s) of OpenSCAD are you using? Have you considered upgrading to a more recent release?

Roy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

kwankung
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Thank you Roy for replying.
However,

cc =  [
        for(i=pc) i,
        for (j=[2,4,6]) for(i=translate_lp(sc,[0,j])) i,
        for (j=[2,4,6]) for(i=translate_lp(sc,[j,0])) i
      ];

failed to compile (Windows OpenSCAD latest version 2015.03-2 ).

The following is compile OK, but the vector list of cc cannot match the rest of the functions/modules.

cc =  [
        [for(i=pc) i],
        [for (j=[2,4,6]) for(i=translate_lp(sc,[0,j])) i],
        [for (j=[2,4,6]) for(i=translate_lp(sc,[j,0])) i]
      ];

It is why 2 for-loop lines were dropped as mentioned previously.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New site for "omdl" (A Mechanical Design Library)

royasutton
kwankung wrote
failed to compile (Windows OpenSCAD latest version 2015.03-2 ).
If possible, please obtain a recent OpenSCAD development snapshot.

Once installed, obtain the referenced demo script from Thingiverse (see demo01.scad).

Please note, omdl v0.6.1 must be installed to your system. You can obtain a copy on Thingiverse or from the source repository. There are instructions on installing at the GitHub pages.

Hope this helps,
Roy
Loading...