How to adjust Hypermesh macro in order to work with ABAQUS

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

I would like to use the Midsurface_Creation_CreateComp.tcl macro in Hypermesh but it only works with the Nastran user profile. I need to use it with ABAQUS! Can anyone please help me? Thank you

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2010

    Try this. It is quite old, but I just checked it and it still works.

    1) Load the Abaqus user profile

    2) Create a template property card that has the shell_section properties you want

    3) Run the macro

    A) Select the prop card you made

    image/emoticons/default_cool.png' alt='B)'> Select the comps you would like to midplane

    ################################################### Midsurf All was written to midsurface all# solid geometry and organize the data so that # assembly information was intact################################################### Michael Dambach  Altair Engineering  Inc# Email: dambach@altair.com# October 08  2003##################################################set install_home [ hm_info -appinfo ALTAIR_HOME ]set tol 0.001set tcl_precision 4*templatefileset '$install_home/templates/feoutput/abaqus/standard.3d'*clearmark props 1 *createmarkpanel props 1 'Select template property card'set template_id [ hm_getmark props 1 ]set template_prop [ hm_getcollectorname props $template_id ]set matname [ hm_getentityvalue props '$template_prop' 'material.name' 1 ]#tk_messageBox -message 'matname is $matname'*clearmark comps 1*createmarkpanel comps 1 'Select Components to Midsurface'set complist [ hm_getmark comps 1]set ok 'yes'set bad_comp_names {}*displaycollectorwithfilter components 'none' '' 1 0*displaycollectorwithfilter components 'none' '' 0 1set oldcharacter {.}set newcharacter '_'set compnamelist []        foreach compid $complist {		set compname [ hm_getcollectorname comps $compid ]		set compfullname [ split $compname $oldcharacter ]	set compnewname []	set j 0	foreach i $compfullname {		if { $j == 0 } {			set compnewname $i		} else {			set compnewname $compnewname$newcharacter$i		}		incr j	}	catch { *renamecollector component $compname $compnewname }	lappend compnamelist $compname	}foreach compname $compnamelist {	set split_compname [ split $compname '' ]	if { [ llength $split_compname ] > 28 } {		#tk_messageBox -message 'compname $compname is too long'		*displaycollectorwithfilter components on $compname 1 0 		*displaycollectorwithfilter components on $compname 0 1		lappend bad_comp_names $compname		set ok 'no'	}}set bad_comps []if { $ok == 'yes' } {	foreach compid $complist {		set compname [ hm_getcollectorname comps $compid ]		*clearmark surfs 1		#*createmark surfaces 1 'all'		eval *createmark surfaces 1 'by comp name' $compname		set allsurfaces [hm_getmark surfaces 1]		#*clearmark surfs 1		#eval *createmark surfs 1 $allsurfaces		#*maskmark surfaces 1				set move_error [ catch { *collectorcreateonly components '${compname}_old' '' 7 } ]		*currentcollector comps '$compname'		#*clearmark mats 1 		#*createmark mats 1 '${compname}_old'		#catch { *deletemark mats 1 }		eval *createmark surfaces 1 $allsurfaces		set move_error [ catch { *movemark surfaces 1 ${compname}_old } ]		*createmark solids 1 'by comp name' $compname		set move_error [ catch { *movemark solids 1 ${compname}_old } ]				if { $move_error != 0 } {			catch { *collectorcreateonly components 'CompNameTooLong' '' 7 }			*currentcollector comps '$compname'			*clearmark surfs 1			eval *createmark surfaces 1 $allsurfaces			set move_error [ catch { *movemark surfaces 1 'CompNameTooLong' } ]		}		*normalsoff		*clearmark surfaces 1		eval *createmark surfaces 1 $allsurfaces				*midsurface_extract_new surfaces 1 -1 0 1 1 0 10 0 10 -2 undefined 0 0 0		*midsurface_remove_edit_bodies		*release_temp_fixed_vertices		*normalsoff		*clearmark surfaces 1		*clearmark surfs 1		*createmark surfaces 1 'by comp name' '$compname'		set newsurfs [ hm_getmark surfs 1 ]				if { [ llength $newsurfs ] != 0 } {			set surfid [ lindex $newsurfs 0 ]			*clearmark surfs 1			*createmark surfaces 1 $surfid			*linefromsurfedge surfaces 1			*normalsoff			*clearmark lines 1			*createmark lines 1 -1			*nodecreateonlines lines 1 3 0 0			*clearmark nodes 1			*createmark nodes 1 -1			*markprojectnormallytosurface nodes 1 $surfid			set midsurf_error [ catch { set thick [ hm_getnodalthickness nodes -1 ] } ]			if { $midsurf_error != 0 } {				set midsurf_error [ catch { set thick [ hm_getnodalthickness nodes -2 ] } ]			}						set max [ expr { [ llength $newsurfs ] - 1 } ] 			set surfid [ lindex $newsurfs $max ]			*clearmark surfs 1			*createmark surfaces 1 $surfid			*linefromsurfedge surfaces 1			*normalsoff			*clearmark lines 1			*createmark lines 1 -1			*nodecreateonlines lines 1 3 0 0			*clearmark nodes 1			*createmark nodes 1 -1			*markprojectnormallytosurface nodes 1 $surfid			set midsurf_error [ catch { set thick2 [ hm_getnodalthickness nodes -1 ] } ]			if { $midsurf_error != 0 } {				set midsurf_error [ catch { set thick2 [ hm_getnodalthickness nodes -2 ] } ]			}						if { [ expr { $thick - $thick2 } ] > $tol } {							lappend bad_comps $compname							set midsurf_error 1						}						#tk_messageBox -message 'compname is $compname'			if { $midsurf_error == 0 } {							#tk_messageBox -message 'thick is $thick'								# ABAQUS Thickness:												*collectorcreatesameas properties '${compname}' '$template_prop' '$matname' 3#				*collectorcreateonly properties '${compname}_prop' '$template_prop' 3				*clearmark props 1				*createmark props 1 '${compname}'												set prop_id [ hm_getmark props 1 ]												*attributeupdatedouble properties $prop_id 111 2 1 0 $thick																*clearmark comps 1				*createmark comps 1 '$compname'				*propertyupdate components 1 '${compname}' 								*nodecleartempmark			}		}	}		if { [ llength $bad_comps ] != 0 } {			tk_messageBox -message 'These Component were determined to have inconsistent thickness values.\n\nThey were not assigned a thickness.\n\n$bad_comps'				}	} else {	tk_messageBox -message 'these comp names are too long to use this macro.\n\nPlease rename them (displayed) and try again.'}

    Hope that helps.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.