Imre 1 Report post Posted August 16, 2018 Hey guys! I have a problem with composite optimization. I would like to ask you to help me modify a script. I have made a composite skateboard tutorial and after size optimization there were many plies. These plies have initial values like 0.41535 mm, and upper bound value something similar, but bigger. The manufacturable thickness was 0.5 mm, so I had to alter the upper bound value equal to multiple of the manufacturable thickness. I found a script on the script exchange, which is attached, that can change the upper bound, initial value and lower bound of the design variables for the multiples of the manufacturable plies. I think it would be useful if this script would be able to modify the upper bound value of the design variables in the following way: If the initial value (IV) is less than or equal to the manufacturable thickness (TMANUF) then the upper bound value of the design variables (UBV) has to be equal to the manufacturable thickness (TMANUF). If TMANUF < IV <= 2 x TMANUF then UBV = 2 x TMANUFGenerally: If n x TMANUF < IV <= (n+1) x TMANUF then UBV = (n+1) x TMANUF; where n = 0, 1, 2, 3 ... Could someone modify this script with this changes? Thank you for your help in advance! Best regards, Tüki Readme.txt Update_sizing_desvars.tcl Quote Share this post Link to post Share on other sites

Pandurang 19 Report post Posted August 17, 2018 Hi lmre, Try This: *createmarkpanel designvars 1 "Select DESVARs." set DesvarIDList [ hm_getmark designvars 1 ] *clearmark designvars 1 #puts $DesvarIDList #set ScaleFactor [hm_getfloat "Enter scaling factor value. Default = 1 if 0." "Entering scaling factor value"] set PlyThiManu [hm_getfloat "Enter the manufacturable ply thickness." "Entering manufacturable ply thickness"] foreach DesvarID $DesvarIDList { set DesvarName [ hm_getentityvalue designvars $DesvarID "name" 1 ] set DesvarIV [ hm_getentityvalue designvars $DesvarID "initialvalue" 0 ] set DesvarLB [ hm_getentityvalue designvars $DesvarID "lowerbound" 0 ] set DesvarUB [ hm_getentityvalue designvars $DesvarID "upperbound" 0 ] puts "Original UB value = $DesvarUB" ################## MOdification ##################################### # If the initial value (IV) is less than or equal to the manufacturable thickness (TMANUF) then the upper bound value of the design variables (UBV) has to be equal to the manufacturable thickness (TMANUF). if {$DesvarIV <= $PlyThiManu } { set DesvarUB $PlyThiManu } # If TMANUF < IV <= 2 x TMANUF then UBV = 2 x TMANUF if {$PlyThiManu < $DesvarIV & $DesvarIV <= [expr 2* $PlyThiManu]} { set DesvarUB [expr 2 * $PlyThiManu] } ###################################################################### ###################################################################### # # Muliply it by one so it'll output in fix notation # set UBValueoutput [ expr { 1*$DesvarUB } ] # #set ScaledUBValue [ expr { $ScaleFactor*$DesvarUB } ] # set ScaledUBValue [ expr { $PlyThiManu*10 } ] # set ScaledDesvarIV [ expr { $PlyThiManu*2 } ] # set ScaledDesvarLB [ expr { $PlyThiManu*0 } ] # *sizedesvarupdatewithddvalfield "$DesvarName" $ScaledUBValue $ScaledDesvarIV $ScaledDesvarLB -1 0 *sizedesvarupdatewithddvalfield "$DesvarName" $DesvarUB $DesvarIV $DesvarLB -1 0 #*sizedesvarupdatewithddvalfield "autoply" 0.025 0.0113599 0 -1 0 puts "UB Value updated = $DesvarUB" } Quote Share this post Link to post Share on other sites

Imre 1 Report post Posted August 17, 2018 2 hours ago, Pandurang said: Hi lmre, Try This: *createmarkpanel designvars 1 "Select DESVARs." set DesvarIDList [ hm_getmark designvars 1 ] *clearmark designvars 1 #puts $DesvarIDList #set ScaleFactor [hm_getfloat "Enter scaling factor value. Default = 1 if 0." "Entering scaling factor value"] set PlyThiManu [hm_getfloat "Enter the manufacturable ply thickness." "Entering manufacturable ply thickness"] foreach DesvarID $DesvarIDList { set DesvarName [ hm_getentityvalue designvars $DesvarID "name" 1 ] set DesvarIV [ hm_getentityvalue designvars $DesvarID "initialvalue" 0 ] set DesvarLB [ hm_getentityvalue designvars $DesvarID "lowerbound" 0 ] set DesvarUB [ hm_getentityvalue designvars $DesvarID "upperbound" 0 ] puts "Original UB value = $DesvarUB" ################## MOdification ##################################### # If the initial value (IV) is less than or equal to the manufacturable thickness (TMANUF) then the upper bound value of the design variables (UBV) has to be equal to the manufacturable thickness (TMANUF). if {$DesvarIV <= $PlyThiManu } { set DesvarUB $PlyThiManu } # If TMANUF < IV <= 2 x TMANUF then UBV = 2 x TMANUF if {$PlyThiManu < $DesvarIV & $DesvarIV <= [expr 2* $PlyThiManu]} { set DesvarUB [expr 2 * $PlyThiManu] } ###################################################################### ###################################################################### # # Muliply it by one so it'll output in fix notation # set UBValueoutput [ expr { 1*$DesvarUB } ] # #set ScaledUBValue [ expr { $ScaleFactor*$DesvarUB } ] # set ScaledUBValue [ expr { $PlyThiManu*10 } ] # set ScaledDesvarIV [ expr { $PlyThiManu*2 } ] # set ScaledDesvarLB [ expr { $PlyThiManu*0 } ] # *sizedesvarupdatewithddvalfield "$DesvarName" $ScaledUBValue $ScaledDesvarIV $ScaledDesvarLB -1 0 *sizedesvarupdatewithddvalfield "$DesvarName" $DesvarUB $DesvarIV $DesvarLB -1 0 #*sizedesvarupdatewithddvalfield "autoply" 0.025 0.0113599 0 -1 0 puts "UB Value updated = $DesvarUB" } Thank you very much, it is working fine. Quote Share this post Link to post Share on other sites