diff --git a/icon/svgr_raw/arc.svg b/icon/svgr_raw/arc.svg index 2197589..675f63c 100644 --- a/icon/svgr_raw/arc.svg +++ b/icon/svgr_raw/arc.svg @@ -23,17 +23,17 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="10.270466" - inkscape:cx="-8.3938354" - inkscape:cy="-3.3545709" + inkscape:zoom="20.540932" + inkscape:cx="3.3726703" + inkscape:cy="-0.099609255" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:document-rotation="0" showgrid="false" inkscape:window-width="1514" inkscape:window-height="1199" - inkscape:window-x="254" - inkscape:window-y="48" + inkscape:window-x="1031" + inkscape:window-y="111" inkscape:window-maximized="0" units="px" inkscape:snap-object-midpoints="true" @@ -47,7 +47,7 @@ image/svg+xml - + @@ -56,34 +56,34 @@ inkscape:groupmode="layer" id="layer1"> + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/icon/svgr_raw/horizontal.svg b/icon/svgr_raw/horizontal.svg new file mode 100644 index 0000000..3b2a334 --- /dev/null +++ b/icon/svgr_raw/horizontal.svg @@ -0,0 +1,172 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icon/svgr_raw/line.svg b/icon/svgr_raw/line.svg index f6bc8a0..57d6ad2 100644 --- a/icon/svgr_raw/line.svg +++ b/icon/svgr_raw/line.svg @@ -23,17 +23,17 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="29.049263" - inkscape:cx="12.144995" + inkscape:zoom="19.921569" + inkscape:cx="1.0263926" inkscape:cy="6.0925762" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:document-rotation="0" showgrid="false" inkscape:window-width="1514" - inkscape:window-height="1199" - inkscape:window-x="603" - inkscape:window-y="114" + inkscape:window-height="964" + inkscape:window-x="963" + inkscape:window-y="314" inkscape:window-maximized="0" units="px" inkscape:snap-object-midpoints="true" @@ -47,7 +47,7 @@ image/svg+xml - + @@ -57,32 +57,32 @@ id="layer1"> + sodipodi:nodetypes="cccccc" /> + + + + + + + image/svg+xml + + + + + + + STL + + diff --git a/icon/svgr_raw/vertical.svg b/icon/svgr_raw/vertical.svg new file mode 100644 index 0000000..25e9120 --- /dev/null +++ b/icon/svgr_raw/vertical.svg @@ -0,0 +1,172 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Sketch.js b/src/Sketch.js index d4a2882..01bc2b0 100644 --- a/src/Sketch.js +++ b/src/Sketch.js @@ -225,7 +225,10 @@ class Sketch { this.canvas.addEventListener('pointerdown', this.drawOnClick1) this.mode = "point" break; - case 'x': + case 'Delete': + this.deleteSelected() + break; + case 'Backspace': this.deleteSelected() break; case ' ': diff --git a/src/constraintEvents.js b/src/constraintEvents.js index 50cf6c3..4081348 100644 --- a/src/constraintEvents.js +++ b/src/constraintEvents.js @@ -2,9 +2,7 @@ import {color} from './shared' export async function setCoincident() { let selection = await this.awaitSelection({ point: 2 }, { point: 1, line: 1 }) - if (selection == null) return; - if (selection.every(e => e.userData.type == 'point')) { this.constraints.set(++this.c_id, [ @@ -13,9 +11,7 @@ export async function setCoincident() { ] ) } else { - const idx = selection[0].userData.type == 'point' ? [0, 1] : [1, 0] - this.constraints.set(++this.c_id, [ 'pt_on_line', -1, @@ -27,7 +23,6 @@ export async function setCoincident() { selection[1].userData.constraints.push(this.c_id) selection[0].userData.constraints.push(this.c_id) - this.updateOtherBuffers() this.solve() this.updateBoundingSpheres() diff --git a/src/drawDimension.js b/src/drawDimension.js index 2f99d9d..9b5de07 100644 --- a/src/drawDimension.js +++ b/src/drawDimension.js @@ -19,9 +19,6 @@ export async function drawDimension() { let line, dimVal, constraint, dimType if (selection.every(e => e.userData.type == 'line')) { - selection = await this.awaitSelection({ line: 2 }) - if (selection == null) return; - line = new THREE.LineSegments( new THREE.BufferGeometry().setAttribute('position', new THREE.Float32BufferAttribute(Array((divisions + 2) * 2 * 3).fill(-0.001), 3) diff --git a/src/react/icons.jsx b/src/react/icons.jsx index 8ed172d..2af2ff7 100644 --- a/src/react/icons.jsx +++ b/src/react/icons.jsx @@ -8,14 +8,14 @@ function Arc(props) { viewBox="0 0 16 16" {...props} > - + @@ -23,6 +23,28 @@ function Arc(props) { ); } +function Coincident(props) { + return ( + + + + + + + + ); +} + function Dimension(props) { return ( + + + ); +} + function Intersect(props) { return ( - + @@ -187,6 +229,42 @@ function Line(props) { ); } +function Stl(props) { + return ( + + + + {"STL"} + + + + ); +} + function Subtract(props) { return ( ); } -export { Arc, Dimension, Intersect, Intersect_thin, Line, Subtract, Union, Union_thin }; \ No newline at end of file + +function Vertical(props) { + return ( + + + + ); +} +export { Arc, Coincident, Dimension, Horizontal, Intersect, Intersect_thin, Line, Stl, Subtract, Union, Union_thin, Vertical }; \ No newline at end of file diff --git a/src/react/navBar.jsx b/src/react/navBar.jsx index 74fa6b2..f373a25 100644 --- a/src/react/navBar.jsx +++ b/src/react/navBar.jsx @@ -5,7 +5,7 @@ import React, { useEffect, useReducer } from 'react'; import { useDispatch, useSelector } from 'react-redux' import { FaCube, FaEdit } from 'react-icons/fa' -import { MdDone } from 'react-icons/md' +import { MdDone, MdSave, MdFolder} from 'react-icons/md' import * as Icon from "./icons"; @@ -42,35 +42,52 @@ export const NavBar = () => { const btnz = [ - activeSketchId ? - [MdDone, () => { - treeEntries.byId[activeSketchId].deactivate() - // dispatch({ type: 'update-descendents', sketch}) - sc.activeSketch = null - sc.render() - forceUpdate() - // sc.activeDim = this.activeSketch.obj3d.children[1].children - }, 'Finish'] : - [FaEdit, sc.addSketch, 'Sketch [s]'] - , - [FaCube, extrude , 'Extrude [e]'], - [Icon.Union, ()=>boolOp('u'), 'Union'], - [Icon.Subtract, ()=>boolOp('s'), 'Subtract'], - [Icon.Intersect, ()=>boolOp('i'), 'Intersect'], + [MdDone, () => { + treeEntries.byId[activeSketchId].deactivate() + // dispatch({ type: 'update-descendents', sketch}) + sc.activeSketch = null + sc.render() + forceUpdate() + // sc.activeDim = this.activeSketch.obj3d.children[1].children + }, 'Finish'], + [FaCube, extrude, 'Extrude [e]'], [Icon.Dimension, () => sc.extrude(treeEntries.byId[activeSketchId]), 'Dimension [d]'], [Icon.Line, () => sc.extrude(treeEntries.byId[activeSketchId]), 'Line [l]'], [Icon.Arc, () => sc.extrude(treeEntries.byId[activeSketchId]), 'Arc [a]'], + [Icon.Coincident, () => sc.extrude(treeEntries.byId[activeSketchId]), 'Arc [a]'], + [Icon.Vertical, () => sc.extrude(treeEntries.byId[activeSketchId]), 'Arc [a]'], + [Icon.Horizontal, () => sc.extrude(treeEntries.byId[activeSketchId]), 'Arc [a]'], + ] + + + const btnz2 = [ + [FaEdit, sc.addSketch, 'Sketch [s]'] + , + [FaCube, extrude, 'Extrude [e]'], + [Icon.Union, () => boolOp('u'), 'Union'], + [Icon.Subtract, () => boolOp('s'), 'Subtract'], + [Icon.Intersect, () => boolOp('i'), 'Intersect'], + [MdSave, () => boolOp('i'), 'Intersect'], + [MdFolder, () => boolOp('i'), 'Intersect'], + [Icon.Stl, () => boolOp('i'), 'Intersect'], ] const [_, forceUpdate] = useReducer(x => x + 1, 0); return { - btnz.map(([Icon, fcn, txt, shortcut], idx) => ( - - )) + activeSketchId ? + btnz.map(([Icon, fcn, txt, shortcut], idx) => ( + + )) + : + btnz2.map(([Icon, fcn, txt, shortcut], idx) => ( + + )) } } diff --git a/todo.txt b/todo.txt index 1e6d77f..c9ba8a3 100644 --- a/todo.txt +++ b/todo.txt @@ -10,7 +10,7 @@ boolean flesh out refresh / replace mesh - / delete mesh \\ done - create derived part using relationship as name \\ done - hidden bodies messes up hover highlight \\ fixed - - add for union and intersect + - add for union and intersect // done - consume skeches after extrude // done - selection hover disspates when rehovered //fixed - boolean unable to select click //fixed @@ -24,25 +24,50 @@ constraint angle // done -unable to delete arc -hover not clearing +hover not clearing sometimes dim tags are not clearing should unselect after boolean - auto update extrude extrude dialogue - loopfind especially arc - file save, stl export -button panel cleanup + + + + +button panel cleanup +- finish +- extrude +- dim +-line +- arc + +- vertical +- horizontal +-coincident + + +sketch +extrude +boolean + +boolean +boolean + + +load +save +stl + better default ent names reattach sketch -tree ent renaming 3 pt arc -constraint labels, tangent -auto snap \ No newline at end of file + +auto snap +constraint labels,tangent, equal +parallel +tree ent renaming \ No newline at end of file