For Hypermesh: OptiStruct profile: TCL macro for duplicating the assigned property to a component and renaming the duplicated property to the component name.
Dhee
Altair Community Member
For Hypermesh: OptiStruct profile:
Please suggest a tcl macro for the following.
- For each component whose ID starts from 10001, check the assigned property.
- Duplicate the assigned property.
- Rename the duplicated property with the component name.
- Renumber the duplicated property ID with the component ID.
- Assign this property to the component.
Reason for doing this:
- Properties with correct thicknesses (and material for most components) are already assigned in the existing model. But the property name is very generic (example: shell_2mm, shell_3mm, etc)
In the end, I want a unique property with correct thickness for each component.
Kindly let me know if more details are required.
Note: After this operation, I will have another requirement of fetching correct material name for each component from an external excel sheet. Will try this later.
Tagged:
0
Answers
-
The following script will help you get started at least:
0 -
Here is the one working for component ID starting from 10001 to 11200:
set lst_compName [hm_complist id];foreach n_compId $lst_compName {puts $n_compId---nCompIdif {$n_compId >= 10001 && $n_compId <= 11200} {set nPropId [hm_getvalue comps id=$n_compId dataname=property.id];set str_compName [hm_getvalue comps id=$n_compId dataname=name];set n_solverId [lindex [hm_getsolverid property $nPropId] 0];#duplicateputs "B4 dumplicate"*createentitysameas properties $nPropId;puts "Aftr duplicate"#*createmark property 1 -1set NewProp [hm_getmark property 1];puts $NewProp---newProp#assign the same compid to new created propidputs $NewProp---$n_compId--b4*setvalue props id=$NewProp id={props $n_compId}puts $NewProp---$n_compId--afttrset str_newName [list "PP" $str_compName]puts [join $str_newName "_"]--newNameB4*setvalue props id=$NewProp name=[join $str_newName "_"]puts [join $str_newName "_"]--newNameBaftr# assignmen of property to the componentputs "B4 assignment"*setvalue comps id=$n_compId propertyid={props $NewProp}puts "atr assignment"# *setvalue comps id=5001 propertyid={props 60059}} else {continue;}}0