@@ -502,6 +502,40 @@ def monitor_checkForChange(scene):
502502 if props .submenu_assistant_advanced :
503503 brokenC , brokenT , brokenS , brokenB = 0 , 0 , 0 , 0
504504
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
505539 d = 0 ; e = 0 ; cntP = 0 ; cntB = 0
506540 for connect in connects :
507541 conMode = connect [12 ]
@@ -582,10 +616,16 @@ def monitor_checkForChange(scene):
582616 or con .use_limit_lin_x :
583617 forceCon = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
584618 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
586626 # σ = F /A
587627 # τ = c +σ *tan(ϕ)
588- brkThresInc = abs ( force ) / contactArea * 1 * mul
628+ brkThresInc = force / contactArea * 1 * mul
589629 # Modify constraints
590630 for i in range (1 , len (consts )): # We know that first constraint is always pressure
591631 con = consts [i ].rigid_body_constraint
@@ -862,6 +902,9 @@ def monitor_checkForChange_fm(scene):
862902 if props .submenu_assistant_advanced :
863903 brokenC , brokenT , brokenS , brokenB = 0 , 0 , 0 , 0
864904
905+ ###### Initial pass for the Mohr-Coulomb theory to measure the pressure acting per element
906+ objsForces = {}
907+ objsConstCnts = {}
865908 c = 0
866909 for connect in connects :
867910 consts = connect [2 ]
@@ -871,6 +914,40 @@ def monitor_checkForChange_fm(scene):
871914 ### If connection is in fixed mode then check if first tolerance is reached
872915 if conIntact :
873916 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 ]
874951 contactArea = connect [4 ]
875952 constsBrkThres = connect [5 ]
876953 qMohrCoulomb = connect [6 ]
@@ -897,10 +974,16 @@ def monitor_checkForChange_fm(scene):
897974 or con .use_limit_lin_x :
898975 forceCon = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
899976 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
901984 # σ = F /A
902985 # τ = c +σ *tan(ϕ)
903- brkThresInc = abs ( force ) / contactArea * 1 * mul
986+ brkThresInc = force / contactArea * 1 * mul
904987 # Modify constraints
905988 for i in range (1 , len (consts )): # First constraint is always pressure
906989 con = consts [i ]
0 commit comments