Bearing and Azimuth

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
User avatar
gmpowell71
Newbie Member
Posts: 5
Joined: Fri Jan 28, 2022 11:05 pm
Location: Somewhere out there.

Bearing and Azimuth

Post by gmpowell71 » Fri Jan 28, 2022 11:59 pm

Hello,

I posted this in the introduction section. It's a script that calculates Bearing and Azimuth between two points.

I'm working towards being a surveyor so this is extremely helpful when laying things out.

I just wish I had the knowledge to refine it more and make it similar to an aligned dimension tool. Maybe someone else can take it further. Enjoy!
Attachments
Bearing.js
(5.36 KiB) Downloaded 88 times
Is it crawfish season yet?

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

Re: Bearing and Azimuth

Post by andrew » Sun Jan 30, 2022 9:14 pm

Thank you for your contribution.

Can this be added to the QCAD repository and future QCAD and QCAD Professional releases?

If so, it would be added under Misc > Information > Bearing / Azimuth.

How would you like to be credited in the Help > About dialog? As "gmpowell71" or with a real name or another pseudonym? Thanks!

CVH
Premier Member
Posts: 1786
Joined: Wed Sep 27, 2017 4:17 pm

Re: Bearing and Azimuth

Post by CVH » Sun Jan 30, 2022 11:32 pm

gmpowell71 wrote:
Fri Jan 28, 2022 11:59 pm
I just wish I had the knowledge to refine it more and make it similar to an aligned dimension tool.
Could you explain this further?
It now adds a message to the Command History. It doesn't add the line because that is ruled out on line 154.
In fact, getOperation returns an empty operation named 'op'.

With an aligned dimension you would add a dimension with extension lines having a measured value.
One could replace the displayed value with the same text of the message ... What is rather long.
Still, it troubles me as the extensions don't necessarily indicate the picked points ... :?

What about casting the line and adding 4 custom properties to the line entity?
One for each value: Delta X, Delta Y, Bearing, Azimuth
BearingAzimuth.png
BearingAzimuth.png (3.33 KiB) Viewed 2226 times

Now that Andrew proposed to include it as a Misc Info tool ...
... I think more in the direction of the Distance Point to Point (IP) behavior, but without the ticks :wink:.
Basically a Line from 2 Points (LI)

Regards,
CVH

User avatar
gmpowell71
Newbie Member
Posts: 5
Joined: Fri Jan 28, 2022 11:05 pm
Location: Somewhere out there.

Re: Bearing and Azimuth

Post by gmpowell71 » Mon Jan 31, 2022 8:24 pm

andrew wrote:
Sun Jan 30, 2022 9:14 pm
Thank you for your contribution.

Can this be added to the QCAD repository and future QCAD and QCAD Professional releases?

If so, it would be added under Misc > Information > Bearing / Azimuth.

How would you like to be credited in the Help > About dialog? As "gmpowell71" or with a real name or another pseudonym? Thanks!
Yes sir. Go for it! Sure gmpowell71 would be fine with me. I surely appreciate you guys taking this to the next level.
Is it crawfish season yet?

User avatar
gmpowell71
Newbie Member
Posts: 5
Joined: Fri Jan 28, 2022 11:05 pm
Location: Somewhere out there.

Re: Bearing and Azimuth

Post by gmpowell71 » Mon Jan 31, 2022 8:32 pm

CVH wrote:
Sun Jan 30, 2022 11:32 pm
gmpowell71 wrote:
Fri Jan 28, 2022 11:59 pm
I just wish I had the knowledge to refine it more and make it similar to an aligned dimension tool.
Could you explain this further?
It now adds a message to the Command History. It doesn't add the line because that is ruled out on line 154.
In fact, getOperation returns an empty operation named 'op'.

With an aligned dimension you would add a dimension with extension lines having a measured value.
One could replace the displayed value with the same text of the message ... What is rather long.
Still, it troubles me as the extensions don't necessarily indicate the picked points ... :?

What about casting the line and adding 4 custom properties to the line entity?
One for each value: Delta X, Delta Y, Bearing, Azimuth
BearingAzimuth.png


Now that Andrew proposed to include it as a Misc Info tool ...
... I think more in the direction of the Distance Point to Point (IP) behavior, but without the ticks :wink:.
Basically a Line from 2 Points (LI)

Regards,
CVH
Honestly, I have no idea what I'm doing! I'm familiar with coding but event based coding is new, really new to me. I played with the script a little more over the weekend to refine the output. Attached is the update.

Whatever you come up with is fine with me. I'm just the kid in the candy store if I can use a metaphor.

What would be really awesome is if at the click of a button every point to point line in a drawing would receive their bearing or azimuth or all the lines in a selection window or something like that. Just dreaming I guess.

Thanks again, you guys are awesome!
Attachments
Bearing.js
bearing1.1
(6.72 KiB) Downloaded 76 times
Is it crawfish season yet?

CVH
Premier Member
Posts: 1786
Joined: Wed Sep 27, 2017 4:17 pm

Re: Bearing and Azimuth

Post by CVH » Tue Feb 01, 2022 9:16 am

gmpowell71 wrote:
Mon Jan 31, 2022 8:32 pm
I played with the script a little more over the weekend to refine the output. Attached is the update.
Great, I was already wondering why the cardinal directions were missing.
Pitty that Andrew didn't pick that up:
https://github.com/qcad/qcad/commit/abc ... 970c377fb5
https://github.com/qcad/qcad/commit/08a ... 5560172430
For the next release it is included under Misc .. Information :)
gmpowell71 wrote:
Mon Jan 31, 2022 8:32 pm
I'm just the kid in the candy store if I can use a metaphor.
Have a look at the PM (Private messages) with some refinements/explanations I'll send to you. :wink:

Regards,
CVH

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

Re: Bearing and Azimuth

Post by andrew » Tue Feb 01, 2022 11:30 am

gmpowell71: Thanks for the update.

Your script now lives in our git repository at:
https://github.com/qcad/qcad/blob/maste ... Bearing.js

Note that I've made some adjustments (class name, menu location, menu order, change user prompts from corner to reference and direction, etc.) to blend in with the other scripts. You might want to download that version to build on that.

Feel free to submit changes directly to github if you are comfortable with that. You can do that with git or directly in your browser using the Edit button on the page above (you'll need a github account for that).

Nigel
Junior Member
Posts: 11
Joined: Tue Oct 27, 2020 9:40 pm

Re: Bearing and Azimuth

Post by Nigel » Wed Feb 02, 2022 11:07 pm

New Bearing and Axzimuth tool:
Congratulations on your thoughtful work in developing this tool!
As I cheer you on from the sidelines as you drive by, I hope that on planning completion for the 'next release' you will be including some guidelines on how to use the tool and the options available within it. As you develop the tool the "tool team' is the best ones to explain its functions and limitations. Learning to drive by trial and error is an expensive and dangerous way to learn! An explanation could be part of this Forum but better if part of the manual I am sure most would agree.
Additionally, gauging the popularity of a tool is difficult if there is no explanation, and a steep learning curve is required to learn how to use it. Then disappointingly finding the tool or program does not do what you hoped, as I am sure we have all experienced. A tool may be more popular if easy to learn.
Regards, Nigel

CVH
Premier Member
Posts: 1786
Joined: Wed Sep 27, 2017 4:17 pm

Re: Bearing and Azimuth

Post by CVH » Thu Feb 03, 2022 8:22 am

Nigel,
There is not much to it ... it's a from point - to point script.
Only, the reported values differ from e.g. Info .. Distance Point to Point (IP).
Mostly because CAD is based on Euclidean geometry where degrees are measured CCW and zero degrees is equal to East. :wink:
https://www.e-education.psu.edu/natureo ... c5_p7.html

Also read this:
https://qcad.org/rsforum/viewtopic.php? ... isc#p36005

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”