


{"id":28469,"date":"2017-12-06T22:29:46","date_gmt":"2017-12-06T22:29:46","guid":{"rendered":"\/forum\/forums\/topic\/parameterize-ansys-mechanical-material-assignments\/"},"modified":"2017-12-06T22:29:46","modified_gmt":"2017-12-06T22:29:46","slug":"parameterize-ansys-mechanical-material-assignments","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/parameterize-ansys-mechanical-material-assignments\/","title":{"rendered":"Parameterize ANSYS Mechanical material assignments"},"content":{"rendered":"<p>&nbsp;Hello everybody,<\/p>\n<p><\/p>\n<p>I will try to explain briefly what is the problem I am facing. Basically, I have a model made up of 32 bodies and 4 different materials that can be used. I have to find which combination body-material guarantee the minimum compliance once fixed a target weight. It is a sort of topology optimization problem.<\/p>\n<p><\/p>\n<p>I found this code that I am trying to use that seems could help me:<\/p>\n<p><\/p>\n<blockquote><p><\/p>\n<pre><span style=\"font-size: 10pt;\">!###############################################################################################################################<br \/>\n! MATSWAP.MAC<br \/>\n! Created by Joe Woodward at PADT,Inc.<br \/>\n! Created on 2\/12\/2016<br \/>\n!<br \/>\n! Usage: Create Named Selections, Holder1, Holder2, etc.,for BODIES using the materials that you want to use.<br \/>\n! Create Named Selections called MatSwap1, MatSwap2, etc. for the groups of BODIES for which you want to swap materials.<br \/>\n! Set ARG1 equal to the Holder number that has the material to give to MatSwap1.<br \/>\n! Set ARG2 equal to the Holder number that has the material to give to MatSwap2.<br \/>\n! And so on....<br \/>\n! A value of 0 will not swap materials for that given group.<br \/>\n!<br \/>\n! Use as is. No Modification to this command snippet is necessary.<br \/>\n!###############################################################################################################################<br \/>\n\/prep7<br \/>\n*CREATE,MATSWAP,MAC<br \/>\n*if,arg1,NE,0,then<br \/>\n*get,isthere,COMP,holder%arg1%,TYPE<br \/>\n*get,swapgood,COMP,matswap%ARG2%,TYPE<br \/>\n*if,isthere,eq,2,then<br \/>\nesel,s,,,holder%arg1%<br \/>\n*get,newmat,elem,ELNEXT(0),ATTR,MAT<br \/>\n!swap material for Body 1<br \/>\n*if,swapgood,eq,2,then<br \/>\nesel,s,,,matswap%ARG2%<br \/>\nemodif,all,mat,newmat<br \/>\n*else<br \/>\n\/COM,The Named Selection - MatSwap%ARG2% is not set to one or more bodies<br \/>\n*endif<br \/>\n*else<br \/>\n\/COM,The Named Selection Holder%ARG1% is not set to one or more bodies<br \/>\n*endif<br \/>\n*endif<br \/>\n*END<br \/>\nMATSWAP,ARG1,1 !Use material from Holder1 for Swap1<br \/>\nMATSWAP,ARG2,2 !Use material from Holder1 for Swap2<br \/>\nMATSWAP,ARG3,3 !Use material from Holder1 for Swap3<br \/>\nMATSWAP,ARG4,4 !Use material from Holder1 for Swap4<br \/>\nMATSWAP,ARG5,5 !Use material from Holder1 for Swap5<br \/>\nMATSWAP,ARG6,6 !Use material from Holder1 for Swap6<br \/>\nMATSWAP,ARG7,7 !Use material from Holder1 for Swap7<br \/>\nMATSWAP,ARG8,8 !Use material from Holder1 for Swap8<br \/>\nMATSWAP,ARG9,9 !Use material from Holder1 for Swap9<br \/>\n<br \/>\nalls<br \/>\n\/solu<br><\/span><\/pre>\n<p>\n<\/p><\/blockquote>\n<p><\/p>\n<p>This code swap the material contained in a body &#8220;Holder&#8221; to the material Swap1,2,3 which number is the number of the ARG (input of the commands).<\/p>\n<p><\/p>\n<p>THE PROBLEM IS: the number of arguments is limited to 9. There is a way that I can increase this number? If I use this command twice how can I modify this code in order to take the Swap10,11,12&#8230; during the second time the code is run?<\/p>\n<p><\/p>\n<p>I wish I was clear&#8230;<\/p>\n<p><\/p>\n<p>Thank you in advance to anyone who will help me!<\/p>\n","protected":false},"template":"","class_list":["post-28469","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_old_topic_id":["636"],"_bbp_old_topic_author_name_id":["Anonymous"],"_bbp_old_is_topic_anonymous_id":["false"],"_bbp_old_closed_status_id":["publish"],"_bbp_author_ip":[null],"_bbp_old_sticky_status_id":["normal"],"_bbp_likes_count":["0","0","0","0","0"],"_btv_view_count":["2801"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["28469"],"_bbp_forum_id":["27791"],"_bbp_engagement":["240","155284"],"_bbp_voice_count":["2"],"_bbp_reply_count":["10"],"_bbp_last_reply_id":["56032"],"_bbp_last_active_id":["56032"],"_bbp_last_active_time":["2018-01-07 16:27:36"]},"test":"gmtassi"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/28469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/28469\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=28469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}