mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
fix revolve
This commit is contained in:
parent
66c4707a83
commit
7acd2f7a94
9 changed files with 25 additions and 16 deletions
|
|
@ -5,6 +5,7 @@ import CadError from '../../utils/errors';
|
||||||
import {MObject, MObjectIdGenerator} from '../model/mobject';
|
import {MObject, MObjectIdGenerator} from '../model/mobject';
|
||||||
import {intercept} from "lstream/intercept";
|
import {intercept} from "lstream/intercept";
|
||||||
import {CoreContext} from "context";
|
import {CoreContext} from "context";
|
||||||
|
import {MFace} from "../model/mface";
|
||||||
|
|
||||||
export function activate(ctx: CoreContext) {
|
export function activate(ctx: CoreContext) {
|
||||||
|
|
||||||
|
|
@ -17,6 +18,13 @@ export function activate(ctx: CoreContext) {
|
||||||
const models$ = state<MObject[]>([]);
|
const models$ = state<MObject[]>([]);
|
||||||
const update$ = stream<void>();
|
const update$ = stream<void>();
|
||||||
|
|
||||||
|
models$.attach(models => models.forEach(model => model.traverse(m => {
|
||||||
|
if (m instanceof MFace) {
|
||||||
|
let sketch = ctx.sketchStorageService.readSketch(m.defaultSketchId);
|
||||||
|
m.setSketch(sketch);
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
|
||||||
let preRun = null;
|
let preRun = null;
|
||||||
|
|
||||||
function modifyWithPreRun(request, modificationsUpdater, onAccepted, onError) {
|
function modifyWithPreRun(request, modificationsUpdater, onAccepted, onError) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export class MDatum extends MObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(callback: (obj: MObject) => {}) {
|
traverse(callback: (obj: MObject) => void) {
|
||||||
super.traverse(callback);
|
super.traverse(callback);
|
||||||
this.xAxis.traverse(callback);
|
this.xAxis.traverse(callback);
|
||||||
this.yAxis.traverse(callback);
|
this.yAxis.traverse(callback);
|
||||||
|
|
|
||||||
|
|
@ -160,10 +160,10 @@ export class MFace extends MObject {
|
||||||
return this._productionInfo;
|
return this._productionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(callback: (obj: MObject) => {}) {
|
traverse(callback: (obj: MObject) => void) {
|
||||||
callback(this);
|
callback(this);
|
||||||
this.sketchObjects.forEach(callback);
|
this.sketchObjects.forEach(i => i.traverse(callback));
|
||||||
this.sketchLoops.forEach(callback);
|
this.sketchLoops.forEach(i => i.traverse(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export abstract class MObject {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(callback: (obj: MObject) => {}) {
|
traverse(callback: (obj: MObject) => void): void {
|
||||||
callback(this);
|
callback(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,22 +7,23 @@ import CSys from '../../math/csys';
|
||||||
export class MShell extends MObject {
|
export class MShell extends MObject {
|
||||||
|
|
||||||
static TYPE = 'shell';
|
static TYPE = 'shell';
|
||||||
|
|
||||||
csys: CSys;
|
csys: CSys;
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super(MShell.TYPE, MObjectIdGenerator.next(MShell.TYPE, 'S'))
|
|
||||||
}
|
|
||||||
|
|
||||||
shell;
|
shell;
|
||||||
faces = [];
|
faces = [];
|
||||||
edges = [];
|
edges = [];
|
||||||
vertices = [];
|
vertices = [];
|
||||||
|
|
||||||
traverse(callback: (obj: MObject) => {}) {
|
constructor() {
|
||||||
|
super(MShell.TYPE, MObjectIdGenerator.next(MShell.TYPE, 'S'))
|
||||||
|
}
|
||||||
|
|
||||||
|
traverse(callback: (obj: MObject) => void): void {
|
||||||
callback(this);
|
callback(this);
|
||||||
this.faces.forEach(callback);
|
this.faces.forEach(i => i.traverse(callback));
|
||||||
this.edges.forEach(callback);
|
this.edges.forEach(i => i.traverse(callback));
|
||||||
this.vertices.forEach(callback);
|
this.vertices.forEach(i => i.traverse(callback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ function createMarker(findEntity, requestRender) {
|
||||||
let mObj = findEntity(entity, id);
|
let mObj = findEntity(entity, id);
|
||||||
if (!mObj) {
|
if (!mObj) {
|
||||||
console.warn('no entity found to highlight: ' + entity + ' ' + id);
|
console.warn('no entity found to highlight: ' + entity + ' ' + id);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
marked.set(id, mObj);
|
marked.set(id, mObj);
|
||||||
mObj.ext.view && mObj.ext.view.mark(color);
|
mObj.ext.view && mObj.ext.view.mark(color);
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@ import * as SceneGraph from '../../../../modules/scene/sceneGraph';
|
||||||
import {ShellView} from './views/shellView';
|
import {ShellView} from './views/shellView';
|
||||||
import {getAttribute} from '../../../../modules/scene/objectData';
|
import {getAttribute} from '../../../../modules/scene/objectData';
|
||||||
import {MOpenFaceShell} from '../model/mopenFace';
|
import {MOpenFaceShell} from '../model/mopenFace';
|
||||||
import {EDGE, FACE, SHELL, SKETCH_OBJECT} from './entites';
|
|
||||||
import {OpenFaceShellView} from './views/openFaceView';
|
import {OpenFaceShellView} from './views/openFaceView';
|
||||||
import {findDiff} from '../../../../modules/gems/iterables';
|
|
||||||
import {MShell} from '../model/mshell';
|
import {MShell} from '../model/mshell';
|
||||||
import {MDatum} from '../model/mdatum';
|
import {MDatum} from '../model/mdatum';
|
||||||
import DatumView from './views/datumView';
|
import DatumView from './views/datumView';
|
||||||
|
|
@ -53,5 +51,6 @@ function sceneSynchronizer({services: {cadScene, cadRegistry, viewer, wizard, ac
|
||||||
SceneGraph.addToGroup(cadScene.workGroup, modelView.rootGroup);
|
SceneGraph.addToGroup(cadScene.workGroup, modelView.rootGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewer.requestRender();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ export class SketchingView extends View {
|
||||||
this.sketchLoopViews = [];
|
this.sketchLoopViews = [];
|
||||||
this.rootGroup = SceneGraph.createGroup();
|
this.rootGroup = SceneGraph.createGroup();
|
||||||
SceneGraph.addToGroup(this.rootGroup, this.sketchGroup);
|
SceneGraph.addToGroup(this.rootGroup, this.sketchGroup);
|
||||||
|
this.updateSketch();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSketch() {
|
updateSketch() {
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,6 @@ export function activate(ctx) {
|
||||||
services.viewer.requestRender();
|
services.viewer.requestRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
streams.craft.models.attach(updateAllSketches);
|
|
||||||
streams.craft.models.attach(() => {
|
streams.craft.models.attach(() => {
|
||||||
if (inPlaceEditor.inEditMode) {
|
if (inPlaceEditor.inEditMode) {
|
||||||
if (!inPlaceEditor.face.ext.view) {
|
if (!inPlaceEditor.face.ext.view) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue