adding some icons for datum operations

This commit is contained in:
Val Erastov 2019-02-21 02:08:52 -08:00
parent 97ef5fa786
commit 9d28160bf4
11 changed files with 37 additions and 5 deletions

View file

@ -46,6 +46,16 @@ export default [
},
invoke: (context) => context.services.export.stlAscii()
},
{
id: 'ImagePngExport',
appearance: {
cssIcons: ['image'],
label: 'PNG Export',
info: 'export model as png image/render a snapshot',
},
invoke: (context) => context.services.export.imagePng()
},
{

View file

@ -76,7 +76,7 @@ function previewer(ctx, initialParams, updateParams) {
export default {
id: 'DATUM_CREATE',
label: 'Create Datum',
icon: 'img/cad/plane',
icon: 'img/cad/datum',
info: 'originates a new datum from origin or off of a selected face',
paramsInfoComponent: DatumParamsRenderer,
paramsInfo: pointAsText,

View file

@ -66,7 +66,7 @@ function applyRotation(origCsys, csys, angle, axis) {
export default {
id: 'DATUM_ROTATE',
label: 'Rotate Datum',
icon: 'img/cad/plane',
icon: 'img/cad/datum-rotate',
info: 'rotates a datum',
paramsInfo: ({axis, angle}) => `${axis} - ${angle}`,
previewer,

View file

@ -9,7 +9,28 @@ export function activate(ctx) {
exportTextData(result, ctx.services.project.id + ".stl");
}
function imagePng() {
let auxVisible = ctx.services.cadScene.auxGroup.visible;
ctx.services.cadScene.auxGroup.visible = false;
let renderer = ctx.services.viewer.sceneSetup.renderer;
let clearAlpha = renderer.getClearAlpha();
renderer.setClearAlpha(0);
renderer.preserveDrawingBuffer = true;
ctx.services.viewer.sceneSetup.render();
let link = document.getElementById("downloader");
link.href = renderer.domElement.toDataURL('image/png');
link.download = ctx.services.project.id + "-snapshot.png";
link.click();
renderer.preserveDrawingBuffer = false;
ctx.services.cadScene.auxGroup.visible = auxVisible;
renderer.setClearAlpha(0);
renderer.setClearAlpha(clearAlpha);
ctx.services.viewer.sceneSetup.render();
}
ctx.services.export = {
stlAscii
stlAscii, imagePng
};
}

View file

@ -24,6 +24,7 @@ export default {
'menu.primitives': 'shift+a',
'menu.main': 'space',
'Save': 'ctrl+s',
'ImagePngExport': 'shift+3',
'Info': 'F1',
'DebugOpenBrepDebugger': 'ctrl+b'
};

View file

@ -2,7 +2,7 @@ export default [
{
id: 'file',
cssIcons: ['file'],
actions: ['Save', 'StlExport', '-', 'IMPORT_STL', '-', 'ReassignSketch']
actions: ['Save', 'StlExport', 'ImagePngExport', '-', 'IMPORT_STL', '-', 'ReassignSketch']
},
{
id: 'craft',

View file

@ -16,7 +16,7 @@ export function activate({services, streams}) {
['ShowSketches', {label: 'sketches'}], ['DeselectAll', {label: null}], ['ToggleCameraMode', {label: null}]
];
streams.ui.toolbars.headsUp.value = ['PLANE', 'EditFace', 'EXTRUDE', 'CUT', 'REVOLVE', '-', 'FILLET', '-', 'INTERSECTION', 'SUBTRACT', 'UNION'];
streams.ui.toolbars.headsUp.value = ['DATUM_CREATE', 'PLANE', 'EditFace', 'EXTRUDE', 'CUT', 'REVOLVE', '-', 'FILLET', '-', 'INTERSECTION', 'SUBTRACT', 'UNION'];
streams.ui.toolbars.headsUpQuickActions.value = ['Save', 'StlExport'];
services.action.registerActions(CoreActions);

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
web/img/cad/datum32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
web/img/cad/datum96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB