Script for saving the position and rotation of the reticules

Discussions on extending SharpCap using the built in Python scripting functionality
Jean-Francois
Posts: 822
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Script for saving the position and rotation of the reticules

#1

Post by Jean-Francois »

Hello,

Here my little script for saving the position and rotation of the reticules.
The script has a Night Vision Colours too.

Please use the following ZIP file with the last version.

Reticules.zip
(7.42 KiB) Downloaded 28 times

Here some explanations:

- Copy the ZIP file somewhere on your computer and unpack the 5 files
- You can use manually the script directly from the Python console or insert the "menu" version in the SharpCap menu
- When you have a new position and rotation of the selected reticule, click on the "Save" button for saving
- In addition, you can show a rectangle. The main purpose is to simulate the slit of a spectrometer.
- You can save 3 different configurations (named: Finder, Guider and Science)
- If you have 2 or 3 instances of SharpCap (with 2 or 3 cameras), you can start 2 or 3 times the Reticule script.
But, take care to start the reticule only 1 time from each individual instance.
The script window will show the name of the camera. It should help to retrieve the right window.

If you used an older version of my script, take care to use the 3 new text files from the last ZIP file.

Regards,
Jean-Francois
AstroChessPilot
Posts: 33
Joined: Tue Nov 22, 2022 12:46 pm

Re: Script for saving the position and rotation of the reticules

#2

Post by AstroChessPilot »

Hello Jean-Francois,

I have absolutely no programming / scripting skills at all, so please forgive me.

If it is possible, could I request adding the Multi Reticules function in SC to your script? I use the Multi Reticules to help estimate object sizes in arcmins, and it would be nice to have a couple of different sets of reticules.

Thanks in advance!

Tom
Jean-Francois
Posts: 822
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Script for saving the position and rotation of the reticules

#3

Post by Jean-Francois »

Hello Tom,

It is not possible today. Something is producing an error when I "open" the Multi Reticules from the script.
Only Robin can explain what produces the error.

Here what you can find about the reticules in the script:
Reticules_13.jpg
Reticules_13.jpg (312.56 KiB) Viewed 3771 times
Regards,
Jean-Francois
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Script for saving the position and rotation of the reticules

#4

Post by admin »

Hi,

I can fix that sort of problem once I know about it. To avoid almost limitless opportunities to cause the application to hang/freeze/deadlock, the scripting engine has to run in its own thread. However, some bits of the application have to run in the UI thread, which happens automatically when SharpCap is responding to you clicking a button, but needs special handling when happening in response to scripting.

In this case, any reticule that shows a separate window when it is activated needs that sort of special handling to be usable from scripting - I will put a fix in for next week's update... If you encounter other 'thread' related errors using scripting then do let me know.

cheers,

Robin
Jean-Francois
Posts: 822
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Script for saving the position and rotation of the reticules

#5

Post by Jean-Francois »

Hello Robin,

OK, thanks for correcting the access of the Multi Reticules from the script.

The Multi Reticules have 6 circles and 2 lines.
One circle has the XY position and the radius parameters.
One line has 2 points (so 2x XY position).
In addition, each reticule has a "Show" and "Lock" selection.
Ideally ... all these parameters are available in the script.

Regards,
Jean-Francois

Concerning the topic with the SharpCap Script Library ... I will have time during the weekend for uploading several scripts.
AstroChessPilot
Posts: 33
Joined: Tue Nov 22, 2022 12:46 pm

Re: Script for saving the position and rotation of the reticules

#6

Post by AstroChessPilot »

Thank you gentlemen! I look forward to the fix and updated script.

I did write a BASIC program in DOS once in high school. Opps, I just dated myself. ;)
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Script for saving the position and rotation of the reticules

#7

Post by admin »

Hi,

nothing wrong with BASIC in DOS (or even in earlier systems like BBC Micro, TRS-80, Commodore 64, etc). Lots of people started programming that way, myself included.

Right now there is no API access to the details of the multi-reticule tool - all I have fixed so far is the failure when trying to enable/disable it from scripting. Will have to look at the API part.

cheers,

Robin
Jean-Francois
Posts: 822
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Script for saving the position and rotation of the reticules

#8

Post by Jean-Francois »

Hello,

I have a small update of my script for the saving of the position/rotation of the reticules.

** File deleted **

Download the ZIP file from the first message of this topic.


Save the 5 files somewhere. The "..._menu.py" version is used in the menu.
The text files are the position and rotation of the different reticules.

Regards,
Jean-Francois
Jean-Francois
Posts: 822
Joined: Sun Oct 13, 2019 10:52 am
Location: Germany

Re: Script for saving the position and rotation of the reticules

#9

Post by Jean-Francois »

Hello Robin,

I have some problems with my "Reticules" script since you add a new reticule (Protractor) in between the other reticules.
I can change the order of the reticule call in my script ... but, it could brake again the next time you add a new reticule (... in between the other).

I tried to list the reticule. I can get the number of reticules.
I can call the name of one reticule, but only if it is selected.
In my script, I do not wish to activate all the reticules for only have the name of all the reticule in an ordered list.

Is it possible to get the name list of all the reticules ? (without selecting it)

Regards,
Jean-Francois
User avatar
admin
Site Admin
Posts: 17342
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Script for saving the position and rotation of the reticules

#10

Post by admin »

Hi Jean-Francois,

yes, absolutely, you can get the names of the reticules in order without needing to activate them...

Code: Select all

>>> print (SharpCap.Reticules[0].Name)
No Reticule
>>> print (SharpCap.Reticules[1].Name)
Crosshairs
>>> print (SharpCap.Reticules[2].Name)
Circle
>>> print (SharpCap.Reticules[3].Name)
Single Crosshair
>>> print (SharpCap.Reticules[4].Name)
Alternative Crosshair
>>> 
Obviously you would just loop up until the number of reticules. Check the 'IsVisible' property of each too - if IsVisible is true then it is a true reticule in the dropdown in the toolbar. If it's false, it's something else that internally works using the same mechanism but isn't a real reticule (like, for example, deep sky annotation).

cheers,

Robin
Post Reply