mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-27 02:43:04 +01:00
sketch boundaries reconstruction
This commit is contained in:
parent
acfdf236cb
commit
ca3d981320
2 changed files with 19 additions and 8 deletions
|
|
@ -7,6 +7,8 @@ import {Plane} from '../geom/impl/plane';
|
|||
import Vector from '../../../../modules/math/vector';
|
||||
import NullSurface from '../geom/surfaces/nullSurface';
|
||||
import BBox from '../../math/bbox';
|
||||
import NurbsCurve from '../geom/curves/nurbsCurve';
|
||||
import BrepCurve from '../geom/curves/brepCurve';
|
||||
|
||||
export function readBrep(data) {
|
||||
|
||||
|
|
@ -78,8 +80,7 @@ function readSurface(s, inverted, face) {
|
|||
function readCurve(curve) {
|
||||
switch (curve.TYPE) {
|
||||
case 'B-SPLINE':
|
||||
console.dir(curve);
|
||||
|
||||
return new BrepCurve(NurbsCurve.create(curve.deg, curve.knots, curve.cp, curve.weights));
|
||||
case 'CONIC':
|
||||
//...
|
||||
case 'LINE':
|
||||
|
|
|
|||
|
|
@ -1,9 +1,21 @@
|
|||
import {Matrix3} from "../../math/l3space";
|
||||
import {circleFromPoints, distanceAB, TOLERANCE} from "../../math/math";
|
||||
import {iteratePath} from "../cad-utils";
|
||||
import {circleFromPoints, distanceAB, TOLERANCE} from '../../math/math';
|
||||
import {iteratePath} from '../cad-utils';
|
||||
import NurbsCurve from '../../brep/geom/curves/nurbsCurve';
|
||||
|
||||
export function getSketchBoundaries(sceneFace) {
|
||||
const boundary = {lines: [], arcs: [], circles: []};
|
||||
const boundary = {lines: [], arcs: [], circles: [], nurbses: []};
|
||||
let w2sTr = sceneFace.worldToSketchTransformation;
|
||||
let _w2sTrArr = null;
|
||||
let w2sTrArr = () => _w2sTrArr || (_w2sTrArr = w2sTr.toArray());
|
||||
for (let he of sceneFace.brepFace.edges) {
|
||||
if (he.edge.curve.impl.constructor.name === 'NurbsCurve' && he.edge.curve.impl.degree() !== 1) {
|
||||
boundary.nurbses.push(he.edge.curve.impl.transform(w2sTrArr()).serialize())
|
||||
} else {
|
||||
addSegment(w2sTr.apply(he.vertexA.point), w2sTr.apply(he.vertexB.point));
|
||||
}
|
||||
}
|
||||
return boundary;
|
||||
|
||||
|
||||
function sameSketchObject(a, b) {
|
||||
if (a.sketchConnectionObject === undefined || b.sketchConnectionObject === undefined) {
|
||||
|
|
@ -15,8 +27,6 @@ export function getSketchBoundaries(sceneFace) {
|
|||
let paths = sceneFace.getBounds();
|
||||
|
||||
//sceneFace.polygon.collectPaths(paths);
|
||||
|
||||
let w2sTr = sceneFace.worldToSketchTransformation;
|
||||
|
||||
function addSegment(a, b) {
|
||||
boundary.lines.push({
|
||||
|
|
|
|||
Loading…
Reference in a new issue