geometrix 0.5.41 → 0.5.42

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -12
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -3703,8 +3703,9 @@ function fcFaceContour(paxCtr, outName) {
3703
3703
  let px1 = 0;
3704
3704
  let py1 = 0;
3705
3705
  let pIdx = 0;
3706
+ let pIdxLast = 0;
3706
3707
  let sIdx = 0;
3707
- for (const seg of paxCtr) {
3708
+ for (const [segIdx, seg] of paxCtr.entries()) {
3708
3709
  if (seg.typ === 0 /* eStart */) {
3709
3710
  rStr += ` P${fid(pIdx)} = App.Vector(${ff6(seg.px)}, ${ff6(seg.py)}, 0)
3710
3711
  `;
@@ -3712,7 +3713,12 @@ function fcFaceContour(paxCtr, outName) {
3712
3713
  } else if (seg.typ === 1 /* eStroke */) {
3713
3714
  rStr += ` P${fid(pIdx)} = App.Vector(${ff6(seg.px)}, ${ff6(seg.py)}, 0)
3714
3715
  `;
3715
- rStr += ` S${fid(sIdx)} = Part.LineSegment(P${fid(pIdx - 1)}, P${fid(pIdx)})
3716
+ if (segIdx < paxCtr.length - 1) {
3717
+ pIdxLast = pIdx;
3718
+ } else {
3719
+ pIdxLast = 0;
3720
+ }
3721
+ rStr += ` S${fid(sIdx)} = Part.LineSegment(P${fid(pIdx - 1)}, P${fid(pIdxLast)})
3716
3722
  `;
3717
3723
  pIdx += 1;
3718
3724
  sIdx += 1;
@@ -3728,7 +3734,12 @@ function fcFaceContour(paxCtr, outName) {
3728
3734
  }
3729
3735
  rStr += ` P${fid(pIdx)} = App.Vector(${ff6(seg.px)}, ${ff6(seg.py)}, 0)
3730
3736
  `;
3731
- rStr += ` S${fid(sIdx)} = Part.Arc(P${fid(pIdx - 2)}, P${fid(pIdx - 1)}, P${fid(pIdx)})
3737
+ if (segIdx < paxCtr.length - 1) {
3738
+ pIdxLast = pIdx;
3739
+ } else {
3740
+ pIdxLast = 0;
3741
+ }
3742
+ rStr += ` S${fid(sIdx)} = Part.Arc(P${fid(pIdx - 2)}, P${fid(pIdx - 1)}, P${fid(pIdxLast)})
3732
3743
  `;
3733
3744
  pIdx += 1;
3734
3745
  sIdx += 1;
@@ -3861,10 +3872,10 @@ print(f"outFileName: {outFileName}")
3861
3872
  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
3873
  }
3863
3874
  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]}))
3875
+ VR1 = VEX.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), ${ff6(radToDeg(extrud.rotate[0]))})
3876
+ VR2 = VR1.rotate(App.Vector(0, 0, 0), App.Vector(0, 1, 0), ${ff6(radToDeg(extrud.rotate[1]))})
3877
+ VR3 = VR2.rotate(App.Vector(0, 0, 0), App.Vector(0, 0, 1), ${ff6(radToDeg(extrud.rotate[2]))})
3878
+ VFP = VR3.translate(App.Vector(${ff6(extrud.translate[0])}, ${ff6(extrud.translate[1])}, ${ff6(extrud.translate[2])}))
3868
3879
  return VFP
3869
3880
  ${extrud.outName} = fex_${extrud.outName}()
3870
3881
 
@@ -3928,11 +3939,13 @@ ${extrud.outName} = fex_${extrud.outName}()
3928
3939
  return rGeoms;
3929
3940
  }
3930
3941
  getOneInherit(inherit) {
3931
- const rStr = `
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]}))
3942
+ const rStr = `def finh_${inherit.outName}():
3943
+ IVR1 = ${inherit.subdesign}.rotate(App.Vector(0, 0, 0), App.Vector(1, 0, 0), ${ff6(radToDeg(inherit.rotate[0]))})
3944
+ IVR2 = IVR1.rotate(App.Vector(0, 0, 0), App.Vector(0, 1, 0), ${ff6(radToDeg(inherit.rotate[1]))})
3945
+ IVR3 = IVR2.rotate(App.Vector(0, 0, 0), App.Vector(0, 0, 1), ${ff6(radToDeg(inherit.rotate[2]))})
3946
+ IVF = IVR3.translate(App.Vector(${ff6(inherit.translate[0])}, ${ff6(inherit.translate[1])}, ${ff6(inherit.translate[2])}))
3947
+ return IVF
3948
+ ${inherit.outName} = finh_${inherit.outName}()
3936
3949
 
3937
3950
  `;
3938
3951
  return rStr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geometrix",
3
- "version": "0.5.41",
3
+ "version": "0.5.42",
4
4
  "description": "The 2D geometry engine of the parametrix",
5
5
  "private": false,
6
6
  "repository": {
@@ -67,7 +67,7 @@
67
67
  "json5": "^2.2.3"
68
68
  },
69
69
  "devDependencies": {
70
- "@types/node": "^20.14.0",
70
+ "@types/node": "^20.14.1",
71
71
  "@typescript-eslint/eslint-plugin": "^7.0.1",
72
72
  "@typescript-eslint/parser": "^7.0.1",
73
73
  "eslint": "^8.57.0",