For Hypermesh: OptiStruct profile: TCL macro for duplicating the assigned property to a component and renaming the duplicated property to the component name.
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.
Find more posts tagged with
Sort by:
1 - 2 of
21
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---nCompId
if {$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];
#duplicate
puts "B4 dumplicate"
*createentitysameas properties $nPropId;
puts "Aftr duplicate"
#
*createmark property 1 -1
set NewProp [hm_getmark property 1];
puts $NewProp---newProp
#assign the same compid to new created propid
puts $NewProp---$n_compId--b4
*setvalue props id=$NewProp id={props $n_compId}
puts $NewProp---$n_compId--afttr
set 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 component
puts "B4 assignment"
*setvalue comps id=$n_compId propertyid={props $NewProp}
puts "atr assignment"
# *setvalue comps id=5001 propertyid={props 60059}
} else {
continue;
}
}
The following script will help you get started at least:
https://community.altair.com/community?id=altair_file_exchange_article_view&table=u_kb_template_altair_file_exchange&sys_id=d36246c51b4e6110507ca6442a4bcb1a&view=sp