mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-25 18:02:23 +01:00
Fix revolve to use ProductionAnalyzer
This commit is contained in:
parent
afe8853fe8
commit
bf0c12a532
1 changed files with 13 additions and 20 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import {roundValueForPresentation as r} from 'cad/craft/operationHelper';
|
||||
import {MFace} from "cad/model/mface";
|
||||
import {MBrepFace, MFace} from "cad/model/mface";
|
||||
import {ApplicationContext} from "context";
|
||||
import {EntityKind} from "cad/model/entities";
|
||||
import {BooleanDefinition} from "cad/craft/schema/common/BooleanDefinition";
|
||||
|
|
@ -11,7 +11,8 @@ import { GetRef } from "cad/craft/e0/interact";
|
|||
import {
|
||||
FromMObjectProductionAnalyzer,
|
||||
FromSketchProductionAnalyzer,
|
||||
ProductionAnalyzer
|
||||
ProductionAnalyzer,
|
||||
PushPullFaceProductionAnalyzer
|
||||
} from "cad/craft/production/productionAnalyzer";
|
||||
|
||||
interface RevolveParams {
|
||||
|
|
@ -37,31 +38,23 @@ export const RevolveOperation: OperationDescriptor<RevolveParams> = {
|
|||
let sketchId = face.id;
|
||||
let sketch = ctx.sketchStorageService.readSketch(sketchId);
|
||||
|
||||
|
||||
let sweepSources: FaceRef[];
|
||||
|
||||
if (!sketch) {
|
||||
if (face instanceof MBrepFace) {
|
||||
occ.io.pushModel(face, face.id)
|
||||
const edges = face.edges;
|
||||
edges.forEach(e => occ.io.pushModel(e, e.id));
|
||||
sweepSources = [{
|
||||
face: face.id,
|
||||
edges: edges.map(e => e.id)
|
||||
}];
|
||||
var args = ["FaceTool", face, ...params.axis.origin.data(), ...params.axis.direction.data(), params.angle];
|
||||
oci.revol(...args);
|
||||
return occ.utils.applyBooleanModifier([occ.io.getShell("FaceTool")], params.boolean, face, [],
|
||||
(targets, tools) => new FromMObjectProductionAnalyzer(targets, [face]));
|
||||
} else {
|
||||
throw "can't extrude an empty surface";
|
||||
}
|
||||
} else {
|
||||
let csys = face.csys;
|
||||
if (params.doubleSided) {
|
||||
csys = csys.clone();
|
||||
csys.origin._minus(extrusionVector);
|
||||
extrusionVector._scale(2);
|
||||
}
|
||||
sweepSources = occ.utils.sketchToFaces(sketch, csys)
|
||||
}
|
||||
|
||||
let csys = face.csys;
|
||||
|
||||
sweepSources = occ.utils.sketchToFaces(sketch, csys)
|
||||
|
||||
const productionAnalyzer = new FromSketchProductionAnalyzer(sweepSources);
|
||||
|
||||
const tools = sweepSources.map((faceRef, i) => {
|
||||
|
|
@ -69,9 +62,9 @@ export const RevolveOperation: OperationDescriptor<RevolveParams> = {
|
|||
const shapeName = "Tool/" + i;
|
||||
var args = [shapeName, faceName, ...params.axis.origin.data(), ...params.axis.direction.data(), params.angle];
|
||||
oci.revol(...args);
|
||||
|
||||
return shapeName;
|
||||
});
|
||||
}).map(shapeName => occ.io.getShell(shapeName, productionAnalyzer));
|
||||
|
||||
|
||||
return occ.utils.applyBooleanModifier(tools, params.boolean, productionAnalyzer, [face]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue