@@ -502,6 +502,40 @@ def monitor_checkForChange(scene):
502
502
if props .submenu_assistant_advanced :
503
503
brokenC , brokenT , brokenS , brokenB = 0 , 0 , 0 , 0
504
504
505
+ ###### Initial pass for the Mohr-Coulomb theory to measure the pressure acting per element
506
+ objsForces = {}
507
+ objsConstCnts = {}
508
+ for connect in connects :
509
+ conMode = connect [12 ]
510
+
511
+ ### If connection is in fixed mode then check if first tolerance is reached
512
+ if conMode == 0 :
513
+ consts = connect [4 ]
514
+ if consts [0 ].rigid_body_constraint .use_breaking :
515
+ qMohrCoulomb = connect [16 ]
516
+
517
+ if qMohrCoulomb :
518
+ ### Determine force of the compressive constraints in connection
519
+ force = 0
520
+ for const in consts [:2 ]: # Only first two constraints can provide a compressive force for most CTs (except spring arrays)
521
+ con = const .rigid_body_constraint
522
+ ### For Point and Fixed costraints
523
+ ### For Generic constraints
524
+ # Compressive constraints
525
+ if con .type != 'GENERIC' \
526
+ or con .use_limit_lin_x :
527
+ forceCon = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
528
+ force += forceCon
529
+ # Summarize forces and add them to the forces list, also counting the number of connections
530
+ objA = connect [0 ][0 ]
531
+ objB = connect [1 ][0 ]
532
+ for obj in [objA , objB ]:
533
+ if obj not in objsForces : objsForces [obj ] = force
534
+ else : objsForces [obj ] += force
535
+ if obj not in objsConstCnts : objsConstCnts [obj ] = 1
536
+ else : objsConstCnts [obj ] += 1
537
+
538
+ ###### Main pass
505
539
d = 0 ; e = 0 ; cntP = 0 ; cntB = 0
506
540
for connect in connects :
507
541
conMode = connect [12 ]
@@ -582,10 +616,16 @@ def monitor_checkForChange(scene):
582
616
or con .use_limit_lin_x :
583
617
forceCon = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
584
618
force += forceCon
585
- # Compute new breaking threshold incease based on force
619
+ ### Get forces from the force list for both connected elements and divide it by the number of connections
620
+ forceA = objsForces [objA ] / objsConstCnts [objA ]
621
+ forceB = objsForces [objB ] / objsConstCnts [objB ]
622
+ #forceElem = min(forceA, forceB) # Use the smaller force and thus strength for the connection
623
+ forceElem = (forceA + forceB ) / 2 # Calculate average force and thus strength for the connection
624
+ force = (force + forceElem ) / 2 # Use also the average of the averaged force per element and the invididual constraint force
625
+ ### Compute new breaking threshold incease based on force
586
626
# σ = F /A
587
627
# τ = c +σ *tan(ϕ)
588
- brkThresInc = abs ( force ) / contactArea * 1 * mul
628
+ brkThresInc = force / contactArea * 1 * mul
589
629
# Modify constraints
590
630
for i in range (1 , len (consts )): # We know that first constraint is always pressure
591
631
con = consts [i ].rigid_body_constraint
@@ -862,6 +902,9 @@ def monitor_checkForChange_fm(scene):
862
902
if props .submenu_assistant_advanced :
863
903
brokenC , brokenT , brokenS , brokenB = 0 , 0 , 0 , 0
864
904
905
+ ###### Initial pass for the Mohr-Coulomb theory to measure the pressure acting per element
906
+ objsForces = {}
907
+ objsConstCnts = {}
865
908
c = 0
866
909
for connect in connects :
867
910
consts = connect [2 ]
@@ -871,6 +914,40 @@ def monitor_checkForChange_fm(scene):
871
914
### If connection is in fixed mode then check if first tolerance is reached
872
915
if conIntact :
873
916
if consts [0 ].use_breaking :
917
+ qMohrCoulomb = connect [6 ]
918
+
919
+ if qMohrCoulomb :
920
+ ### Determine force of the compressive constraints in connection
921
+ force = 0
922
+ for con in consts [:2 ]: # Only first two constraints can provide a compressive force for most CTs (except spring arrays)
923
+ ### For Point and Fixed costraints
924
+ ### For Generic constraints
925
+ # Compressive constraints
926
+ if con .type != 'GENERIC' \
927
+ or con .use_limit_lin_x :
928
+ forceCon = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
929
+ force += forceCon
930
+ # Summarize forces and add them to the forces list, also counting the number of connections
931
+ objA = connect [0 ][0 ]
932
+ objB = connect [1 ][0 ]
933
+ for obj in [objA , objB ]:
934
+ if obj not in objsForces : objsForces [obj ] = force
935
+ else : objsForces [obj ] += force
936
+ if obj not in objsConstCnts : objsConstCnts [obj ] = 1
937
+ else : objsConstCnts [obj ] += 1
938
+
939
+ ###### Main pass
940
+ c = 0
941
+ for connect in connects :
942
+ consts = connect [2 ]
943
+ conIntact = consIntact [c ]
944
+ c += 1
945
+
946
+ ### If connection is in fixed mode then check if first tolerance is reached
947
+ if conIntact :
948
+ if consts [0 ].use_breaking :
949
+ objA = connect [0 ][0 ]
950
+ objB = connect [1 ][0 ]
874
951
contactArea = connect [4 ]
875
952
constsBrkThres = connect [5 ]
876
953
qMohrCoulomb = connect [6 ]
@@ -897,10 +974,16 @@ def monitor_checkForChange_fm(scene):
897
974
or con .use_limit_lin_x :
898
975
forceCon = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
899
976
force += forceCon
900
- # Compute new breaking threshold incease based on force
977
+ ### Get forces from the force list for both connected elements and divide it by the number of connections
978
+ forceA = objsForces [objA ] / objsConstCnts [objA ]
979
+ forceB = objsForces [objB ] / objsConstCnts [objB ]
980
+ #forceElem = min(forceA, forceB) # Use the smaller force and thus strength for the connection
981
+ forceElem = (forceA + forceB ) / 2 # Calculate average force and thus strength for the connection
982
+ force = (force + forceElem ) / 2 # Use also the average of the averaged force per element and the invididual constraint force
983
+ ### Compute new breaking threshold incease based on force
901
984
# σ = F /A
902
985
# τ = c +σ *tan(ϕ)
903
- brkThresInc = abs ( force ) / contactArea * 1 * mul
986
+ brkThresInc = force / contactArea * 1 * mul
904
987
# Modify constraints
905
988
for i in range (1 , len (consts )): # First constraint is always pressure
906
989
con = consts [i ]
0 commit comments