Info->Arc/Circle/Ellipse Area

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, Husky, J-J

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Tue Dec 16, 2014 6:57 pm

Hi

I have added a command to calculate and insert the area of arcs, circles, ellipses and elliptical arcs to a drawing.
This was prompted by Husky pointing out that the 'polygonal area' command can only use straight line segments, so there was no equivalent for arcs, circles etc.

Menu: Info -> Arc/Circle/Ellipse Area
Commands: acearea, ic
Shortcut: IC

This command calculates the area of arcs, circles, ellipses and elliptical arcs, and optionally adds the information to the current layer of a drawing. If you select any other type of entity, a warning is shown in the command line.

For arcs, there are two options for calculating areas, namely Segment or Sector. The area of a segment (or slice) is the area bound by the arc and and two lines drawn from the arc's startpoint and endpoint to the arc's centre. The area of a sector is the area bound by the arc and a chord drawn from the arc's startpoint to the endpoint.
ArcCircle01.png
ArcCircle01.png (4.47 KiB) Viewed 22806 times
I have attached the file containing the subdirectory 'InfoArcCircleArea'. Extract this into the '/scripts/Information' directory.
To get a full description of the options see the file 'InfoArcCircleArea.html' which is in the 'doc' subdirectory.

riverbuoy

(Edit: I have updated the zip file with the fixed files)
Attachments
InfoArcCircleArea.zip
(58.11 KiB) Downloaded 712 times
Last edited by riverbuoy on Fri Dec 19, 2014 1:01 am, edited 1 time in total.

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Thu Dec 18, 2014 9:59 am

Hello riverbuoy,

Very nice - thank you so much! That makes my CAD / calculation life again easier. :D

Question:
The "Mode Buttons" are not displayed though the svg's are in the subdirectory. I use QCAD on a Win system - did I something wrong?
Worldhusky-2014.12.17-01.png
Worldhusky-2014.12.17-01.png (9.98 KiB) Viewed 22820 times
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Thu Dec 18, 2014 6:23 pm

Hi Husky
Husky wrote:The "Mode Buttons" are not displayed though the svg's are in the subdirectory. I use QCAD on a Win system - did I something wrong?
No. The icon for the command is displayed, so I think the problem is that I didn't include two inverse svg's for the mode buttons. I don't have windows to check this, but I have attached two inverse svg's. Copy them into the same subdirectory as the others.
Let mw know if this solves the problem.

Thanks

riverbuoy
Attachments
InfoSector-inverse.svg
(2.24 KiB) Downloaded 729 times
InfoSlice-inverse.svg
(1.94 KiB) Downloaded 704 times

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Thu Dec 18, 2014 8:45 pm

Hello riverbuoy,
riverbuoy wrote:... Copy them into the same subdirectory as the others.
Let mw know if this solves the problem.
Nope - sorry that I have to say this - but it's still not working. :(

Just to be sure ... :wink:
Worldhusky-2014.12.18-01.png
Worldhusky-2014.12.18-01.png (85.98 KiB) Viewed 22802 times
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Thu Dec 18, 2014 9:42 pm

Hi Husky

I think I inverted the icons incorrectly. I have now, hopefully, inverted them correctly. So overwrite the existing with the attached ones.

Again, if you could let me know.

Thanks

riverbuoy
Attachments
InfoSector-inverse.svg
(2.24 KiB) Downloaded 733 times
InfoSlice-inverse.svg
(1.94 KiB) Downloaded 763 times

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Thu Dec 18, 2014 10:20 pm

Hi riverbuoy,
riverbuoy wrote:Again, if you could let me know.
sorry - nope - still the same. They work but I can't see the Symbols ...

Now I start to feel guilty ..... :oops:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Thu Dec 18, 2014 11:12 pm

Hi Husky
Husky wrote:Now I start to feel guilty ..... :oops:
No, it's my fault, sorry.
I discovered that the icons were pointing to the absolute path on my computer, which is obviously different from yours. I have now replaced them with relative paths so they should now work. The affected file is 'InfoArcCircleArea.ui'. I have attached the file. Replace the existing file with this one.

I am fairly confident this will now work, but please let me know.

Thanks

riverbuoy
Attachments
InfoArcCircleArea.ui
(2.99 KiB) Downloaded 690 times
Last edited by riverbuoy on Fri Dec 19, 2014 1:08 am, edited 1 time in total.

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Thu Dec 18, 2014 11:52 pm

Yeehaw!!! It works! Thank you very much!

I will test this new tool a bit further and come back to you soon. 8)
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Fri Dec 19, 2014 1:05 am

Hi Husky

Thanks for the reply. Glad to hear it works.

Note for others: I have updated the zip file in my first post, so you don't need to download the individual files.

Thanks

riverbuoy

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Sat Dec 20, 2014 9:45 pm

Hi

I've made a small change to this command. The 'Entity', 'Chord' and 'Length' buttons are now grayed out when the 'Add measurement to drawing' button is unchecked. Checking this button enables them.
This involves changes to 2 files, which I have attached. Copy these into the InfoArcCircleArea directory.
I think this is an improvement. But, let me know what you think.

Thanks.

riverbuoy
Attachments
InfoArcCircleArea.js
(14.65 KiB) Downloaded 694 times
InfoArcCircleArea.ui
(3.28 KiB) Downloaded 710 times

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Sun Dec 21, 2014 1:34 am

Hello riverbuoy,
riverbuoy wrote:Hi

I've made a small change to this command. The 'Entity', 'Chord' and 'Length' buttons are now grayed out when the 'Add measurement to drawing' button is unchecked. Checking this button enables them.
This involves changes to 2 files, which I have attached. Copy these into the InfoArcCircleArea directory.
I think this is an improvement. But, let me know what you think.

Thanks.

riverbuoy
Yes - that is an improvement and I really appreciate how much effort you invest to get it nicely working!

My testing results (till now) are: 8)

1.
The tool will forget the last settings - what means it will always start with a checked "Ad measurement to the drawings" but the options are contrary grayed out and UNREACHABLE. :shock:
I need first to turn it off/on before I can use the options for "Entity / Cord / Length" properly.

2.
It will also forget the Text Hight which means: If I change the default 5 into 1 / use it / close the tool and restart the tool I have to change the Text Hight to 1 again. Thats a kind of inconvenient ...

3.
Language: I tested your tool also on a German QCAD Interface. The language in the toolbar is mixed and the text in the drawing is always in English. It would be nice if your tool could also adopt the Language settings in QCAD ...
Worldhusky-2014.12.20-01.png
Screenshot German Interface
Worldhusky-2014.12.20-01.png (16.97 KiB) Viewed 22750 times
4.
What means: Add "entity"? Ticked / unticked I can't see any difference .... :oops:

Please, don't forget ...................... a weekend is not designed to work!!!! Seriously - take your time! :wink:

Thank you!
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Mon Dec 22, 2014 3:34 am

Hi
Husky wrote:1.
The tool will forget the last settings - what means it will always start with a checked "Ad measurement to the drawings" but the options are contrary grayed out and UNREACHABLE. :shock:
I need first to turn it off/on before I can use the options for "Entity / Cord / Length" properly.

2.
It will also forget the Text Hight which means: If I change the default 5 into 1 / use it / close the tool and restart the tool I have to change the Text Hight to 1 again. Thats a kind of inconvenient ...
On my machine the 'Add measurement to drawing' button always starts unchecked, and the text height is always '1'. I assumed (obviuosly wrongly) that it would be the same for everyone, so I didn't check the status of the 'Add measurement to drawing' button. However, because your settings are different, they must be stored somewhere. So I checked the config file where QCAD stores settings, and found the two settings, 'AddToDrawing' and 'TextHeight'. I changed 'AddToDrawing' to true, and 'TextHeight' to '5', and restarted QCAD. Now the 'Add measurement to drawing' button was checked, and text height shown as '5'.
Obviously the info commands read the settings from the config file when they start, but they do not store the settings when they finish. I have added two lines to store these settings when the command finishes. The file I changed is 'Information.js'. This is used by all the info commands, so they will all now store the settings when they finish.
I also check the setting of the 'Add measurement to drawing' button, so the Entity/Chord/Length buttons are set correctly. This is in the file 'InfoArcCircleArea.js', which is also included in the attached file.
Husky wrote:3.
Language: I tested your tool also on a German QCAD Interface. The language in the toolbar is mixed and the text in the drawing is always in English. It would be nice if your tool could also adopt the Language settings in QCAD ...
Language is not my strong point. Unfortunately I don't know any foreign languages. However, the way translations work is that there is a subdirectory called 'ts' for every command. This directory contains files with an extension '.ts', which contain the strings which are displayed on screen for that command. Using the program 'Qt Linguist' you load the 'ts' file and convert the strings manually, and then save a release file with a '.qm' extension. There is one 'ts' file for each language.
Creating the 'ts' files is straightforward, and the attached file has a 'ts' directory containing the 'ts' files. I also attempted translating the strings into german using Google Translate, and generated a '.qm' file. However, because I have no knowledge of german, I don't know if the translations given by Google Translate are correct, or crazy talk. Perhaps you can check this. What is really needed is for translators who are bi- or multi-lingual, with one of the laguages being English.
Husky wrote:4.
What means: Add "entity"? Ticked / unticked I can't see any difference .... :oops:
The command makes an exact copy of the selected entity. If the Entity button is checked, then that copy is added to the drawing. The idea is that if you keep all the measurements on a seperate layer, and switch off all other layers, you will want a visual representation of what an area refers to, so you would add the copy of the entity to the drawing. If, however, you want all areas in the same layer as the entity, then you would switch off Entity, so you don't have two copies of each entity in the drawing.
You can see this by changing to a layer which uses a different colour, and switching on the Entity button.
By keeping the areas on a seperate layer, you can switch if off before printing, if you don't want the areas in the final drawing. Alternatively, you might want to print just the areas as a seperate drawing.

The attached file contains the following files:-
Information.js which should be copied to the '/scripts/Information' directory.
InfoArcCircleArea.js which should be copied to the '/scripts/Information/InfoArcCircleArea' directory.
A directory named 'ts'. This should replace the currently empty 'ts' directory in the '/scripts/Information/InfoArcCircleArea' directory.

I hope that this explains everything, and that the command now works correctly.

riverbuoy
Attachments
InfoArcCircleArea-Fixes.zip
(17.72 KiB) Downloaded 678 times

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Mon Dec 22, 2014 10:40 am

Hallo,
riverbuoy wrote:I hope that this explains everything, and that the command now works correctly.
Yes - that explains everything - thank you!

Before I turn off my computer - it's here 1:40am - I like to give you a short answer.

- Now the tool seems to remember proper the last used settings - very nice!
- I never worked with QT before but I will install a version to work on the German translation.
- I notice that the Options for "Add:" are not doing what I ticked - maybe I did something wrong ...
Worldhusky-2014.12.22-03.png
Worldhusky-2014.12.22-03.png (10.1 KiB) Viewed 22715 times
Worldhusky-2014.12.22-04.png
Worldhusky-2014.12.22-04.png (9.2 KiB) Viewed 22715 times
For now - thanks for your hard work! I'm back to you soon ... :wink:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Info->Arc/Circle/Ellipse Area

Post by riverbuoy » Mon Dec 22, 2014 11:28 pm

Hi
Husky wrote:I notice that the Options for "Add:" are not doing what I ticked - maybe I did something wrong ...
In sector mode, the Chord button determines whether a chord entity is added to the drawing. In segment mode it determines whether the two segment lines are added to the drawing.
The length button determines whether extra info is added to the drawing. The reason it prints both the arc length and chord length is, when used with polygon area, you need both these values to calculate the circumference. You subtract the chord length and add the arc length to get the circumference.

riverbuoy

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

Re: Info->Arc/Circle/Ellipse Area

Post by Husky » Tue Dec 23, 2014 11:51 pm

Hello riverbuoy,
riverbuoy wrote:Hi
Husky wrote:I notice that the Options for "Add:" are not doing what I ticked - maybe I did something wrong ...
In sector mode, the Chord button determines whether a chord entity is added to the drawing. In segment mode it determines whether the two segment lines are added to the drawing.
The length button determines whether extra info is added to the drawing. The reason it prints both the arc length and chord length is, when used with polygon area, you need both these values to calculate the circumference. You subtract the chord length and add the arc length to get the circumference.

riverbuoy
Understood - thanks again for explanation.

Here is my (first?) suggestion for the German Translation:
Trans-German-Files.zip
(1.92 KiB) Downloaded 674 times
What do you think? :shock: :wink:
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”