[OpenSCAD] What's the best way to accomplish splitting these elements?

guaranteed_interwoven kerryhall at gmail.com
Mon Jul 8 05:30:39 EDT 2019


I think I'm closer with:

$fn = 20;
delta = 0.5;

module gen_node(coords, d, h)
{
  translate(coords)
  cylinder(d1=d, d2=0, h=h);
}     

data = [
  [[4, 5, 0], 10, 10],
  [[0, 0, 0], 10, 20],
  [[-5, 3, 0], 15, 10],
  [[-2, 6, 0], 15, 7],
  [[2, 16, 0], 20, 20],
];

module embedded(target)
{
   
  translate(data[target][0])
  scale([(data[target][1] - delta)/data[target][1], (data[target][1] -
delta)/data[target][1], 1])
  translate(-data[target][0])
   
  intersection() 
  {
    gen_node(data[target][0], data[target][1], data[target][2]);
    linear_extrude(height=1000)
    projection()
    {
      difference() 
      {
        gen_node(data[target][0], data[target][1], data[target][2]);
        for(i=[0:len(data)])
        {
          if(i != target)
          {
            gen_node(data[i][0], data[i][1], data[i][2]);
          }
        }
      }
    }
  }
}

for(i = [0:len(data) - 1])
{
  embedded(i);
}
</file/t2594/example_06.png> 

This is at least consistent per edge, but not consistent per node or
globally.



--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list