I'm new to QCAD Pro and my general CAD knowledge is limited...
I want to fill simple 2D drawings for a top and side view of a bowl with segments and slices, adding to the side view, unequal dividers using a script (or otherwise).
I have a drawing of a segmented bowl that has a 2D top view that appears as a circle that's divided into 8 segments and a side view that has 5 slices.
I would like to add dividers which are not equally spaced. e.g. with 8 segments only 3 additional unequal dividers are required to show the side view.
Perhaps there is already a way to map the top view to the side view e.g. to project lines which help identify intersection points to define where the divisions should be placed?
How can I divide a rectangle unevenly
Moderator: andrew
Forum rules
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post one question per topic.
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post one question per topic.
How can I divide a rectangle unevenly
Last edited by Simon_M on Wed Apr 03, 2019 3:12 pm, edited 6 times in total.
Re: How can I divide a rectangle unevenly
Hi Simon_M  welcome to the QCAD forum.
It would be much easier for us if we could see the drawing. If not confidential please attach the drawing to the post. Thanks.
It would be much easier for us if we could see the drawing. If not confidential please attach the drawing to the post. Thanks.
Work smart, not hard: QCad Pro
Re: How can I divide a rectangle unevenly
Hi Husky
A CAD drawing (picture) is certainly worth a thousand words (vectors).
Here is my first "real" drawing, produced with QCAD Pro after reading a good "chunk" of the (excellent) QCAD book  so don't be too critical!
The top view shows the segments of a wooden bowl  in this example I created it with 8 segments.
The front view shows the layers of the wooden bowl  in this example there are 5 equal slices and a base.
The problem, which I hope to automate (using a script), is to add "dividers" onto the side view, knowing the number of segments (8), slices (5) and any rotation between slices (1/2), using four points from the sides of the bowl that's being sliced/segmented.
Afterwards I can then manually add simple or complex shading (hatching) onto the (now) divided side view.
I initially added additional lines to break the side view into slices and added lines between the intersections.
I then added additional lines intersecting edges from the top onto the side and divided the bowl slices into four unequal divisions, before removing the "helper" lines.
I also added a smaller circle for the bottom into the top view, adding additional lines to divide up the fifth slice in the side view, as well.
Finally, I shaded alternate pieces to show the different types of wood (light and dark).
The idea, could be extended to the other three slices and it's normal for slices to not be aligned e.g. rotated by 1/2, 1/3, 1/4 of a segment etc.
In the drawing you will see that I used a vertical dividing line that's only accurate to a first approximation (not ideal).
To a second approximation, the divider is an angled line where the top/bottom of each segment are the same percentage from the centre line e.g. 29.4% and 50% in the the given example.
To be completely accurate, the divider is also a percentage from the centre line but following the outline e.g. it could also be a curved. So this is copying, mirroring and scaling in a vertical plane one of the sides to create the dividers e.g. something that CAD programs are good at doing.
The steps to show the front view, required quite a lot of effort to draw the top view, find the intersections and then add the unequal dividers, however mathematically, it's much easier to compute the dividers e.g. using the width and top/bottom area to be sliced e.g. by selecting the four corners to define the edges of the sliced area and (importantly) to be divided.
With N equal slices and 2W is the width:
A CAD drawing (picture) is certainly worth a thousand words (vectors).
Here is my first "real" drawing, produced with QCAD Pro after reading a good "chunk" of the (excellent) QCAD book  so don't be too critical!
The top view shows the segments of a wooden bowl  in this example I created it with 8 segments.
The front view shows the layers of the wooden bowl  in this example there are 5 equal slices and a base.
The problem, which I hope to automate (using a script), is to add "dividers" onto the side view, knowing the number of segments (8), slices (5) and any rotation between slices (1/2), using four points from the sides of the bowl that's being sliced/segmented.
Afterwards I can then manually add simple or complex shading (hatching) onto the (now) divided side view.
I initially added additional lines to break the side view into slices and added lines between the intersections.
I then added additional lines intersecting edges from the top onto the side and divided the bowl slices into four unequal divisions, before removing the "helper" lines.
I also added a smaller circle for the bottom into the top view, adding additional lines to divide up the fifth slice in the side view, as well.
Finally, I shaded alternate pieces to show the different types of wood (light and dark).
The idea, could be extended to the other three slices and it's normal for slices to not be aligned e.g. rotated by 1/2, 1/3, 1/4 of a segment etc.
In the drawing you will see that I used a vertical dividing line that's only accurate to a first approximation (not ideal).
To a second approximation, the divider is an angled line where the top/bottom of each segment are the same percentage from the centre line e.g. 29.4% and 50% in the the given example.
To be completely accurate, the divider is also a percentage from the centre line but following the outline e.g. it could also be a curved. So this is copying, mirroring and scaling in a vertical plane one of the sides to create the dividers e.g. something that CAD programs are good at doing.
The steps to show the front view, required quite a lot of effort to draw the top view, find the intersections and then add the unequal dividers, however mathematically, it's much easier to compute the dividers e.g. using the width and top/bottom area to be sliced e.g. by selecting the four corners to define the edges of the sliced area and (importantly) to be divided.
With N equal slices and 2W is the width:
 V = int(N/2)  1 internal dividers are visible from the LH edge, where D1, D2 and D3 can also be calculated:
 D1 = W  sin(radians(360/N)) * W = 0.29W e.g. 29% of W (1st)
 D2 = W  sin(radians(0)) * W = W e.g. 100% of W (2nd)
 D3 = W + sin(radians(360/N)) * W = 1.71W e.g. 171% of W (3rd)
 Attachments

 8 Segment Bowl.dxf
 (106.35 KiB) Downloaded 50 times
Re: How can I divide a rectangle unevenly
Hi thanks for the drawing.
coding is not my cup of tea but here my two cents
Note: It could be that it looks on your monitor different than it is in real life. QCAD has display restriction for performance reason
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
On the other hand  if you are very familiar with coding maybe that would be the easier task for you ....
coding is not my cup of tea but here my two cents
I'm pretty sure you can use a script to automate the process but on the other hand it's an easy task to design this simple drawing. In my eye a script makes only sense if your plan is to go into bulk production ...... or just for fun
Not aligned but rotated by X fraction/degree? I've the feeling here are two people working on the same project: An artist and a mathematician ...
Yep, it is visual 2/1000 mm off.
Note: It could be that it looks on your monitor different than it is in real life. QCAD has display restriction for performance reason
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
With knowing of the QCAD tools and a little bit of practice it takes approx. 12 min. If I don't have to do that 300 times a day I could life with that.
On the other hand  if you are very familiar with coding maybe that would be the easier task for you ....
Work smart, not hard: QCad Pro
Re: How can I divide a rectangle unevenly
Hi Husky
I used 5 slices because a bowl may have more but I didn't want to draw them all. Typically a bowl is turned on a lathe with each slice rotated to the next by one half of a slice e.g. in the example the 2nd and 4th slices typically overlap with the slices above/below. In this way the wooden pieces overlap like the outside of a brick wall and it can be quite strong. There is a science element (doing the maths) and an art part (balancing the design) too.
The sides of a bowl are almost always curved from top to bottom and this means that the direction of the dividers also changes. In the drawing I used a vertical divider but it exactly follows the same ratio as the outside e.g. if the diameter comes in 50% then the angle of the dividers changes because there is a mathematical relationship e.g. in the middle they are always vertical but towards the outside they vary as the diameter of the top/bottom of a slice varies. Finding the edges and shaping the sides requires drawing many linking lines between the top view and side views and then finding all the intersections e.g. 5 * 12 * 2 = 120. Some bowls have 720 pieces (1440 visible intersections) hence the reason why CAD is so useful.
To do this with a script would seem to follow the same basic "formula" with only the detail e.g. maths changing:
One thing I didn't mention is that bowls produced with slices have less waste and varying the colour of the wood allows patterns to be shown e.g. a simple staircase or a diamond. There are many variations e.g. varying the thickness of each slice, thin wood spacers (veneers) between the slices, using trapezoidal wedges etc. all things that a script can (eventually) be adapted to show.
I used 5 slices because a bowl may have more but I didn't want to draw them all. Typically a bowl is turned on a lathe with each slice rotated to the next by one half of a slice e.g. in the example the 2nd and 4th slices typically overlap with the slices above/below. In this way the wooden pieces overlap like the outside of a brick wall and it can be quite strong. There is a science element (doing the maths) and an art part (balancing the design) too.
The sides of a bowl are almost always curved from top to bottom and this means that the direction of the dividers also changes. In the drawing I used a vertical divider but it exactly follows the same ratio as the outside e.g. if the diameter comes in 50% then the angle of the dividers changes because there is a mathematical relationship e.g. in the middle they are always vertical but towards the outside they vary as the diameter of the top/bottom of a slice varies. Finding the edges and shaping the sides requires drawing many linking lines between the top view and side views and then finding all the intersections e.g. 5 * 12 * 2 = 120. Some bowls have 720 pieces (1440 visible intersections) hence the reason why CAD is so useful.
To do this with a script would seem to follow the same basic "formula" with only the detail e.g. maths changing:
 Adding the script to a menu
 Trigger the script
 Get additional info e.g. numbers of segments/slices and rotations required in a dialog
 Identify points on the drawing e.g. selecting LH and RH end of splines
 Do some maths...
 Update the drawing
One thing I didn't mention is that bowls produced with slices have less waste and varying the colour of the wood allows patterns to be shown e.g. a simple staircase or a diamond. There are many variations e.g. varying the thickness of each slice, thin wood spacers (veneers) between the slices, using trapezoidal wedges etc. all things that a script can (eventually) be adapted to show.
Last edited by Simon_M on Thu Apr 04, 2019 2:12 pm, edited 2 times in total.
Re: How can I divide a rectangle unevenly
All tools in QCAD are implemented as scripts at the top level. You can find them at:
https://github.com/qcad/qcad/tree/master/scripts
Scripts provided as examples are in:
https://github.com/qcad/qcad/tree/maste ... c/Examples
But, I'd recommend to search through all the tools for example code as required.
https://github.com/qcad/qcad/tree/master/scripts
Scripts provided as examples are in:
https://github.com/qcad/qcad/tree/maste ... c/Examples
But, I'd recommend to search through all the tools for example code as required.