discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Circular shape to a square shape.

PV
Paulo Vitor Oliveira
Sat, Apr 8, 2017 9:14 PM

Hi, I'm new to the software and I have a question. I have a file of a
circular piece, and I would like to make it a square piece Preserving the
details, but I do not know how to make the modification. The link of the
part is down.

twisted_vase.scad http://forum.openscad.org/file/n21129/twisted_vase.scad

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hi, I'm new to the software and I have a question. I have a file of a circular piece, and I would like to make it a square piece Preserving the details, but I do not know how to make the modification. The link of the part is down. twisted_vase.scad <http://forum.openscad.org/file/n21129/twisted_vase.scad> -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129.html Sent from the OpenSCAD mailing list archive at Nabble.com.
F
fred_dot_u
Sat, Apr 8, 2017 10:45 PM

I have noted in the code you provide that there is a line
faces = 8;

When that value is changed to 4, the individual "layers" of the shape become
square. Is this the answer you seek?

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21132.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I have noted in the code you provide that there is a line faces = 8; When that value is changed to 4, the individual "layers" of the shape become square. Is this the answer you seek? -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21132.html Sent from the OpenSCAD mailing list archive at Nabble.com.
PV
Paulo Vitor Oliveira
Sat, Apr 8, 2017 10:58 PM

Thanks for the response !
No... This is the image of the code
http://forum.openscad.org/file/n21133/Captura_de_Tela_2017-04-08_%C3%A0s_19.png

I want to know if it is possible to change the shape that is like a cup, to
something like a box, for exemple, including this special details. The
changes that you proposed, only make difference on the details.

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21133.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thanks for the response ! No... This is the image of the code <http://forum.openscad.org/file/n21133/Captura_de_Tela_2017-04-08_%C3%A0s_19.png> I want to know if it is possible to change the shape that is like a cup, to something like a box, for exemple, including this special details. The changes that you proposed, only make difference on the details. -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21133.html Sent from the OpenSCAD mailing list archive at Nabble.com.
F
fred_dot_u
Sat, Apr 8, 2017 11:20 PM

The "special details" part escapes me. The method used in the original
cup-type code is to rotate the basic shape (faces) which provides what I
think of as the details. If "faces = 4" is used, each layer is a square.

http://forum.openscad.org/file/n21134/cube4vase.png

If one desires a cube shaped receptacle, this code:

gives this shape:

http://forum.openscad.org/file/n21134/cubebox.png

Can you clarify what special details you seek?

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21134.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The "special details" part escapes me. The method used in the original cup-type code is to rotate the basic shape (faces) which provides what I think of as the details. If "faces = 4" is used, each layer is a square. <http://forum.openscad.org/file/n21134/cube4vase.png> If one desires a cube shaped receptacle, this code: gives this shape: <http://forum.openscad.org/file/n21134/cubebox.png> Can you clarify what special details you seek? -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21134.html Sent from the OpenSCAD mailing list archive at Nabble.com.
PV
Paulo Vitor Oliveira
Sat, Apr 8, 2017 11:28 PM

Thanks man ! I`m really a new one on openscad.

I understood that using faces = 4 then we have the image you upload, but it
is possible to have  that number of "special details", that number of faces,
but this details on the sides of a box ?

I`ll tried to explain better... On this code, we have some subdivisions and
some number os "special details"
http://forum.openscad.org/file/n21135/Captura_de_Tela_2017-04-08_%C3%A0s_20.png

But, besides become a "cup" at the and, besides creates this details on a
cylinder, now create on the sides of a box, its possible ?

Thanks !

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21135.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thanks man ! I`m really a new one on openscad. I understood that using faces = 4 then we have the image you upload, but it is possible to have that number of "special details", that number of faces, but this details on the sides of a box ? I`ll tried to explain better... On this code, we have some subdivisions and some number os "special details" <http://forum.openscad.org/file/n21135/Captura_de_Tela_2017-04-08_%C3%A0s_20.png> But, besides become a "cup" at the and, besides creates this details on a cylinder, now create on the sides of a box, its possible ? Thanks ! -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21135.html Sent from the OpenSCAD mailing list archive at Nabble.com.
F
fred_dot_u
Sun, Apr 9, 2017 12:14 AM

I see that you'd like to have facets on the sides of the box. The facets in
the faces=8 are really rotations of the basic shape. When that is done with
faces=4, you get the image I provided, but I think you feel that the
variations are too great and would like to have more subtle changes to the
faces.

I'm mostly new to OpenSCAD too and not much of a programmer-thinking kind of
person. Most of my creations are simple and involve a lot of "try this,
fail, try something else."

I believe that there is someone on the list who has strong programming
skills and can create complex code to create facets on the faces of the
cube. I believe that I would have very little understanding of the code,
however.

If, for example, you desired to have one "point of facet" in the side of the
cube, I could manually create polygons, but it would be "brute force"
generation, while a more skilled user would create algorithms to accomplish
the same thing, and with more flexibility.

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21137.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I see that you'd like to have facets on the sides of the box. The facets in the faces=8 are really rotations of the basic shape. When that is done with faces=4, you get the image I provided, but I think you feel that the variations are too great and would like to have more subtle changes to the faces. I'm mostly new to OpenSCAD too and not much of a programmer-thinking kind of person. Most of my creations are simple and involve a lot of "try this, fail, try something else." I believe that there is someone on the list who has strong programming skills and can create complex code to create facets on the faces of the cube. I believe that I would have very little understanding of the code, however. If, for example, you desired to have one "point of facet" in the side of the cube, I could manually create polygons, but it would be "brute force" generation, while a more skilled user would create algorithms to accomplish the same thing, and with more flexibility. -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21137.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MC
Mr C Camacho
Sun, Apr 9, 2017 8:48 AM

make a giant version with many tiny (it its scale) facets, difference
out a piece that is the size of one box wall, if you have made the giant
version big enough it should look almost flat at the smaller scale...

use this 4 times rotated 90 degrees each time to make the four sides

check the wiki / manual etc to see how boolean geometry is used
(difference and union I abuse a lot!)

hope this is enough to get you started / learning

Chris

On 09/04/17 01:14, fred_dot_u wrote:

I see that you'd like to have facets on the sides of the box. The facets in
the faces=8 are really rotations of the basic shape. When that is done with
faces=4, you get the image I provided, but I think you feel that the
variations are too great and would like to have more subtle changes to the
faces.

I'm mostly new to OpenSCAD too and not much of a programmer-thinking kind of
person. Most of my creations are simple and involve a lot of "try this,
fail, try something else."

I believe that there is someone on the list who has strong programming
skills and can create complex code to create facets on the faces of the
cube. I believe that I would have very little understanding of the code,
however.

If, for example, you desired to have one "point of facet" in the side of the
cube, I could manually create polygons, but it would be "brute force"
generation, while a more skilled user would create algorithms to accomplish
the same thing, and with more flexibility.

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21137.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

make a giant version with many tiny (it its scale) facets, difference out a piece that is the size of one box wall, if you have made the giant version big enough it should look almost flat at the smaller scale... use this 4 times rotated 90 degrees each time to make the four sides check the wiki / manual etc to see how boolean geometry is used (difference and union I abuse a lot!) hope this is enough to get you started / learning Chris On 09/04/17 01:14, fred_dot_u wrote: > I see that you'd like to have facets on the sides of the box. The facets in > the faces=8 are really rotations of the basic shape. When that is done with > faces=4, you get the image I provided, but I think you feel that the > variations are too great and would like to have more subtle changes to the > faces. > > I'm mostly new to OpenSCAD too and not much of a programmer-thinking kind of > person. Most of my creations are simple and involve a lot of "try this, > fail, try something else." > > I believe that there is someone on the list who has strong programming > skills and can create complex code to create facets on the faces of the > cube. I believe that I would have very little understanding of the code, > however. > > If, for example, you desired to have one "point of facet" in the side of the > cube, I could manually create polygons, but it would be "brute force" > generation, while a more skilled user would create algorithms to accomplish > the same thing, and with more flexibility. > > > > -- > View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21137.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
R
Ronaldo
Sun, Apr 9, 2017 8:10 PM

Paulo,

I don't think you may reproduce that same texture pattern in the planar
surface of a block. To enlarge the circular form to make it seem locally
plane will make the texture too shallow to give the same visual effect.

The simplest way I can imagine to create planar textures is to use a texture
map with the OpenSCAD primitive  surface()
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface
. The very crude example of its application in mapping texture follows as a
base point to your experiments. The commented lines at the beginning of the
code should be saved as a text file named texture.txt. It is a shame we
can't use a matrix defined in the code as input to surface().

/*

texture.txt

2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
2 2 3 2 3 2 3 2 3 2 3 2 2
2 3 2 3 2 3 2 3 2 3 2 3 2
*/

width = 13; // # columns in texture.txt
height = 14;// # lines in texture.txt
thick = 3;  // max value in texture.txt

module wall()
intersection(){
rotate(-135) translate([0,0,-height/2-1])
cube([width/sqrt(2),width/sqrt(2),height+2]);
translate([-0.01,-(width-4-thick)/2,0])
rotate([90,0,0])
surface(file="texture.txt",center=true);
}

wall();
rotate(90) wall();
rotate(180) wall();
rotate(270) wall();

http://forum.openscad.org/file/n21145/textured.png

--
View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21145.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Paulo, I don't think you may reproduce that same texture pattern in the planar surface of a block. To enlarge the circular form to make it seem locally plane will make the texture too shallow to give the same visual effect. The simplest way I can imagine to create planar textures is to use a texture map with the OpenSCAD primitive surface() <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Surface> . The very crude example of its application in mapping texture follows as a base point to your experiments. The commented lines at the beginning of the code should be saved as a text file named texture.txt. It is a shame we can't use a matrix defined in the code as input to surface(). > /* > # texture.txt > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > 2 2 3 2 3 2 3 2 3 2 3 2 2 > 2 3 2 3 2 3 2 3 2 3 2 3 2 > */ > > width = 13; // # columns in texture.txt > height = 14;// # lines in texture.txt > thick = 3; // max value in texture.txt > > module wall() > intersection(){ > rotate(-135) translate([0,0,-height/2-1]) > cube([width/sqrt(2),width/sqrt(2),height+2]); > translate([-0.01,-(width-4-thick)/2,0]) > rotate([90,0,0]) > surface(file="texture.txt",center=true); > } > > wall(); > rotate(90) wall(); > rotate(180) wall(); > rotate(270) wall(); <http://forum.openscad.org/file/n21145/textured.png> -- View this message in context: http://forum.openscad.org/Circular-shape-to-a-square-shape-tp21129p21145.html Sent from the OpenSCAD mailing list archive at Nabble.com.
MK
Marius Kintel
Wed, Apr 12, 2017 4:08 AM

There is also this:

https://github.com/openscad/list-comprehension-demos#forma-candle-holderscad

..a different way of achieving smth. similar, and uses a bunch of library code, but perhaps helpful?

-Marius

There is also this: https://github.com/openscad/list-comprehension-demos#forma-candle-holderscad ..a different way of achieving smth. similar, and uses a bunch of library code, but perhaps helpful? -Marius