mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-08 09:24:18 +01:00
162 lines
No EOL
30 KiB
JavaScript
162 lines
No EOL
30 KiB
JavaScript
import * as test from '../../test'
|
|
|
|
export default {
|
|
|
|
testVertCoi: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:3', {"layers":[{"name":"sketch","data":[
|
|
{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,250]],[31,[32,-169.15430109914888],[33,24.438723388262304]]],"children":[34]},
|
|
{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-169.15430109914888],[37,24.438723388262304]],[38,[39,-44.56473088447832],[40,170.1126824084925]]],"children":[41]},
|
|
{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-44.56473088447832],[44,170.1126824084925]],[45,[46,-250],[47,250]]],"children":[48]}]}]} );
|
|
|
|
cut(app, '0:3', 50);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,24.438723388262304,-169.15430109914888],[-250,170.1126824084925,-44.56473088447832],[-250,250,-250],[-250,250,250],[-200,24.438723388262304,-169.15430109914888],[-200,170.1126824084925,-44.56473088447832],[-200,250,-250],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[9,10,1,0]],[[11,12,10,9]],[[4,5,12,11,8]],[[4,3,2,4,0,1,5]],[[5,1,10,12]],[[0,4,8,11,9]],[[4,2,6,8]],[[2,3,7,6]],[[3,4,8,7]],[[6,7,8]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
testMCUT_2ECUT_MCUT: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":83,"_class":"TCAD.TWO.Segment","points":[[77,[78,-148.94075535101177],[79,-17.236467236467238]],[80,[81,-148.94075535101177],[82,173.69055445978523]]],"children":[83]},{"id":62,"_class":"TCAD.TWO.Segment","points":[[56,[57,-148.94075535101177],[58,173.69055445978523]],[59,[60,154.2442837314632],[61,173.69055445978523]]],"children":[62]},{"id":69,"_class":"TCAD.TWO.Segment","points":[[63,[64,154.2442837314632],[65,173.69055445978523]],[66,[67,154.2442837314632],[68,-17.236467236467238]]],"children":[69]},{"id":76,"_class":"TCAD.TWO.Segment","points":[[70,[71,154.2442837314632],[72,-17.236467236467238]],[73,[74,-148.94075535101177],[75,-17.236467236467238]]],"children":[76]}]}]} );
|
|
cut(app, '0:2', 500);
|
|
setSketch(win, app, '0:1', {"layers":[{"name":"sketch","data":[{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,250],[44,250]],[45,[46,45.42896723585416],[47,250]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,45.42896723585416],[51,250]],[52,[53,45.42896723585416],[54,57.176503480539594]]],"children":[55]},{"id":62,"_class":"TCAD.TWO.Segment","points":[[56,[57,45.42896723585416],[58,57.176503480539594]],[59,[60,250],[61,57.176503480539594]]],"children":[62]},{"id":69,"_class":"TCAD.TWO.Segment","points":[[63,[64,250],[65,57.176503480539594]],[66,[67,250],[68,250]]],"children":[69]}]}]});
|
|
cut(app, '0:1', 500);
|
|
setSketch(win, app, '2:0', {"layers":[{"name":"sketch","data":[{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-379.56770796200084],[51,-40.45650878155793]],[52,[53,-5.818373610536707],[54,-40.45650878155793]]],"children":[55]},{"id":62,"_class":"TCAD.TWO.Segment","points":[[56,[57,-5.818373610536707],[58,-40.45650878155793]],[59,[60,-5.818373610536707],[61,-354.50976889632983]]],"children":[62]},{"id":69,"_class":"TCAD.TWO.Segment","points":[[63,[64,-5.818373610536707],[65,-354.50976889632983]],[66,[67,-379.56770796200084],[68,-354.50976889632983]]],"children":[69]},{"id":76,"_class":"TCAD.TWO.Segment","points":[[70,[71,-379.56770796200084],[72,-354.50976889632983]],[73,[74,-379.56770796200084],[75,-40.45650878155793]]],"children":[76]}]}]});
|
|
cut(app, '2:0', 500);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,5.818373610536696],[-250,-40.45650878155794,250],[-250,-40.45650878155793,5.818373610536707],[-250,57.176503480539594,-250],[-250,57.176503480539594,-45.42896723585416],[-250,250,-45.42896723585416],[-250,250,250],[-154.2442837314632,-250,-17.236467236467238],[-154.2442837314632,-250,5.818373610536707],[-154.2442837314632,-40.45650878155794,173.69055445978523],[-154.2442837314632,-40.45650878155793,5.818373610536707],[-154.2442837314632,250,-17.236467236467238],[-154.2442837314632,250,173.69055445978523],[148.94075535101177,-250,-17.236467236467238],[148.94075535101177,-250,5.818373610536707],[148.94075535101177,-40.45650878155794,173.69055445978523],[148.94075535101177,-40.45650878155793,5.818373610536707],[148.94075535101177,250,-17.236467236467238],[148.94075535101177,250,173.69055445978523],[250,-250,-250],[250,-250,5.818373610536696],[250,-40.45650878155794,250],[250,-40.45650878155793,5.818373610536707],[250,57.176503480539594,-250],[250,57.176503480539594,-45.42896723585416],[250,250,-45.42896723585416],[250,250,250]],"faces":[[[9,1,0,20,21,15,14,8]],[[23,21,20,24,25,26,27,22]],[[27,26,6,7],[13,12,18,19]],[[1,3,2,7,6,5,4,0]],[[2,22,27,7]],[[0,4,24,20]],[[8,14,18,12]],[[10,11,9,8,12,13]],[[16,10,13,19]],[[17,16,19,18,14,15]],[[6,26,25,5]],[[5,25,24,4]],[[17,15,21,23]],[[9,11,3,1]],[[23,22,2,3,11,10,16,17]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
test_TR_OUT_TR_KISS: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,199.9768703670335],[30,225.00201188826748]],[31,[32,208.9483140098693],[33,-207.18004219340503]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,208.9483140098693],[37,-207.18004219340503]],[38,[39,291.47622363115545],[40,28.544413377534887]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,291.47622363115545],[44,28.544413377534887]],[45,[46,199.9768703670335],[47,225.00201188826748]]],"children":[48]}]}]} );
|
|
cut(app, '0:2', 500);
|
|
setSketch(win, app, '0:3', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,250]],[31,[32,-169.15430109914888],[33,24.438723388262304]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-169.15430109914888],[37,24.438723388262304]],[38,[39,-44.56473088447832],[40,170.1126824084925]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-44.56473088447832],[44,170.1126824084925]],[45,[46,-250],[47,250]]],"children":[48]}]}]});
|
|
cut(app, '0:3', 500);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,-89.92411780734957],[-250,-250,117.59771265441589],[-250,-250,250],[-250,24.438723388262304,-169.15430109914888],[-250,117.07709154482764,-89.9241178073496],[-250,187.75152195374028,-89.9241178073496],[-250,250,-250],[-250,250,-89.92411780734957],[-250,250,117.59771265441589],[-250,250,250],[-222.26125142532885,24.438723388262304,-169.15430109914888],[-208.9483140098693,-250,-207.18004219340503],[-208.9483140098693,130.53137670117144,-207.18004219340503],[-208.9483140098693,233.34866460234332,-207.18004219340503],[-208.9483140098693,250,-207.18004219340503],[-208.15895732561484,24.438723388262304,-169.15430109914888],[-205.5726669021471,170.1126824084925,-44.56473088447832],[-199.9768703670335,-250,225.00201188826748],[-199.9768703670335,250,225.00201188826748],[250,-250,-250],[250,-250,250],[250,24.438723388262304,-169.15430109914888],[250,170.1126824084925,-44.56473088447832],[250,250,-250],[250,250,250]],"faces":[[[3,2,18,12,1,0,20,21]],[[23,24,25,21,20,24,22]],[[15,19,9,10,25,24,7,8]],[[4,7,0,1,5]],[[7,6,8]],[[3,10,9,2]],[[25,10,3,21]],[[20,0,7,24]],[[14,17,16,13,12,18,19,15]],[[6,14,15,8]],[[11,5,1,12,13]],[[18,2,9,19]],[[11,13,16,22,24,7,4]],[[5,11,4]],[[16,17,23,22]],[[14,6,7,24,23,17]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
test_TR_OUT_TR_INNER: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,218.33407620133045],[44,-20.527135369355864]],[45,[46,-223.31035144238643],[47,-13.06272250777187]]],"children":[48]},{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-223.31035144238643],[30,-13.06272250777187]],[31,[32,-5.598309646187954],[33,495.76142089020044]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-5.598309646187954],[37,495.76142089020044]],[38,[39,218.33407620133045],[40,-20.527135369355864]]],"children":[41]}]}]});
|
|
cut(app, '0:2', 500);
|
|
setSketch(win, app, '1:3', {"layers":[{"name":"sketch","data":[{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-472.1057825646785],[44,-293.4697818232062]],[45,[46,20.80092487041237],[47,30.9464504729465]]],"children":[48]},{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,20.80092487041237],[30,30.9464504729465]],[31,[32,359.90906163964087],[33,-79.21779295049502]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,359.90906163964087],[37,-79.21779295049502]],[38,[39,-472.1057825646785],[40,-293.4697818232062]]],"children":[41]}]}]});
|
|
cut(app, '1:3', 50);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,250,-250],[-250,250,250],[-218.33407620133045,-250,-20.527135369355864],[-218.33407620133045,250,-20.527135369355864],[-100.99700543871825,-250,250],[-100.99700543871825,250,250],[110.75295183637142,-123.92982319147082,250],[110.75295183637142,-22.81078696591853,250],[110.75295183637147,-250,250],[110.7529518363715,250,250],[165.1375816702817,-15.860748783049338,250],[165.13758167028172,-129.43889625756046,249.99999999999994],[175.84726740609295,30.94645047294649,97.86528532562242],[221.8161377952996,30.94645047294649,117.53411739924385],[223.31035144238643,-250,-13.06272250777187],[223.31035144238643,-197.6114609132843,-13.06272250777187],[223.31035144238643,-48.46538501303118,-13.06272250777187],[223.31035144238643,250,-13.06272250777187],[250,-250,-250],[250,-250,250],[250,-215.08287570101115,-75.44024399385171],[250,-184.99101442530412,51.6644051608298],[250,-93.12059491922011,-75.44024399385171],[250,-16.208770773268906,51.66440516082979],[250,250,-250],[250,250,250]],"faces":[[[10,16,4,6,1,0,20,21]],[[20,26,27,21],[23,25,24,22]],[[7,5,19,11,27,26,2,3]],[[2,0,1,3]],[[12,13,8,10,21,27,11,9]],[[1,6,7,3]],[[20,0,2,26]],[[5,7,6,4]],[[14,9,11,19,18]],[[8,17,16,10]],[[22,24,18,17]],[[17,18,19,5,4,16]],[[8,13,23,22,17]],[[12,9,14,15]],[[24,25,15,14,18]],[[13,12,15,25,23]]]});
|
|
env.done()
|
|
}));
|
|
},
|
|
|
|
test_COMPLEX_NEW_EDGE_SHOULD_SPLIT: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,-250]],[31,[32,250],[33,-250]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,250],[37,-250]],[38,[39,250],[40,15.803508066603925]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,250],[44,15.803508066603925]],[45,[46,-250],[47,15.803508066603925]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-250],[51,15.803508066603925]],[52,[53,-250],[54,-250]]],"children":[55]}]}]});
|
|
cut(app, '0:2', 250);
|
|
setSketch(win, app, '1:2', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-111.52761407003341],[30,-97.98175001294433]],[31,[32,164.8080126945838],[33,-97.98175001294433]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,164.8080126945838],[37,-97.98175001294433]],[38,[39,164.8080126945838],[40,137.7162845804056]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,164.8080126945838],[44,137.7162845804056]],[45,[46,-111.52761407003341],[47,137.7162845804056]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-111.52761407003341],[51,137.7162845804056]],[52,[53,-111.52761407003341],[54,-97.98175001294433]]],"children":[55]}]}]});
|
|
cut(app, '1:2', 500);
|
|
setSketch(win, app, '0:1', {"layers":[{"name":"sketch","data":[{"id":90,"_class":"TCAD.TWO.Segment","points":[[84,[85,-161.44392703336717],[86,47.214733377682855]],[87,[88,-250],[89,250]]],"children":[90]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-250],[44,250]],[45,[46,-165.25156682188998],[47,175.15143027204928]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-165.25156682188998],[51,175.15143027204928]],[52,[53,-15.803508066603925],[54,250]]],"children":[55]},{"id":62,"_class":"TCAD.TWO.Segment","points":[[56,[57,-15.803508066603925],[58,250]],[59,[60,-91.38335492454746],[61,57.11459682784216]]],"children":[62]},{"id":69,"_class":"TCAD.TWO.Segment","points":[[63,[64,-91.38335492454746],[65,57.11459682784216]],[66,[67,-15.803508066603925],[68,0]]],"children":[69]},{"id":76,"_class":"TCAD.TWO.Segment","points":[[70,[71,-15.803508066603925],[72,0]],[73,[74,-250],[75,-250]]],"children":[76]},{"id":83,"_class":"TCAD.TWO.Segment","points":[[77,[78,-250],[79,-250]],[80,[81,-161.44392703336717],[82,47.214733377682855]]],"children":[83]}]}]});
|
|
cut(app, '0:1', 500);
|
|
// here a new edge should split
|
|
win.__DEBUG__.AddPoint(0,250,15.803508066603925)
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,0,-250],[-250,0,15.803508066603925],[-250,47.214733377682855,161.44392703336717],[-250,57.11459682784216,91.38335492454746],[-250,175.15143027204928,165.25156682188998],[-250,250,15.803508066603925],[-250,250,250],[-164.8080126945838,-250,-97.98175001294433],[-164.8080126945838,-250,137.7162845804056],[-164.8080126945838,-130.13941360453094,137.7162845804056],[-164.8080126945838,0,-97.98175001294433],[-164.8080126945838,0,15.803508066603925],[111.5276140700334,0,15.803508066603925],[111.52761407003341,-250,-97.98175001294433],[111.52761407003341,-250,137.7162845804056],[111.52761407003341,-130.13941360453094,137.7162845804056],[111.52761407003341,0,-97.98175001294433],[250,-250,-250],[250,-250,250],[250,0,-250],[250,0,15.803508066603925],[250,47.214733377682855,161.44392703336717],[250,57.11459682784216,91.38335492454746],[250,175.15143027204928,165.25156682188998],[250,250,15.803508066603925],[250,250,250]],"faces":[[[1,0,19,20],[10,16,15,9]],[[23,27,20]],[[27,25,26]],[[26,24,22]],[[22,20,19,21]],[[8,27,26,7]],[[8,4,1]],[[6,8,7]],[[5,7,3]],[[1,3,2,0]],[[20,27,8,1]],[[19,0,2,21]],[[22,14,13,3,7,26]],[[3,13,12,18,14,22,21,2]],[[12,9,15,18]],[[13,11,10,9,12]],[[11,17,16,10]],[[17,14,18,15,16]],[[23,20,1,4]],[[14,17,11,13,3,1,20,22]],[[13,14,22,24,5,3]],[[24,26,7,5]],[[26,25,6,7]],[[25,27,8,6]],[[27,23,4,8]]]});
|
|
|
|
//add extra cut with corner case
|
|
setSketch(win, app, '0:4', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,250]],[31,[32,-79.19890760127447],[33,18.27667098490949]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-79.19890760127447],[37,18.27667098490949]],[38,[39,-250],[40,-250]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-250],[44,-250]],[45,[46,127.93669689436645],[47,-17.515143027204928]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,127.93669689436645],[51,-17.515143027204928]],[52,[53,-250],[54,250]]],"children":[55]}]}]});
|
|
cut(app, '0:4', 500);
|
|
assertScene(app, env,{"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,0,-250],[-250,0,15.803508066603925],[-250,47.214733377682855,161.44392703336717],[-250,57.11459682784216,91.38335492454746],[-250,175.15143027204928,165.25156682188998],[-250,250,15.803508066603925],[-250,250,250],[-194.82982128578166,175.15143027204928,165.25156682188998],[-164.8080126945838,-250,-97.98175001294433],[-164.8080126945838,-250,137.7162845804056],[-164.8080126945838,-197.5948031861442,-97.98175001294433],[-164.8080126945838,-197.5948031861442,137.7162845804056],[-164.8080126945838,-116.18924722371236,-97.98175001294433],[-164.8080126945838,-116.18924722371234,124.64796446730595],[-164.8080126945838,0,-97.98175001294433],[-164.8080126945838,0,15.803508066603925],[-144.25637408730685,175.15143027204928,165.25156682188998],[-107.82597846491458,57.11459682784216,91.38335492454746],[-100.52888197026124,47.214733377682855,161.44392703336717],[-90.83493751835296,0,-250],[-90.83493751835296,0,-97.98175001294433],[-90.83493751835294,0,15.803508066603925],[-79.19890760127447,18.27667098490949,15.80350806660391],[-79.19890760127447,18.27667098490949,39.989059061145895],[-79.19890760127447,18.27667098490949,170.06611455295752],[-79.19890760127447,18.27667098490949,250],[-55.14982911155237,-130.13941360453092,137.7162845804056],[22.502226711741912,57.11459682784216,91.38335492454746],[36.48843194004928,47.214733377682855,161.44392703336717],[103.19187225966874,0,15.803508066603925],[103.1918722596688,0,-250],[103.1918722596688,0,-97.98175001294433],[111.5276140700334,0,15.803508066603925],[111.52761407003341,-250,-97.98175001294433],[111.52761407003341,-250,137.7162845804056],[111.52761407003341,-130.13941360453094,137.7162845804056],[111.52761407003341,-27.60906432359619,41.667292107202755],[111.52761407003341,-27.609064323596158,-97.98175001294433],[111.52761407003341,-5.900292776440324,21.330819545093046],[111.52761407003341,-5.900292776440267,-97.98175001294433],[111.52761407003341,0,-97.98175001294433],[127.93669689436645,-17.515143027204928,-250],[127.93669689436645,-17.515143027204928,32.21144827733622],[127.93669689436645,-17.515143027204928,180.73039911666126],[127.93669689436645,-17.515143027204928,250],[250,-250,-250],[250,-250,250],[250,0,-250],[250,0,15.803508066603925],[250,47.214733377682855,161.44392703336717],[250,57.11459682784216,91.38335492454746],[250,175.15143027204928,165.25156682188998],[250,250,15.803508066603925],[250,250,250]],"faces":[[[48,1,0,47],[10,11,36,35]],[[48,51,55]],[[54,55,53]],[[50,54,52]],[[49,50,48,47]],[[7,8,55,54]],[[1,8,4]],[[7,6,8]],[[3,5,7]],[[0,1,3,2]],[[8,46,1,48,55]],[[1,27,8]],[[21,0,2]],[[0,43,32,49,47]],[[31,7,54,50,34]],[[24,23,17,3,7]],[[32,33,42,34,50,49]],[[22,21,2,3,17,16]],[[33,41,42]],[[39,12,10,35]],[[14,22,16]],[[12,13,11,10]],[[15,14,16,17]],[[13,28,37,36,11]],[[41,40,34,42]],[[38,39,35,36,37]],[[45,30,51,48,1]],[[26,1,4,20]],[[40,44,38,37,28,1,48,50,34]],[[1,15,17,3]],[[29,31,34,50,52]],[[23,25,19,5,3,17]],[[7,29,52,54]],[[19,7,5]],[[18,7,54,53]],[[7,9,6]],[[8,18,53,55]],[[9,8,6]],[[30,8,55,51]],[[8,20,4]],[[8,27,26,20]],[[8,9,7]],[[7,19,25,24]],[[25,23,24]],[[15,1,0,21,22,14]],[[1,26,27]],[[12,39,38,44,43,0,1,28,13]],[[45,1,46]],[[8,30,45,46]],[[18,8,7]],[[29,7,31]],[[44,40,41,33,32,43]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
test_INWARD_TAPER: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-250],[51,-250]],[52,[53,-250],[54,250]]],"children":[55]},{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,250]],[31,[32,250],[33,250]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,250],[37,250]],[38,[39,250],[40,-250]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,250],[44,-250]],[45,[46,-250],[47,-250]]],"children":[48]}]}]});
|
|
cut(app, '0:2', 250, 0.1);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,250,-250],[-250,250,250],[-25,0,-25],[-25,0,25],[25,0,-25],[25,0,25],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[8,9,1,0]],[[10,11,9,8]],[[0,1,3,2]],[[3,1,9,11]],[[0,2,10,8]],[[10,2,4,6]],[[2,3,5,4]],[[3,11,7,5]],[[11,10,6,7]],[[5,7,6,4]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
test_MANY_FACES_FOR_EDGE: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,250]],[31,[32,-117.53266697380634],[33,-64.541059898911]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-117.53266697380634],[37,-64.541059898911]],[38,[39,250],[40,-250]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,250],[44,-250]],[45,[46,128.40274021993872],[47,53.670986652778616]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,128.40274021993872],[51,53.670986652778616]],[52,[53,-250],[54,250]]],"children":[55]}]}]});
|
|
cut(app, '0:2', 500);
|
|
setSketch(win, app, '1:2', {"layers":[{"name":"sketch","data":[{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-197.39904477522555],[51,-230.98501085780566]],[52,[53,-117.53266697380634],[54,-64.541059898911]]],"children":[55]},{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-117.53266697380634],[30,-64.541059898911]],[31,[32,-108.60525475478379],[33,-208.45524324067867]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-108.60525475478379],[37,-208.45524324067867]],[38,[39,250],[40,-250]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,250],[44,-250]],[45,[46,-197.39904477522555],[47,-230.98501085780566]]],"children":[48]}]}]});
|
|
cut(app, '1:2', 500);
|
|
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,250,-250],[108.60525475478379,-250,-208.45524324067867],[108.60525475478379,250,-208.45524324067867],[117.53266697380634,-250,-64.541059898911],[117.53266697380634,250,-64.541059898911],[197.39904477522555,-250,-230.98501085780566],[197.39904477522555,250,-230.98501085780566],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[4,6,0,8,9]],[[2,4,0]],[[8,10,11,9]],[[7,5,11,10,1]],[[5,3,1]],[[8,0,1,10]],[[9,11,5,4]],[[4,5,1,0]],[[7,1,0,6]],[[1,3,2,0]],[[3,5,4,2]],[[5,7,6,4]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
test_MANY_FACES_FOR_EDGE_2: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:4', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-250],[30,250]],[31,[32,-224.87464027936358],[33,-219.43960365629738]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,-224.87464027936358],[37,-219.43960365629738]],[38,[39,-178.67682898330096],[40,-207.21077125439845]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,-178.67682898330096],[44,-207.21077125439845]],[45,[46,-250],[47,250]]],"children":[48]},{"id":62,"_class":"TCAD.TWO.Segment","points":[[56,[57,-250],[58,250]],[59,[60,-146.06660924490384],[61,-197.69945716403262]]],"children":[62]},{"id":69,"_class":"TCAD.TWO.Segment","points":[[63,[64,-146.06660924490384],[65,-197.69945716403262]],[66,[67,-98.51003879307467],[68,-177.31806982753443]]],"children":[69]},{"id":76,"_class":"TCAD.TWO.Segment","points":[[70,[71,-98.51003879307467],[72,-177.31806982753443]],[73,[74,-250],[75,250]]],"children":[76]},{"id":83,"_class":"TCAD.TWO.Segment","points":[[77,[78,-250],[79,250]],[80,[81,-50.953468341245525],[82,-162.3717191141024]]],"children":[83]},{"id":90,"_class":"TCAD.TWO.Segment","points":[[84,[85,-50.953468341245525],[86,-162.3717191141024]],[87,[88,-4.755657045182915],[89,-132.47901768723835]]],"children":[90]},{"id":97,"_class":"TCAD.TWO.Segment","points":[[91,[92,-4.755657045182915],[93,-132.47901768723835]],[94,[95,-250],[96,250]]],"children":[97]},{"id":104,"_class":"TCAD.TWO.Segment","points":[[98,[99,-250],[100,250]],[101,[102,40.08339509511315],[103,-99.86879794884122]]],"children":[104]},{"id":111,"_class":"TCAD.TWO.Segment","points":[[105,[106,40.08339509511315],[107,-99.86879794884122]],[108,[109,88.99872470270884],[110,-42.80091340664624]]],"children":[111]},{"id":118,"_class":"TCAD.TWO.Segment","points":[[112,[113,88.99872470270884],[114,-42.80091340664624]],[115,[116,-250],[117,250]]],"children":[118]},{"id":125,"_class":"TCAD.TWO.Segment","points":[[119,[120,-250],[121,250]],[122,[123,124.32646275263907],[124,7.47317535671601]]],"children":[125]},{"id":132,"_class":"TCAD.TWO.Segment","points":[[126,[127,124.32646275263907],[128,7.47317535671601]],[129,[130,152.86040502373658],[131,69.97609652197718]]],"children":[132]},{"id":139,"_class":"TCAD.TWO.Segment","points":[[133,[134,152.86040502373658],[135,69.97609652197718]],[136,[137,-250],[138,250]]],"children":[139]},{"id":146,"_class":"TCAD.TWO.Segment","points":[[140,[141,-250],[142,250]],[143,[144,161.01295995833584],[145,121.60894444110598]]],"children":[146]},{"id":153,"_class":"TCAD.TWO.Segment","points":[[147,[148,161.01295995833584],[149,121.60894444110598]],[150,[151,165.0892374256355],[152,192.26442054096643]]],"children":[153]},{"id":160,"_class":"TCAD.TWO.Segment","points":[[154,[155,165.0892374256355],[156,192.26442054096643]],[157,[158,-250],[159,250]]],"children":[160]}]}]});
|
|
cut(app, '0:4', 500);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,250,-250],[-250,250,250],[-224.87464027936358,-219.43960365629738,-250],[-224.87464027936358,-219.43960365629738,250],[-178.67682898330096,-207.21077125439845,-250],[-178.67682898330096,-207.21077125439845,250],[-146.06660924490384,-197.69945716403262,-250],[-146.06660924490384,-197.69945716403262,250],[-98.51003879307467,-177.31806982753443,-250],[-98.51003879307467,-177.31806982753443,250],[-50.953468341245525,-162.3717191141024,-250],[-50.953468341245525,-162.3717191141024,250],[-4.755657045182915,-132.47901768723835,-250],[-4.755657045182915,-132.47901768723835,250],[40.08339509511315,-99.86879794884122,-250],[40.08339509511315,-99.86879794884122,250],[88.99872470270884,-42.80091340664624,-250],[88.99872470270884,-42.80091340664624,250],[124.32646275263907,7.47317535671601,-250],[124.32646275263907,7.47317535671601,250],[152.86040502373658,69.97609652197718,-250],[152.86040502373658,69.97609652197718,250],[161.01295995833584,121.60894444110598,-250],[161.01295995833584,121.60894444110598,250],[165.0892374256355,192.26442054096643,-250],[165.0892374256355,192.26442054096643,250],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[28,29,1,0]],[[30,31,29,28]],[[2,3,31,30]],[[0,1,3,2]],[[15,13,3,11,9,3,7,5,3,1,29,31,3,27,25,3,23,21,3,19,17,3]],[[12,14,2,16,18,2,20,22,2,24,26,2,30,28,0,2,4,6,2,8,10,2]],[[3,5,4,2]],[[5,7,6,4]],[[7,3,2,6]],[[3,9,8,2]],[[9,11,10,8]],[[11,3,2,10]],[[3,13,12,2]],[[13,15,14,12]],[[15,3,2,14]],[[3,17,16,2]],[[17,19,18,16]],[[19,3,2,18]],[[3,21,20,2]],[[21,23,22,20]],[[23,3,2,22]],[[3,25,24,2]],[[25,27,26,24]],[[27,3,2,26]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
|
|
test_NESTED_FACES: function(env) {
|
|
test.emptyModeller(env.test((win, app) => {
|
|
app.actionManager.actions['BOX'].invoke(app);
|
|
app.ui.registeredWizard.okClick();
|
|
setSketch(win, app, '0:2', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-150],[30,150]],[31,[32,150],[33,150]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,150],[37,150]],[38,[39,150],[40,-150]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,150],[44,-150]],[45,[46,-150],[47,-150]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-150],[51,-150]],[52,[53,-150],[54,150]]],"children":[55]}]}]} );
|
|
setSketch(win, app, '0:0', {"layers":[{"name":"sketch","data":[{"id":34,"_class":"TCAD.TWO.Segment","points":[[28,[29,-220],[30,220]],[31,[32,0],[33,220]]],"children":[34]},{"id":41,"_class":"TCAD.TWO.Segment","points":[[35,[36,0],[37,220]],[38,[39,0],[40,0]]],"children":[41]},{"id":48,"_class":"TCAD.TWO.Segment","points":[[42,[43,0],[44,0]],[45,[46,-220],[47,0]]],"children":[48]},{"id":55,"_class":"TCAD.TWO.Segment","points":[[49,[50,-220],[51,0]],[52,[53,-220],[54,220]]],"children":[55]}]}]} );
|
|
extrude(app, '0:2', 50);
|
|
cut(app, '0:0', 500);
|
|
assertScene(app, env, {"format":"LOOPS","vertices":[[-250,-250,-250],[-250,-250,250],[-250,250,-250],[-250,250,250],[-220,-250,0],[-220,-250,220],[-220,250,0],[-220,250,220],[-150,250,-150],[-150,250,0],[-150,250,150],[-150,300,-150],[-150,300,150],[0,-250,0],[0,-250,220],[0,250,0],[0,250,150],[0,250,220],[150,250,-150],[150,250,150],[150,300,-150],[150,300,150],[250,-250,-250],[250,-250,250],[250,250,-250],[250,250,250]],"faces":[[[0,22,23,1],[5,14,13,4]],[[22,24,25,23]],[[2,3,25,24],[17,7,6,9,8,18,19,16]],[[15,16,10,9]],[[2,0,1,3]],[[25,3,1,23]],[[22,0,2,24]],[[10,16,19,21,12]],[[9,10,12,11,8]],[[20,18,8,11]],[[21,19,18,20]],[[12,21,20,11]],[[5,4,6,7]],[[4,13,15,9,6]],[[13,14,17,16,15]],[[14,5,7,17]]]});
|
|
env.done();
|
|
}));
|
|
},
|
|
};
|
|
|
|
function cut(app, faceId, depth, prism) {
|
|
cutExtrude(app, faceId, depth, prism, true);
|
|
}
|
|
|
|
function extrude(app, faceId, depth, prism) {
|
|
cutExtrude(app, faceId, depth, prism, false);
|
|
}
|
|
|
|
function cutExtrude(app, faceId, depth, prism, cut) {
|
|
selectFace(app, faceId);
|
|
app.actionManager.actions[cut ? 'CUT' : 'EXTRUDE'].invoke(app);
|
|
app.ui.registeredWizard.setFormField('value', depth);
|
|
if (prism !== undefined) {
|
|
app.ui.registeredWizard.setFormField('prism', prism);
|
|
}
|
|
app.ui.registeredWizard.okClick();
|
|
}
|
|
|
|
function setSketch(win, app, faceId, data) {
|
|
win.localStorage.setItem(app.faceStorageKey(faceId), JSON.stringify(data));
|
|
app.refreshSketches();
|
|
}
|
|
|
|
function selectFace(app, faceId) {
|
|
app.bus.dispatch('selection_face', [faceId]);
|
|
}
|
|
|
|
function assertScene(app, env, expected) {
|
|
env.assertData(expected, app.TPI.brep.IO.toLoops(app.craft.solids[0].shell));
|
|
} |