Start and Stop Live Stacking?

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
Xio1996
Posts: 8
Joined: Fri Feb 21, 2020 10:15 am
Location: Isle of Wight, UK

Start and Stop Live Stacking?

#1

Post by Xio1996 »

Hi Everybody,

I am having a go at writing my first script in SharpCap. Using the IronPython Console with its intellisense, the documentation and some scripts on this forum. I have managed to get some way to creating my script. It has been fun getting into Python and the .NET framework.

However, I can't find a way to start and stop live stacking. The Sequencer can do this, so I guess it must be possible through scripting? I'm hoping I just missed something in the SharpCap object model.

I did think of using a combination of scripting and the sequencer. When I use the following sequencer statement, I get an error that I cannot run this command on the UI thread. Out of interest, how would I go about running sequencer commands or files from scripting? Would I need to run them on a separate .NET thread or again I have just missed something obvious.

Code: Select all

SharpCap.Sequencer.RunSequenceFile("...
I hope a far more knowledgeable person can can point me in the right direction. :)

Pete
User avatar
admin
Site Admin
Posts: 9434
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Start and Stop Live Stacking?

#2

Post by admin »

Hi Pete,

activation is easy...

Code: Select all

SharpCap.LiveStacking.Activate()
de-activation is a little more complex

Code: Select all

SharpCap.Transforms.SelectedTransform = None
However, I am surprised you are getting an error from running a sequence from scripting - that should work. I just tested

Code: Select all

SharpCap.Sequencer.RunSequenceFile("c:\\users\\robin\\desktop\\test.scs")
the scs file contains

Code: Select all

SEQUENCE
    CAPTURE 10 FRAMES REQUIREGUIDING False
END SEQUENCE
So, very simple, but working.

If you have a setup in terms of an SCS that fails every time from scripting but works otherwise then please share the file with me.

thanks,

Robin
Xio1996
Posts: 8
Joined: Fri Feb 21, 2020 10:15 am
Location: Isle of Wight, UK

Re: Start and Stop Live Stacking?

#3

Post by Xio1996 »

Hi Robin,

Thank you for the information on starting and stopping Live Stacking. Activate duh!, not sure why I didn't see that. Stopping Live Stacking I would never have found :)

Running a sequencer file works fine on its own but if it is called from a custom button event, that is when I get the UI thread error. This code fails on my laptop. If I just call selectSetTarget() directly, it functions perfectly. I bet I have missed something ?

Code: Select all

def selectSetTarget():
	SharpCap.Sequencer.RunSequenceFile("C:\\Users\\peter\\OneDrive\\Astronomy\\Sharpcap\\Find+Frame.scs")
	
SharpCap.AddCustomButton("Set Target", None, "Target Name", selectSetTarget)
The scs file looks like this.

Code: Select all

SEQUENCE
    LIVE STACKING STOP
    SET ZOOM 0
    DISPLAY STRETCH AUTO
END SEQUENCE
Thank you very much for your help.

Pete
User avatar
admin
Site Admin
Posts: 9434
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Start and Stop Live Stacking?

#4

Post by admin »

Hi Pete,

ahhh, interesting - I hadn't thought of that. It will require a bit of thought and head scratching, since the current error you get prevents a situation that could quite likely cause SharpCap to freeze completely :(

cheers,

Robin
Post Reply