Info Polyline Area
Posted: Mon May 09, 2016 6:24 pm
Hi,
I have added an option to the information menu to print the area and circumference (length) of a polyline. Recently, Andrew added an 'area of polyline' property to QCAD Pro only, suggesting that he doesn't want this to be shown in the community edition. I don't have a problem with this, but I am posting this because users of the community edition can calculate the area of a polyline by using the two tools 'Info->Polygonal Area' and 'Info->Arc/Circle/Ellipse Area'. By noting down the polygonal area and adding or subtracting the sector area of arcs, the total area can be calculated. This tool does this automatically for the user. (It doesn't display the area in the property editor.)
When you start the tool, it prompts you to select a polyline. When selected it prints the area and circumference of the polyline. (The circumference is the 'length' shown in the property editor.) It continues to prompt you to select a polyline until you press the right mouse button, or press the 'escape' key.
This tool doesn't check that the polyline is closed, nor does it check if the polyline crosses itself. If the polyline is not closed, it will print an area which will be correct if the polyline only has straight line segments. If it has arcs, the area will only be correct if all the arc areas are to be subtracted from the total area. If you want to see the correct value, temporarily close the polyline, run this tool, and then open the polyline again. If the polyline crosses itself then all bets are off; the area is almost certainly wrong. In this case, try breaking the segments into smaller segments that do not cross. (This may not be possible, in which case case try creating more than one polyline.)
If you are using QCAD Pro, you will notice, when the polyline has arcs, that the area shown by this tool is slightly different than the area displayed in the property editor. This is because, I believe, Andrew is calculating the area of the arcs by replacing the arcs with many small straight line segments. This can cause the area to be either slightly larger (when subtracting arc areas), or slightly smaller (when adding arc areas). This tool calculates the sector area of the arcs, and then adds or subtracts them as required.
The attached zip file contains a directory called 'InfoPolylineArea'. Extract this, and place it in the 'scripts/Information' directory.
I hope this doesn't upset Andrew too much.
riverbuoy
I have added an option to the information menu to print the area and circumference (length) of a polyline. Recently, Andrew added an 'area of polyline' property to QCAD Pro only, suggesting that he doesn't want this to be shown in the community edition. I don't have a problem with this, but I am posting this because users of the community edition can calculate the area of a polyline by using the two tools 'Info->Polygonal Area' and 'Info->Arc/Circle/Ellipse Area'. By noting down the polygonal area and adding or subtracting the sector area of arcs, the total area can be calculated. This tool does this automatically for the user. (It doesn't display the area in the property editor.)
When you start the tool, it prompts you to select a polyline. When selected it prints the area and circumference of the polyline. (The circumference is the 'length' shown in the property editor.) It continues to prompt you to select a polyline until you press the right mouse button, or press the 'escape' key.
This tool doesn't check that the polyline is closed, nor does it check if the polyline crosses itself. If the polyline is not closed, it will print an area which will be correct if the polyline only has straight line segments. If it has arcs, the area will only be correct if all the arc areas are to be subtracted from the total area. If you want to see the correct value, temporarily close the polyline, run this tool, and then open the polyline again. If the polyline crosses itself then all bets are off; the area is almost certainly wrong. In this case, try breaking the segments into smaller segments that do not cross. (This may not be possible, in which case case try creating more than one polyline.)
If you are using QCAD Pro, you will notice, when the polyline has arcs, that the area shown by this tool is slightly different than the area displayed in the property editor. This is because, I believe, Andrew is calculating the area of the arcs by replacing the arcs with many small straight line segments. This can cause the area to be either slightly larger (when subtracting arc areas), or slightly smaller (when adding arc areas). This tool calculates the sector area of the arcs, and then adds or subtracts them as required.
The attached zip file contains a directory called 'InfoPolylineArea'. Extract this, and place it in the 'scripts/Information' directory.
I hope this doesn't upset Andrew too much.
riverbuoy