Recognize closed contour, calculate area

Do you have a question you want to ask an existing QCAD user about QCAD and what you can do with it? Do you want to know if a particular feature exists? This is the place to ask.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
ElCattivo
Newbie Member
Posts: 4
Joined: Sun Aug 18, 2013 8:57 am

Recognize closed contour, calculate area

Post by ElCattivo » Sun Aug 18, 2013 11:31 am

Hi there,

I'm looking for a program to solve my task as easy as possible and wonder if QCad is the way to go.

What do I want? We are currently doing a ton of GPS measurements where we store different types of areas (lawn, paths, parking place,...) on different layers. This areas are closed contours consisting of polylines, lines and arches. On one layer, e.g. lawn, may be any number of contours. We need the area of each contour on each layer and the summer over the areas on one layer.

I downloaded the trial and this is more or less possible by hand: Turn one layer on and use "Info -> Polygon Area". The problem is, that it is time consuming to compute the area this way. And since this command does not recognizes arches it is not exact.

Thats a rough outline of my problem and perhaps you could outline how you would tackle this problem. As I said we have many such files. I attached an example (with german names, sorry for that...).

What would be nice as first step: If the programm would automatically recognize closed contours and calculate the area. Next step: To script this.

Is this possible? How difficult is it? What are your ideas?

Thanks for your time,
Johannes
Attachments
101.dxf
example
(53.72 KiB) Downloaded 1027 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Recognize closed contour, calculate area

Post by andrew » Mon Aug 19, 2013 12:51 pm

Hello Johannes,
ElCattivo wrote:This areas are closed contours consisting of polylines, lines and arches. On one layer, e.g. lawn, may be any number of contours. We need the area of each contour on each layer and the summer over the areas on one layer.
This is certainly possible and not very difficult as long as all areas are defined as closed contours (i.e. the boundary of an area consists of entities that connect to (not intersect) each other.
ElCattivo wrote:What would be nice as first step: If the programm would automatically recognize closed contours and calculate the area.
This is essentially a combination of an algorithm to find closed contours which we already have (used as part of other tools) and the polygon area calculation. The algorithm would likely have to interpolate arcs as polylines with small segments (configurable) for the purpose of area calculation since a calculation with real arcs would be non-trivial.

I've added a feature request for such a tool at:
http://www.qcad.org/bugtracker/index.ph ... &project=1
ElCattivo wrote:Next step: To script this.
Depending on the exact nature and quality of the files, I can imagine a fully automated script that either adds the measured values as text to each area or outputs the results in another, convenient way (text, database, XML, etc). This could be a menu entry in QCAD, a command line tool or both.

ElCattivo
Newbie Member
Posts: 4
Joined: Sun Aug 18, 2013 8:57 am

Re: Recognize closed contour, calculate area

Post by ElCattivo » Mon Aug 19, 2013 5:42 pm

Hi there,

this sounds really good.

I found the command "select contour" wich does not seem to work for me. Even though two lines (on the same layer) share the same coordinates for one point only one line gets selected. I attached a file in my first post where I experience this problem. For example turn of all layer but the one called "WEGEFLAECHEN". There is one closed contour that does not get selected. This does not work for any of my contours. Is there something wrong with me or my file!?

If I understand you correctly the calculation of the area of a contour consisting of at least one arc is not possible at the moment (or at least not in a convenient way)? This is the feature request you linked!? Can you estimate when this feature will be implemented?

Thank you for your time,
Johannes

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Recognize closed contour, calculate area

Post by Husky » Mon Aug 19, 2013 6:11 pm

Hello ElCattivo,
ElCattivo wrote:I attached a file in my first post where I experience this problem. For example turn of all layer but the one called "WEGEFLAECHEN". There is one closed contour that does not get selected. This does not work for any of my contours. Is there something wrong with me or my file!?
I have no problems to select the "WEGEFLAECHEN" contour! Maybe you have accidentally locked the Layer - please check the status of the Padlock symbol (black = locked / grey = unlocked).
Husky-2013.08.19-01.png
Husky-2013.08.19-01.png (21.27 KiB) Viewed 24277 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Recognize closed contour, calculate area

Post by andrew » Mon Aug 19, 2013 7:00 pm

ElCattivo wrote:I found the command "select contour" wich does not seem to work for me. Even though two lines (on the same layer) share the same coordinates for one point only one line gets selected. I attached a file in my first post where I experience this problem. For example turn of all layer but the one called "WEGEFLAECHEN". There is one closed contour that does not get selected. This does not work for any of my contours. Is there something wrong with me or my file!?
I've noticed that the file you have attached contains Z coordinates (3D). While QCAD does import such files, there are several tools that might not work as expected since the coordinates are 3D, but the tools operate on the X/Y plane. This could be easily fixed by flattening the whole drawing, unless you do indeed need the Z coordinates.
ElCattivo wrote:If I understand you correctly the calculation of the area of a contour consisting of at least one arc is not possible at the moment (or at least not in a convenient way)?
That's correct. In a future tool, arcs would be treated as polylines with small segments to provide a solution.
ElCattivo wrote:This is the feature request you linked!?
The feature request is for an alternative area measuring tool that computes the area of a closed contour formed by existing entities rather than a polygon entered point by point.
ElCattivo wrote:Can you estimate when this feature will be implemented?
Unfortunately, there are a lot of feature requests and bug reports. I prioritize based on different factors (effort to implement, estimated percentage of users who might profit from a feature, etc.).

It is also possible to sponsor new features to prioritize them. Please contact me if you are interested in this. If prioritized, this could be implemented in 2-3 days.

ElCattivo
Newbie Member
Posts: 4
Joined: Sun Aug 18, 2013 8:57 am

Re: Recognize closed contour, calculate area

Post by ElCattivo » Mon Aug 19, 2013 7:05 pm

Husky wrote:Hello ElCattivo,
ElCattivo wrote:I attached a file in my first post where I experience this problem. For example turn of all layer but the one called "WEGEFLAECHEN". There is one closed contour that does not get selected. This does not work for any of my contours. Is there something wrong with me or my file!?
I have no problems to select the "WEGEFLAECHEN" contour! Maybe you have accidentally locked the Layer - please check the status of the Padlock symbol (black = locked / grey = unlocked).
Hi!

No, it was not locked (see screenshot). One line gets selected, the rest not...
Attachments
screen.png
Screenshot
screen.png (175.35 KiB) Viewed 24272 times

User avatar
Clive
Moderator
Posts: 1329
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Re: Recognize closed contour, calculate area

Post by Clive » Mon Aug 19, 2013 8:52 pm

Hello and welcome to the forum.
Once selected, try the following tools:
Modify -Explode (to explode any block refs).
Modify - Detect duplicates.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Recognize closed contour, calculate area

Post by Husky » Mon Aug 19, 2013 8:54 pm

@ElCattivo
Yep - you are right! There are some issues with the contour selection.
Right now I'm only able to explain it with Andrew's note:
andrew wrote:I've noticed that the file you have attached contains Z coordinates (3D). While QCAD does import such files, there are several tools that might not work as expected since the coordinates are 3D, but the tools operate on the X/Y plane. This could be easily fixed by flattening the whole drawing, unless you do indeed need the Z coordinates.

ElCattivo
Newbie Member
Posts: 4
Joined: Sun Aug 18, 2013 8:57 am

Re: Recognize closed contour, calculate area

Post by ElCattivo » Tue Aug 20, 2013 7:08 pm

Thank you all four your input.
andrew wrote:This could be easily fixed by flattening the whole drawing, unless you do indeed need the Z coordinates.
How do I do that? I will have to discuss wether we can neglect the z-Coordinate.

User avatar
Clive
Moderator
Posts: 1329
Joined: Thu Aug 25, 2011 9:28 pm
Location: UK

Re: Recognize closed contour, calculate area

Post by Clive » Tue Aug 20, 2013 7:34 pm

ElCattivo wrote:How do I do that? I will have to discuss wether we can neglect the z-Coordinate.
Yes, presuming the files are being sent to you by someone else, it's probably worth asking them if they can prepare the files as 2D only and as you say neglect the Z coord. This I would think will make things easier to use the files in QCAD!

Post Reply

Return to “Pre-sales Questions”