geometrix 0.5.39 → 0.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +203 -152
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -296,6 +296,7 @@ declare abstract class AContour {
|
|
|
296
296
|
abstract toPax(): tPaxContour;
|
|
297
297
|
abstract getPerimeter(): number;
|
|
298
298
|
}
|
|
299
|
+
declare function midArcPoint(px1: number, py1: number, seg: Segment1): Point;
|
|
299
300
|
/**
|
|
300
301
|
* class `Contour`
|
|
301
302
|
*
|
|
@@ -674,4 +675,4 @@ declare function version_details(appPackage: tPackage): string[];
|
|
|
674
675
|
|
|
675
676
|
declare function checkImpPages(pages: tAllPageDef): [boolean, string];
|
|
676
677
|
|
|
677
|
-
export { Contour, ContourCircle, DesignParam, DxfSeg, DxfWrite, EBVolume, EExtrude, EFormat, Figure, Line, PSeg, PType, PaxPath, Point, SegDbg, SegEnum, Segment1, Segment2, ShapePoint, Transform3d, Vector, aBFromLaLbAa, aCFromAaAb, aCFromLaLbLc, adjustCenter, adjustInit, adjustRect, adjustScale, adjustTranslate, adjustZero, arcSeg1To2, arcSeg2To1, bisector, canvas2point, canvasTranslatePolar, checkGeom, checkImpPages, circleCenter, colors, contour, contourCircle, copyLayers, createParamFile, ctrOblong, ctrRectRot, ctrRectRot2, ctrRectangle, ctrTrapezoid, ctrTrapezoidRot2, degToRad, designParam, dxfSegArc, dxfSegCircle, dxfSegLine, dxfWriter, ffix, figure, fileBin, fileBinContent, fileMime, fileSuffix, fileTextContent, fround, gSegDbg, initGeom, initLayers, isActiveCorner, isAddPoint, isCorner, isSeg, isWithin, lbFromLaAaAb, lcFromLaLbAc, line, linePP, makeCorner, mergeFaces, oneDesignParam, orientedArc, pCheckbox, pDropdown, pNumber, pSectionSeparator, paramListToVal, parseParamFile, paxCircle, paxPath, point, point2canvas, pointMinMax, prefixLog, radToDeg, radius2canvas, rightTriLaFromLbLc, rightTriLbFromLaLc, roundZero, type tAffine, type tAllLink, type tAllPageDef, type tBVolume, type tCanvasAdjust, type tCartesian, type tContour, type tDependencies, type tDesignParamList, type tDesignParamOne, type tExtrude, type tFigures, type tGeom, type tGeomFunc, type tInherit, type tLayers, type tOuterInner, type tPackage, type tPageDef, type tParam, type tParamChanged, type tParamDef, type tParamVal, type tParamValInFile, type tPaxContour, type tPaxContourCircle, type tPaxContourPath, type tPaxFace, type tPaxSeg, type tPaxSegArc, type tPaxSegSt, type tPolar, type tPosiOrien, type tSimTime, type tSubDesign, type tSubInst, type tT3dMatrix, type tVec3, type tVec4, type tVolume, tolerance, transform3d, vector, version_details, withinHPiHPi, withinPiPi, withinZero2Pi, withinZeroPi, zeroPDef };
|
|
678
|
+
export { Contour, ContourCircle, DesignParam, DxfSeg, DxfWrite, EBVolume, EExtrude, EFormat, Figure, Line, PSeg, PType, PaxPath, Point, SegDbg, SegEnum, Segment1, Segment2, ShapePoint, Transform3d, Vector, aBFromLaLbAa, aCFromAaAb, aCFromLaLbLc, adjustCenter, adjustInit, adjustRect, adjustScale, adjustTranslate, adjustZero, arcSeg1To2, arcSeg2To1, bisector, canvas2point, canvasTranslatePolar, checkGeom, checkImpPages, circleCenter, colors, contour, contourCircle, copyLayers, createParamFile, ctrOblong, ctrRectRot, ctrRectRot2, ctrRectangle, ctrTrapezoid, ctrTrapezoidRot2, degToRad, designParam, dxfSegArc, dxfSegCircle, dxfSegLine, dxfWriter, ffix, figure, fileBin, fileBinContent, fileMime, fileSuffix, fileTextContent, fround, gSegDbg, initGeom, initLayers, isActiveCorner, isAddPoint, isCorner, isSeg, isWithin, lbFromLaAaAb, lcFromLaLbAc, line, linePP, makeCorner, mergeFaces, midArcPoint, oneDesignParam, orientedArc, pCheckbox, pDropdown, pNumber, pSectionSeparator, paramListToVal, parseParamFile, paxCircle, paxPath, point, point2canvas, pointMinMax, prefixLog, radToDeg, radius2canvas, rightTriLaFromLbLc, rightTriLbFromLaLc, roundZero, type tAffine, type tAllLink, type tAllPageDef, type tBVolume, type tCanvasAdjust, type tCartesian, type tContour, type tDependencies, type tDesignParamList, type tDesignParamOne, type tExtrude, type tFigures, type tGeom, type tGeomFunc, type tInherit, type tLayers, type tOuterInner, type tPackage, type tPageDef, type tParam, type tParamChanged, type tParamDef, type tParamVal, type tParamValInFile, type tPaxContour, type tPaxContourCircle, type tPaxContourPath, type tPaxFace, type tPaxSeg, type tPaxSegArc, type tPaxSegSt, type tPolar, type tPosiOrien, type tSimTime, type tSubDesign, type tSubInst, type tT3dMatrix, type tVec3, type tVec4, type tVolume, tolerance, transform3d, vector, version_details, withinHPiHPi, withinPiPi, withinZero2Pi, withinZeroPi, zeroPDef };
|
package/dist/index.js
CHANGED
|
@@ -1673,6 +1673,17 @@ function paxPath() {
|
|
|
1673
1673
|
// src/contour.ts
|
|
1674
1674
|
var AContour = class {
|
|
1675
1675
|
};
|
|
1676
|
+
function midArcPoint(px1, py1, seg) {
|
|
1677
|
+
const seg2 = arcSeg1To2(px1, py1, seg);
|
|
1678
|
+
const p3 = point(seg2.pc.cx, seg2.pc.cy);
|
|
1679
|
+
const a12h = withinPiPi((seg2.a2 - seg2.a1) / 2);
|
|
1680
|
+
let a3 = seg2.a1 + a12h;
|
|
1681
|
+
if (Math.sign(a12h) > 0 && !seg.arcCcw || Math.sign(a12h) < 0 && seg.arcCcw) {
|
|
1682
|
+
a3 += Math.PI;
|
|
1683
|
+
}
|
|
1684
|
+
const p4 = p3.translatePolar(a3, seg.radius);
|
|
1685
|
+
return p4;
|
|
1686
|
+
}
|
|
1676
1687
|
var Contour = class _Contour extends AContour {
|
|
1677
1688
|
/** @internal */
|
|
1678
1689
|
circle = false;
|
|
@@ -2213,14 +2224,7 @@ var Contour = class _Contour extends AContour {
|
|
|
2213
2224
|
for (const seg of this.segments) {
|
|
2214
2225
|
if (seg.sType === 1 /* eArc */) {
|
|
2215
2226
|
try {
|
|
2216
|
-
const
|
|
2217
|
-
const p3 = point(seg2.pc.cx, seg2.pc.cy);
|
|
2218
|
-
const a12h = withinPiPi((seg2.a2 - seg2.a1) / 2);
|
|
2219
|
-
let a3 = seg2.a1 + a12h;
|
|
2220
|
-
if (Math.sign(a12h) > 0 && !seg.arcCcw || Math.sign(a12h) < 0 && seg.arcCcw) {
|
|
2221
|
-
a3 += Math.PI;
|
|
2222
|
-
}
|
|
2223
|
-
const p4 = p3.translatePolar(a3, seg.radius);
|
|
2227
|
+
const p4 = midArcPoint(px1, py1, seg);
|
|
2224
2228
|
rPoints.push(p4);
|
|
2225
2229
|
} catch (emsg) {
|
|
2226
2230
|
console.log("err453: " + emsg);
|
|
@@ -3101,6 +3105,17 @@ function convTypePaxToSeg1(paxType) {
|
|
|
3101
3105
|
}
|
|
3102
3106
|
return rType;
|
|
3103
3107
|
}
|
|
3108
|
+
function convPaxToSeg1(seg) {
|
|
3109
|
+
const rSeg1 = new Segment1(
|
|
3110
|
+
convTypePaxToSeg1(seg.typ),
|
|
3111
|
+
seg.px,
|
|
3112
|
+
seg.py,
|
|
3113
|
+
seg.radius,
|
|
3114
|
+
seg.large,
|
|
3115
|
+
seg.ccw
|
|
3116
|
+
);
|
|
3117
|
+
return rSeg1;
|
|
3118
|
+
}
|
|
3104
3119
|
|
|
3105
3120
|
// src/arc_to_stroke.ts
|
|
3106
3121
|
function calcAngleStep(max_angle, max_length, radius, arc_angle) {
|
|
@@ -3665,159 +3680,194 @@ function ojscadWrite() {
|
|
|
3665
3680
|
}
|
|
3666
3681
|
|
|
3667
3682
|
// src/write_freecad.ts
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
function oscadSegLine2(p2x, p2y) {
|
|
3671
|
-
const rSeg = [[p2x, p2y]];
|
|
3672
|
-
return rSeg;
|
|
3683
|
+
function ff6(ifloat) {
|
|
3684
|
+
return ifloat.toFixed(4);
|
|
3673
3685
|
}
|
|
3674
|
-
function
|
|
3675
|
-
|
|
3676
|
-
return rSeg;
|
|
3686
|
+
function fid(iIdx) {
|
|
3687
|
+
return iIdx.toString().padStart(3, "0");
|
|
3677
3688
|
}
|
|
3678
|
-
function
|
|
3679
|
-
const
|
|
3680
|
-
|
|
3689
|
+
function fcFaceCircle(cx, cy, radius, outName) {
|
|
3690
|
+
const rStr = `def ${outName}():
|
|
3691
|
+
# Radius, XYZ-position, orientation
|
|
3692
|
+
aCircle = Part.makeCircle(${ff6(radius)}, App.Vector(${ff6(cx)}, ${ff6(cy)}, 0), App.Vector(0, 0, 1))
|
|
3693
|
+
aWire = Part.Wire(aCircle)
|
|
3694
|
+
rFace = Part.Face(aWire)
|
|
3695
|
+
return rFace
|
|
3696
|
+
|
|
3697
|
+
`;
|
|
3698
|
+
return rStr;
|
|
3681
3699
|
}
|
|
3682
|
-
function
|
|
3683
|
-
|
|
3700
|
+
function fcFaceContour(paxCtr, outName) {
|
|
3701
|
+
let rStr = `def ${outName}():
|
|
3702
|
+
`;
|
|
3684
3703
|
let px1 = 0;
|
|
3685
3704
|
let py1 = 0;
|
|
3705
|
+
let pIdx = 0;
|
|
3706
|
+
let sIdx = 0;
|
|
3686
3707
|
for (const seg of paxCtr) {
|
|
3687
3708
|
if (seg.typ === 0 /* eStart */) {
|
|
3688
|
-
|
|
3709
|
+
rStr += ` P${fid(pIdx)} = App.Vector(${ff6(seg.px)}, ${ff6(seg.py)}, 0)
|
|
3710
|
+
`;
|
|
3711
|
+
pIdx += 1;
|
|
3689
3712
|
} else if (seg.typ === 1 /* eStroke */) {
|
|
3690
|
-
|
|
3713
|
+
rStr += ` P${fid(pIdx)} = App.Vector(${ff6(seg.px)}, ${ff6(seg.py)}, 0)
|
|
3714
|
+
`;
|
|
3715
|
+
rStr += ` S${fid(sIdx)} = Part.LineSegment(P${fid(pIdx - 1)}, P${fid(pIdx)})
|
|
3716
|
+
`;
|
|
3717
|
+
pIdx += 1;
|
|
3718
|
+
sIdx += 1;
|
|
3691
3719
|
} else if (seg.typ === 2 /* eArc */) {
|
|
3692
3720
|
try {
|
|
3693
|
-
const
|
|
3694
|
-
const
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
sega.radius,
|
|
3699
|
-
sega.large,
|
|
3700
|
-
sega.ccw
|
|
3701
|
-
);
|
|
3702
|
-
const seg2 = arcSeg1To2(px1, py1, seg1);
|
|
3703
|
-
rOscadSeg.push(
|
|
3704
|
-
...oscadSegArc2(
|
|
3705
|
-
seg2.pc.cx,
|
|
3706
|
-
seg2.pc.cy,
|
|
3707
|
-
seg1.radius,
|
|
3708
|
-
seg2.a1,
|
|
3709
|
-
seg2.a2,
|
|
3710
|
-
seg2.arcCcw
|
|
3711
|
-
)
|
|
3712
|
-
);
|
|
3721
|
+
const seg1 = convPaxToSeg1(seg);
|
|
3722
|
+
const p4 = midArcPoint(px1, py1, seg1);
|
|
3723
|
+
rStr += ` P${fid(pIdx)} = App.Vector(${ff6(p4.cx)}, ${ff6(p4.cy)}, 0)
|
|
3724
|
+
`;
|
|
3725
|
+
pIdx += 1;
|
|
3713
3726
|
} catch (emsg) {
|
|
3714
3727
|
console.log("err730: " + emsg);
|
|
3715
3728
|
}
|
|
3729
|
+
rStr += ` P${fid(pIdx)} = App.Vector(${ff6(seg.px)}, ${ff6(seg.py)}, 0)
|
|
3730
|
+
`;
|
|
3731
|
+
rStr += ` S${fid(sIdx)} = Part.Arc(P${fid(pIdx - 2)}, P${fid(pIdx - 1)}, P${fid(pIdx)})
|
|
3732
|
+
`;
|
|
3733
|
+
pIdx += 1;
|
|
3734
|
+
sIdx += 1;
|
|
3716
3735
|
}
|
|
3717
3736
|
px1 = seg.px;
|
|
3718
3737
|
py1 = seg.py;
|
|
3719
3738
|
}
|
|
3720
|
-
|
|
3721
|
-
}
|
|
3722
|
-
|
|
3723
|
-
|
|
3739
|
+
const segList = Array.from({ length: sIdx }, (v, i) => `S${fid(i)}`);
|
|
3740
|
+
rStr += ` aShape = Part.Shape([${segList.join(", ")}])
|
|
3741
|
+
aWire = Part.Wire(aShape.Edges)
|
|
3742
|
+
subFace = Part.Face(aWire)
|
|
3743
|
+
subFace.check()
|
|
3744
|
+
return subFace
|
|
3745
|
+
|
|
3746
|
+
`;
|
|
3747
|
+
return rStr;
|
|
3724
3748
|
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3749
|
+
function fcOneFace(ctrNames, outName) {
|
|
3750
|
+
let rStr = `def ${outName}():
|
|
3751
|
+
`;
|
|
3752
|
+
const ctrShorts = [];
|
|
3753
|
+
for (const [idx, ctr] of ctrNames.entries()) {
|
|
3754
|
+
const short = `FC${fid(idx)}`;
|
|
3755
|
+
rStr += ` ${short} = ${ctr}()
|
|
3756
|
+
`;
|
|
3757
|
+
ctrShorts.push(short);
|
|
3733
3758
|
}
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
}
|
|
3743
|
-
const ptStr = `[ ${pts2.join(",")} ]`;
|
|
3744
|
-
const ptIdxStr = `[ ${ptIdx2.join(",")} ]`;
|
|
3745
|
-
this.pts.push(ptStr);
|
|
3746
|
-
this.ptIdx.push(ptIdxStr);
|
|
3759
|
+
const outer = ctrShorts[0];
|
|
3760
|
+
const inner = ctrShorts.slice(1);
|
|
3761
|
+
if (inner.length > 0) {
|
|
3762
|
+
rStr += ` rOneFace = ${outer}.cut([${inner.join(", ")}])
|
|
3763
|
+
`;
|
|
3764
|
+
} else {
|
|
3765
|
+
rStr += ` rOneFace = ${outer}
|
|
3766
|
+
`;
|
|
3747
3767
|
}
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
const bList = [];
|
|
3752
|
-
for (const idx of this.pts.keys()) {
|
|
3753
|
-
const aId = `ca_${faceId}_${idx}`;
|
|
3754
|
-
const bId = `cb_${faceId}_${idx}`;
|
|
3755
|
-
rStr += `${aId} = ${this.pts[idx]};
|
|
3768
|
+
rStr += ` rOneFace.check()
|
|
3769
|
+
return rOneFace
|
|
3770
|
+
|
|
3756
3771
|
`;
|
|
3757
|
-
|
|
3772
|
+
return rStr;
|
|
3773
|
+
}
|
|
3774
|
+
function fcOneFig(faceNames, outName) {
|
|
3775
|
+
let rStr = `def ${outName}():
|
|
3758
3776
|
`;
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
}
|
|
3762
|
-
|
|
3763
|
-
const bListStr = bList.join(", ");
|
|
3764
|
-
rStr += `a_${faceId} = concat(${aListStr});
|
|
3777
|
+
const faceShorts = [];
|
|
3778
|
+
for (const [idx, face] of faceNames.entries()) {
|
|
3779
|
+
const short = `FA${fid(idx)}`;
|
|
3780
|
+
rStr += ` ${short} = ${face}()
|
|
3765
3781
|
`;
|
|
3766
|
-
|
|
3782
|
+
faceShorts.push(short);
|
|
3783
|
+
}
|
|
3784
|
+
const firstFace = faceShorts[0];
|
|
3785
|
+
const otherFace = faceShorts.slice(1);
|
|
3786
|
+
if (otherFace.length > 0) {
|
|
3787
|
+
rStr += ` rOneFig = ${firstFace}.fuse([${otherFace.join(", ")}])
|
|
3788
|
+
`;
|
|
3789
|
+
} else {
|
|
3790
|
+
rStr += ` rOneFig = ${firstFace}
|
|
3767
3791
|
`;
|
|
3768
|
-
return rStr;
|
|
3769
3792
|
}
|
|
3770
|
-
|
|
3793
|
+
rStr += ` rOneFig.check()
|
|
3794
|
+
return rOneFig
|
|
3795
|
+
|
|
3796
|
+
`;
|
|
3797
|
+
return rStr;
|
|
3798
|
+
}
|
|
3771
3799
|
var FreecadWrite = class {
|
|
3772
3800
|
//constructor() {}
|
|
3773
|
-
getHeader() {
|
|
3774
|
-
const rStr =
|
|
3801
|
+
getHeader(outFileName) {
|
|
3802
|
+
const rStr = `# freecad-python generated by Parametrix
|
|
3803
|
+
# run the script with:
|
|
3804
|
+
# freecad.cmd myScript.py
|
|
3805
|
+
|
|
3806
|
+
import FreeCAD as App
|
|
3807
|
+
import Part
|
|
3808
|
+
|
|
3809
|
+
#print(sys.argv)
|
|
3810
|
+
outFileName = "${outFileName}"
|
|
3811
|
+
if (len(sys.argv) == 3):
|
|
3812
|
+
outFileName = sys.argv[2]
|
|
3813
|
+
print(f"outFileName: {outFileName}")
|
|
3814
|
+
|
|
3815
|
+
`;
|
|
3775
3816
|
return rStr;
|
|
3776
3817
|
}
|
|
3777
|
-
getOneFigure(aFaces,
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3818
|
+
getOneFigure(aFaces, figName) {
|
|
3819
|
+
let rStr = "";
|
|
3820
|
+
const figFaceList = [];
|
|
3821
|
+
for (const [faceIdx, paxFace] of aFaces.entries()) {
|
|
3822
|
+
const faceName = `face_${figName}_Fa${faceIdx}`;
|
|
3823
|
+
const faceCtrList = [];
|
|
3824
|
+
for (const [ctrIdx, paxCtr] of paxFace.entries()) {
|
|
3825
|
+
const subFaceName = `ctr_${faceName}_Ctr${ctrIdx}`;
|
|
3781
3826
|
if (paxCtr.circle === true) {
|
|
3782
3827
|
const paxCircle2 = paxCtr;
|
|
3783
|
-
|
|
3784
|
-
oscadWF.addContour(oscadSeg);
|
|
3828
|
+
rStr += fcFaceCircle(paxCircle2.cx, paxCircle2.cy, paxCircle2.radius, subFaceName);
|
|
3785
3829
|
} else {
|
|
3786
3830
|
const paxPath2 = paxCtr;
|
|
3787
|
-
|
|
3788
|
-
oscadWF.addContour(oscadSeg);
|
|
3831
|
+
rStr += fcFaceContour(paxPath2.seg, subFaceName);
|
|
3789
3832
|
}
|
|
3833
|
+
faceCtrList.push(subFaceName);
|
|
3790
3834
|
}
|
|
3835
|
+
rStr += fcOneFace(faceCtrList, faceName);
|
|
3836
|
+
figFaceList.push(faceName);
|
|
3791
3837
|
}
|
|
3792
|
-
|
|
3793
|
-
return
|
|
3838
|
+
rStr += fcOneFig(figFaceList, figName);
|
|
3839
|
+
return rStr;
|
|
3794
3840
|
}
|
|
3795
|
-
getAllFigures(
|
|
3841
|
+
getAllFigures(figs, partName) {
|
|
3796
3842
|
let rStr = "";
|
|
3797
|
-
for (const
|
|
3798
|
-
const figu = this.getOneFigure(
|
|
3843
|
+
for (const ifig in figs) {
|
|
3844
|
+
const figu = this.getOneFigure(figs[ifig], `${partName}_${ifig}`);
|
|
3799
3845
|
rStr += figu;
|
|
3800
3846
|
}
|
|
3801
3847
|
return rStr;
|
|
3802
3848
|
}
|
|
3803
3849
|
getOneExtrude(extrud) {
|
|
3804
|
-
let
|
|
3805
|
-
|
|
3850
|
+
let rStr = `def fex_${extrud.outName}():
|
|
3851
|
+
FIG = ${extrud.face}()
|
|
3852
|
+
`;
|
|
3806
3853
|
if (extrud.extrudeMethod === 0 /* eLinearOrtho */) {
|
|
3807
3854
|
if (extrud.length === void 0) {
|
|
3808
|
-
console.log(
|
|
3855
|
+
console.log(
|
|
3856
|
+
`err103: ${extrud.face} ${extrud.outName} design error: eLinearOrtho length undefined!`
|
|
3857
|
+
);
|
|
3809
3858
|
}
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
}
|
|
3859
|
+
rStr += ` VEX = FIG.extrude(App.Vector(0, 0, ${extrud.length}))`;
|
|
3860
|
+
} else if (extrud.extrudeMethod === 1 /* eRotate */) {
|
|
3861
|
+
rStr += ` VEX = FIG.revolve(App.Vector(0, 0, 0), App.Vector(0, 1, 0), 360).rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), 90)`;
|
|
3862
|
+
}
|
|
3863
|
+
rStr += `
|
|
3864
|
+
VR1 = VEX.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), ${radToDeg(extrud.rotate[0])})
|
|
3865
|
+
VR2 = VR1.rotate(App.Vector(0, 0, 0), App.Vector(0, 1, 0), ${radToDeg(extrud.rotate[1])})
|
|
3866
|
+
VR3 = VR2.rotate(App.Vector(0, 0, 0), App.Vector(0, 0, 1), ${radToDeg(extrud.rotate[2])})
|
|
3867
|
+
VFP = VR3.translate(App.Vector(${extrud.translate[0]}, ${extrud.translate[1]}, ${extrud.translate[2]}))
|
|
3868
|
+
return VFP
|
|
3869
|
+
${extrud.outName} = fex_${extrud.outName}()
|
|
3870
|
+
|
|
3821
3871
|
`;
|
|
3822
3872
|
return rStr;
|
|
3823
3873
|
}
|
|
@@ -3830,36 +3880,33 @@ module ${extrud.outName} () {
|
|
|
3830
3880
|
return rStr;
|
|
3831
3881
|
}
|
|
3832
3882
|
getOneVolume(volum) {
|
|
3833
|
-
let
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
case 2 /* eUnion */:
|
|
3839
|
-
vMethod = "union";
|
|
3840
|
-
break;
|
|
3841
|
-
case 3 /* eSubstraction */:
|
|
3842
|
-
vMethod = "difference";
|
|
3843
|
-
break;
|
|
3844
|
-
}
|
|
3845
|
-
const inList2 = [];
|
|
3846
|
-
for (const elem of volum.inList) {
|
|
3847
|
-
inList2.push(`${elem}();`);
|
|
3848
|
-
}
|
|
3849
|
-
const inList3 = inList2.join("\n");
|
|
3850
|
-
let rStr = `
|
|
3851
|
-
module ${volum.outName} () {
|
|
3852
|
-
${vMethod} () {
|
|
3853
|
-
${inList3}
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3883
|
+
let rStr = "";
|
|
3884
|
+
if (volum.inList.length === 0) {
|
|
3885
|
+
console.log(`err215: ${volum.outName} has an empty inList`);
|
|
3886
|
+
} else if (volum.inList.length === 1) {
|
|
3887
|
+
rStr += `${volum.outName} = ${volum.inList[0]}
|
|
3856
3888
|
`;
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3889
|
+
} else {
|
|
3890
|
+
const firstV = volum.inList[0];
|
|
3891
|
+
const othersV = volum.inList.slice(1);
|
|
3892
|
+
switch (volum.boolMethod) {
|
|
3893
|
+
case 0 /* eIdentity */:
|
|
3894
|
+
rStr += `${volum.outName} = ${firstV}
|
|
3895
|
+
`;
|
|
3896
|
+
break;
|
|
3897
|
+
case 1 /* eIntersection */:
|
|
3898
|
+
rStr += `${volum.outName} = ${firstV}.common([${othersV.join(", ")}])
|
|
3862
3899
|
`;
|
|
3900
|
+
break;
|
|
3901
|
+
case 2 /* eUnion */:
|
|
3902
|
+
rStr += `${volum.outName} = ${firstV}.fuse([${othersV.join(", ")}])
|
|
3903
|
+
`;
|
|
3904
|
+
break;
|
|
3905
|
+
case 3 /* eSubstraction */:
|
|
3906
|
+
rStr += `${volum.outName} = ${firstV}.cut([${othersV.join(", ")}])
|
|
3907
|
+
`;
|
|
3908
|
+
break;
|
|
3909
|
+
}
|
|
3863
3910
|
}
|
|
3864
3911
|
return rStr;
|
|
3865
3912
|
}
|
|
@@ -3882,13 +3929,11 @@ module ${volum.outName} () {
|
|
|
3882
3929
|
}
|
|
3883
3930
|
getOneInherit(inherit) {
|
|
3884
3931
|
const rStr = `
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
${inherit.subdesign}();
|
|
3891
|
-
}
|
|
3932
|
+
IVR1_${inherit.subdesign} = ${inherit.subdesign}.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), ${radToDeg(inherit.rotate[0])})
|
|
3933
|
+
IVR2_${inherit.subdesign} = IVR1_${inherit.subdesign}.rotate(App.Vector(0, 0, 0), App.Vector(0, 1, 0), ${radToDeg(inherit.rotate[1])})
|
|
3934
|
+
IVR3_${inherit.subdesign} = IVR2_${inherit.subdesign}.rotate(App.Vector(0, 0, 0), App.Vector(0, 0, 1), ${radToDeg(inherit.rotate[2])})
|
|
3935
|
+
${inherit.outName} = IVR3_${inherit.subdesign}.translate(App.Vector(${inherit.translate[0]}, ${inherit.translate[1]}, ${inherit.translate[2]}))
|
|
3936
|
+
|
|
3892
3937
|
`;
|
|
3893
3938
|
return rStr;
|
|
3894
3939
|
}
|
|
@@ -3917,12 +3962,17 @@ module ${inherit.outName} () {
|
|
|
3917
3962
|
}
|
|
3918
3963
|
getFooter(partName) {
|
|
3919
3964
|
const rStr = `
|
|
3920
|
-
pax_${partName}()
|
|
3965
|
+
pax_${partName}.check()
|
|
3966
|
+
#pax_${partName}.exportBrep(f"{outFileName}.brep")
|
|
3967
|
+
#pax_${partName}.exportIges(f"{outFileName}.igs")
|
|
3968
|
+
#pax_${partName}.exportStep(f"{outFileName}.stp")
|
|
3969
|
+
pax_${partName}.exportStl(f"{outFileName}.stl")
|
|
3970
|
+
|
|
3921
3971
|
`;
|
|
3922
3972
|
return rStr;
|
|
3923
3973
|
}
|
|
3924
3974
|
getExportFile(pax) {
|
|
3925
|
-
let rStr = this.getHeader();
|
|
3975
|
+
let rStr = this.getHeader(pax.partName);
|
|
3926
3976
|
rStr += this.getAllFigures(pax.figures, pax.partName);
|
|
3927
3977
|
rStr += this.getVolume(pax.volume);
|
|
3928
3978
|
rStr += this.getFooter(pax.partName);
|
|
@@ -4596,6 +4646,7 @@ export {
|
|
|
4596
4646
|
linePP,
|
|
4597
4647
|
makeCorner,
|
|
4598
4648
|
mergeFaces,
|
|
4649
|
+
midArcPoint,
|
|
4599
4650
|
oneDesignParam,
|
|
4600
4651
|
orientedArc,
|
|
4601
4652
|
pCheckbox,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geometrix",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.41",
|
|
4
4
|
"description": "The 2D geometry engine of the parametrix",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -67,15 +67,15 @@
|
|
|
67
67
|
"json5": "^2.2.3"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@types/node": "^20.
|
|
70
|
+
"@types/node": "^20.14.0",
|
|
71
71
|
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
72
72
|
"@typescript-eslint/parser": "^7.0.1",
|
|
73
73
|
"eslint": "^8.57.0",
|
|
74
74
|
"eslint-config-prettier": "^9.1.0",
|
|
75
75
|
"npm-run-all": "^4.1.5",
|
|
76
|
-
"prettier": "^3.
|
|
76
|
+
"prettier": "^3.3.0",
|
|
77
77
|
"shx": "^0.3.4",
|
|
78
|
-
"tsup": "^8.0
|
|
78
|
+
"tsup": "^8.1.0",
|
|
79
79
|
"typescript": "^5.4.5",
|
|
80
80
|
"vitest": "^1.6.0"
|
|
81
81
|
}
|