Improvements in Apex a34

March 11, 2006 by tomographic

Apex a34 fixes a bug which prevented smooth dragging of a window. Basically, Apex was not being smart about reusing the caches image in memory when the window position changed but the window size did not. Ah well.

I also made a change in the way drawing information is ordered in memory. This means a small speedup in drawing ( 5% or so, although I expected more).

Also, there is better auto redraw when zooming in and out. As a bonus, this action now gets recorded in Script Editor’s recording feature.

Speeding up a Mass Ranges Script

March 10, 2006 by tomographic

You may have a script which defines a lot of mass ranges and the colors and sizes for each atom type. One of the things that makes this script a little slow is that Apex will redraw the screen live with each change to the graphics state, even though that really isn’t useful until the whole script is over.

To make this script go faster, use the ‘updating atomtypes’ property of an Apex document — while this setting is false, Apex will avoid recalculating all the mass ranges, which saves a bit of time if you start to get a lot of them.

Additionally, you can turn off redraws in the window using the ‘doing redraw’ property of a window — while this is false, the window contents won’t be redrawn.

Be sure to turn these two properties back on when you are done with a script action. Here’s an example script using these two properties:

to setAtomtypeProps(typeIndex, typeColor, typeSize, typeName)
tell application “Apex”
set the color of atomtype typeIndex of document 1 to typeColor
set the size of atomtype typeIndex of document 1 to typeSize
set the name of atomtype typeIndex of document 1 to typeName
end tell
end setAtomtypeProps
tell application “Apex”
activate

set doing redraw of window 1 of document 1 to false
set updating atomtypes of document 1 to false

if ((count mass ranges of document 1) > 0) then
delete every mass range of document 1
end if
make new mass range with properties {name:”Al”, lower limit:13.38, upper limit:13.84, atomtype:4} in document 1
make new mass range with properties {name:”Fe”, lower limit:26.82, upper limit:27.34, atomtype:1} in document 1
make new mass range with properties {name:”Ni”, lower limit:28.88, upper limit:29.26, atomtype:2} in document 1
make new mass range with properties {name:”Ni”, lower limit:29.860001, upper limit:30.24, atomtype:2} in document 1
make new mass range with properties {name:”Ni”, lower limit:30.84, upper limit:31.26, atomtype:2} in document 1
make new mass range with properties {name:”Cu”, lower limit:31.379999, upper limit:32.32, atomtype:3} in document 1
make new mass range with properties {name:”Cu”, lower limit:32.400002, upper limit:33.139999, atomtype:3} in document 1
make new mass range with properties {name:”Cu”, lower limit:62.66, upper limit:64.5, atomtype:3} in document 1
make new mass range with properties {name:”Cu”, lower limit:64.660004, upper limit:66.5, atomtype:3} in document 1
set updating atomtypes of document 1 to true
end tell
setAtomtypeProps(1, {0, 0, 65535}, 0, “Fe”)
setAtomtypeProps(2, {0, 65535, 0}, 1, “Ni”)
setAtomtypeProps(3, {65535, 0, 0}, 1, “Cu”)
tell application “Apex”
set doing redraw of window 1 of document 1 to true
end tell

Improvements in Apex a33

February 26, 2006 by tomographic

Apex version a33 was delivered recently. This version is now completely converted to composited windows and the Carbon Event drawing model, upgrades the QuickTime API to version 6, replaces the Scrap Manager with the Pasteboard Manager, and reenables multiprocessor mode for drawing.

NUCAPT has an Apex web page

February 25, 2006 by tomographic

NUCAPT has a web page devoted to Apex. Thanks for maintaining that, Richard!