Accessing SI Setup options - dm-script

I would like to write a script which can acquire an EELS spectrum image, followed by an EDX SI. Is there a way to access the Spectrum Image Setup to toggle the 'SI Signals' checkbox between EDS and EELS?
I am using DM 2.32, and when I use SIGetPaletteItemName() to look at what is available, DM returns all options for the clickable buttons on the SI panel except the Setup option.

You can not access the setup options themselves by script.
Unfortunately, I don't think you can change the to-be-acquired signal by script in GMS 2.x.
You can do this in GMS 3.x, but that is not much help to you, is it?
In GMS 3.x, the "to-be-acquired" signals are actually buttons on the UI and can therefore be toggled with the command using the button ID's 11-15.

Related

How to interactively create an edge on canvas between two nodes

As in the cytoscape.js to make an interactive communication between nodes? Is it possible? In similarity how it is implemented in a factoid (http://webservice.baderlab.org:3000/).
That is, you can interactively create an edge on canvas between two nodes and then save it in the database.
The bundled edgehandles plugin is what you're looking for, though you'll also need the cxtmenu plugin or some other manual UI for starting the gesture (e.g. a mode + tap) to support touch devices. They have their options documented at the top of the source, and they will be further documented in 2.1 once they are migrated to the jQuery plugin site -- those plugins are simply jQuery plugins that use the cy.js API afterall.

Identify the monitor with the browser window in FireBreath

I am using FireBreath to create a cross browser plugin which makes use of some native libraries for the respective platform (some .NET based DLLs for Windows and Objective-C based dylibs/frameworks for Mac). Native libraries display UI screens. In order to improve usability, if the user has a multi/extended monitor setup, i would like the native UIs to appear on the same screen as the browser window is currently on.
If an identifier to the monitor with the browser window can be retrieved, that can be passed down to the native components which can be configured to display their UIs on that monitor. I have used FireBreath's getWindowPosition() method to get the rect coordinates of the plugin and used that info to identify the correct monitor in the Windows platform.
However, the coordinates returned in Mac seems to be always 0 (or 1) irrespective of monitor on which the browser window currently resides. I understand that we have to configure an event model and a drawing model in order for this to work in Mac. I have tried following event/drawing model combinations without much success.
1) Cocoa/CoreGraphics
2) Carbon/CoreGraphics
Any help in this regard is much appreciated. Also please do share if there are other approaches to achieve the same. What i want to achieve is to identify the monitor on which the current active browser window resides in Mac. I am unsure at this point, but it maybe possible to achieve this at Objective-C level (without any changes at FireBreath level). Also please note that i want to support Safari, Firefox and Chrome browsers.
You won't like this answer, but simply put you can't do that on Mac. The problem is that with CoreGraphics you are only given a CGContextRef to work with, and it doesn't know where it will be drawn. It was technically possible in older browsers to get an NSWindow by exploiting some internal implementation details, but many browsers that's no longer possible and it was never supported.
Other drawing models are the same; CoreAnimation you have a CALayer but it doesn't know which screen or monitor it is drawn to. I personally think it's a bit annoying as well, but I do not know of any way to find out which monitor your plugin is rendered to, particularly since most of them actually copy the buffer to something else and render in a different process.
I did manage to come up with a workaround and i am just replying here for the completeness of the thread. As #taxilian explained, it is not possible to retrieve plugin coordinates using the window reference. As an alternative approach, Javascript 'Window' object has 2 properties called 'screenX' and 'screenY' that return X and Y coordinates of the browser window relative to the screen. If the user has an extended monitor setup, these are the absolute coordinates with respect to the full extended screen. We can use these values to determine the monitor with the browser window (if the X coordinate is outside the bounds of the primary monitor's width, then the browser should essentially be on the extended monitor). We can retrieve DOM properties from Firebreath as explained in the following link:
http://www.firebreath.org/display/documentation/Invoking+methods+on+the+DOM

How to get/set interpretation window scale

3D/2D windows have a Z-scale property. Do intersection/interpretation windows have anything similar?
The simple answer is "no". In 3D window Z-scale is realized via SoScale node, Interpretation/Intersection windows use other engine.
Update: There is no access to viewport's Z-scale for Interpretation/Intersection window. You can simulate pseudo changes via IntersectionWindow.Bounds, but it doesn't affect viewport's Z-scale. You can submit an official enhancement request via www.ocean.slb.com (Developer's pages) if you wish.

3D animation programatically rendered in Blender

I have a project in which I would like to programatically create and render a 3d animation based upon input. I originally asked here on stackoverflow if Blender was right for the job, and the response was yes, but upon looking at the API, it says this:
Python was embedded in Blender, so to access BPython modules you need to run scripts from the program itself: you can't import the Blender module into an external Python interpreter.
I want to be able to create and render this scene without having to ever open another program like Blender. Is this possible, and is Blender still the right choice?
Thanks in advance!
At work me and colleague worked on a project that rendered 3d scenes altered externally. We used Python to modify/create scenes, and did the rending on server through the command line interface (no GUI).
You can pass a python script as an argument to Blender in the command line options to
generate your scene objects and do the rendering.
I don't see how you can render in Blender without using Blender.
You can use Blender if you want, obviously this is not your only option.
If you need to
create and render a 3d animation based upon input.
You can go as simple or as you complex as you'd like.
You can use OpenGL in your language of choice (C++, Java, Python, etc.)
and display the animation (with or without fancy renderings).
It's up to what 'render' means to your context.
If you need some nice shading(light, soft shadows, reflections, etc. - ray tracers basically), you can still show an interactive preview to your users and generate the scene
for a 3rd party renderer(like Yafaray, Sunflow, LuxRender, etc. - I've put together a short list of free renders), and show the progress to the users after they've chosen the external render option.
On a similar note, have a look at joons.
HTH
Cart by Suomi - Yafaray Gallery image
Julia quaternion fractal - Sunflow Gallery image
Klein Bottle - LuxRender Gallery image

Getting DOM from page using Chromium/WebKit

Trying to get access to a page's DOM after rendering. I do not need to view the page and plan to apply this programmatically without any GUI or interaction.
The reason I am interested in post-rendering is that I want to know where objects appear. Some location information is coded in the HTML (e.g., via offsetLeft), but much is not. Also, Javascript can change the ultimate positioning. I want positions that are as close to what the user will see as possible.
I've looked into Chromium code and think there is a way to do this but there is not enough documentation to get started.
Putting it VERY simply I'd be interested in pseudo-code like this:
DOMRoot *r = new Page("http://stackoverflow.com")->getDom();
Any tips on starting points?
You should use the Web API wrapper that Chromium exposes; specifically, the WebDocument class contains the functionality that you need. You can call it like this:
WebFrame * mainFrame = webView->mainFrame();
WebDocument document = mainFrame->document();
WebElement docElement = document->docElement();
// Manipulate the DOM here using docElement
...
You can browse the source code for Chromium's Web API wrapper here. Although there's not much in the way of documentation, the header files are fairly well-commented and you can browse Chrome's source code to see the API in action.
It's difficult to get started using Chromium. I recommend looking at the test_shell application. Also, a framework like the Chromium Embedded Framework (CEF) simplifies the process of embedding Chromium in your application; I use CEF in my current project and I'm very satisfied with it.