mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-10 10:25:36 +01:00
adding some icons for datum operations
This commit is contained in:
parent
97ef5fa786
commit
9d28160bf4
11 changed files with 37 additions and 5 deletions
|
|
@ -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()
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ export default {
|
|||
'menu.primitives': 'shift+a',
|
||||
'menu.main': 'space',
|
||||
'Save': 'ctrl+s',
|
||||
'ImagePngExport': 'shift+3',
|
||||
'Info': 'F1',
|
||||
'DebugOpenBrepDebugger': 'ctrl+b'
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
BIN
web/img/cad/datum-rotate32.png
Normal file
BIN
web/img/cad/datum-rotate32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3 KiB |
BIN
web/img/cad/datum-rotate96.png
Normal file
BIN
web/img/cad/datum-rotate96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
BIN
web/img/cad/datum32.png
Normal file
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
BIN
web/img/cad/datum96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
Loading…
Reference in a new issue