@@ -558,24 +558,35 @@ def monitor_checkForChange(scene):
558
558
559
559
### Dynamic change of breaking thresholds depending on pressure (Mohr-Coulomb theory)
560
560
if qMohrCoulomb :
561
- # Get force acting on the compressive constraints in connection
562
- force = abs (consts [0 ].rigid_body_constraint .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
561
+ # Find the maximum force of the compressive constraints in connection
562
+ forceMax = 0
563
+ for const in consts :
564
+ con = const .rigid_body_constraint
565
+ ### For Point and Fixed costraints
566
+ ### For Generic constraints
567
+ # Compressive constraints
568
+ if con .type != 'GENERIC' \
569
+ or con .use_limit_lin_x :
570
+ force = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
571
+ if force > forceMax : forceMax = force
563
572
# Compute new breaking threshold incease based on force
564
573
# σ = F /A
565
574
# τ = c +σ *tan(ϕ)
566
- brkThresInc = force / contactArea * 0.577 * mul
575
+ brkThresInc = forceMax / contactArea * 0.577 * mul
567
576
# Modify constraints
568
577
for i in range (1 , len (consts )): # We know that first constraint is always pressure
569
578
con = consts [i ].rigid_body_constraint
570
- # Set override to shear connections in connection
571
- if con .type != 'GENERIC' : # For Point and Fixed costraints
579
+ ### For Point and Fixed costraints
580
+ ### For Generic constraints
581
+ # Tensile constraints - Comment this line out to include all constraints
582
+ # Shear constraints - Comment this line out to include all constraints
583
+ # Bend constraints - Comment this line out to include all constraints
584
+ if con .type != 'GENERIC' \
585
+ or con .use_limit_lin_x \
586
+ or con .use_limit_lin_y or con .use_limit_lin_z \
587
+ or con .use_limit_ang_y or con .use_limit_ang_z :
588
+ # Apply breaking threshold incease
572
589
con .breaking_threshold = constsBrkThres [i ] + (brkThresInc * rbw_time_scale / rbw_steps_per_second )
573
- else : # For Generic constraints
574
- if con .use_limit_lin_y or con .use_limit_lin_z : # Shear constraints - Comment this line out to include all constraints
575
- con .breaking_threshold = constsBrkThres [i ] + (brkThresInc * rbw_time_scale / rbw_steps_per_second )
576
- # Set override to bend connections in connection
577
- if con .use_limit_ang_y or con .use_limit_ang_z : # Bend constraints - Comment this line out to include all constraints
578
- con .breaking_threshold = constsBrkThres [i ] + (brkThresInc * rbw_time_scale / rbw_steps_per_second )
579
590
580
591
# ### Modify limits from applied forces
581
592
# strainDist = .001 # Maximum linear strain for the given breaking threshold
@@ -634,7 +645,7 @@ def monitor_checkForChange(scene):
634
645
# strain = abs(force) /brkThres # Normalized to breaking threshold
635
646
# if strain > strainMax: strainMax = strain
636
647
# strainIters = iterMin +(iterMax -iterMin) *strainMax # Compute iterations from strain
637
- # # Set override only to shear connections in connection
648
+ # # Set override only to shear constraints in connection
638
649
# for const in consts:
639
650
# con = const.rigid_body_constraint
640
651
# if con.use_limit_lin_y or con.use_limit_lin_z: # Shear constraints - Comment this line out to include all constraints
@@ -847,25 +858,35 @@ def monitor_checkForChange_fm(scene):
847
858
848
859
### Dynamic change of breaking thresholds depending on pressure (Mohr-Coulomb theory)
849
860
if qMohrCoulomb :
850
- # Get force acting on the compressive constraints in connection
851
- force = abs (consts [0 ].appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
861
+ # Find the maximum force of the compressive constraints in connection
862
+ forceMax = 0
863
+ for con in consts :
864
+ ### For Point and Fixed costraints
865
+ ### For Generic constraints
866
+ # Compressive constraints
867
+ if con .type != 'GENERIC' \
868
+ or con .use_limit_lin_x :
869
+ force = abs (con .appliedImpulse ()) * rbw_steps_per_second / rbw_time_scale # Conversion from impulses to forces
870
+ if force > forceMax : forceMax = force
852
871
# Compute new breaking threshold incease based on force
853
872
# σ = F /A
854
873
# τ = c +σ *tan(ϕ)
855
- brkThresInc = force / contactArea * 0.577 * mul
874
+ brkThresInc = forceMax / contactArea * 0.577 * mul
856
875
# Modify constraints
857
876
for i in range (1 , len (consts )): # First constraint is always pressure
858
877
con = consts [i ]
859
- # Set override to shear connections in connection
860
- if con .type != 'GENERIC' : # For Point and Fixed costraints
878
+ ### For Point and Fixed costraints
879
+ ### For Generic constraints
880
+ # Tensile constraints - Comment this line out to include all constraints
881
+ # Shear constraints - Comment this line out to include all constraints
882
+ # Bend constraints - Comment this line out to include all constraints
883
+ if con .type != 'GENERIC' \
884
+ or con .use_limit_lin_x \
885
+ or con .use_limit_lin_y or con .use_limit_lin_z \
886
+ or con .use_limit_ang_y or con .use_limit_ang_z :
887
+ # Apply breaking threshold incease
861
888
con .breaking_threshold = constsBrkThres [i ] + (brkThresInc * rbw_time_scale / rbw_steps_per_second )
862
- else : # For Generic constraints
863
- if con .use_limit_lin_y or con .use_limit_lin_z : # Shear constraints - Comment this line out to include all constraints
864
- con .breaking_threshold = constsBrkThres [i ] + (brkThresInc * rbw_time_scale / rbw_steps_per_second )
865
- # Set override to bend connections in connection
866
- if con .use_limit_ang_y or con .use_limit_ang_z : # Bend constraints - Comment this line out to include all constraints
867
- con .breaking_threshold = constsBrkThres [i ] + (brkThresInc * rbw_time_scale / rbw_steps_per_second )
868
-
889
+
869
890
################################################################################
870
891
871
892
def monitor_countIntactConnections_fm (scene ):
0 commit comments