how to automaticaly create property for each beam_section

Xavier
Xavier Altair Community Member
edited November 2020 in Community Q&A

is there any way to create to properties for the imported beam_sections  Pbar card image

the id number is maintained properly, 

i have manually done for some values, in actual model there is a lot of values

a sample file hm file is attached for better understanding.

and test.hm file is shared, where properties needs to be created.

 

 

Best Answer

  • tinh
    tinh Altair Community Member
    edited November 2020 Answer ✓

    Hi,

    try this script:

    *createmark beamsects 1 all foreach bsId [hm_getmark beamsects 1] { 	set dim1 [hm_getentityvalue beamsects $bsId beamsect_dim1 0 -byid] 	set prop_name dia_[string trimright [format %.3f [expr 2*$dim1]] 0] 	*collectorcreateonly properties "$prop_name" "" 11 	*createmark properties 2 -1 	set prop_id [hm_getmark props 2] 	*dictionaryload properties 2 "[hm_info templatefilename]" "PBAR" 	*attributeupdateentity properties $prop_id 3179 1 2 0 beamsects $bsId 	*attributeupdateint properties $prop_id 3240 1 2 0 1 	*attributeupdatedouble properties $prop_id 72 1 2 0 0 	*attributeupdatestring properties $prop_id 130 1 0 0 "" 	*attributeupdateint properties $prop_id 108 1 2 0 0 	*attributeupdateint properties $prop_id 3899 1 2 0 0 }

    Tested on HM2019

    image

Answers

  • tinh
    tinh Altair Community Member
    edited November 2020 Answer ✓

    Hi,

    try this script:

    *createmark beamsects 1 all foreach bsId [hm_getmark beamsects 1] { 	set dim1 [hm_getentityvalue beamsects $bsId beamsect_dim1 0 -byid] 	set prop_name dia_[string trimright [format %.3f [expr 2*$dim1]] 0] 	*collectorcreateonly properties "$prop_name" "" 11 	*createmark properties 2 -1 	set prop_id [hm_getmark props 2] 	*dictionaryload properties 2 "[hm_info templatefilename]" "PBAR" 	*attributeupdateentity properties $prop_id 3179 1 2 0 beamsects $bsId 	*attributeupdateint properties $prop_id 3240 1 2 0 1 	*attributeupdatedouble properties $prop_id 72 1 2 0 0 	*attributeupdatestring properties $prop_id 130 1 0 0 "" 	*attributeupdateint properties $prop_id 108 1 2 0 0 	*attributeupdateint properties $prop_id 3899 1 2 0 0 }

    Tested on HM2019

    image

  • falkirk99
    falkirk99
    Altair Employee
    edited November 2020

    I was going to recommend matrix browser route but script is easier!

  • Xavier
    Xavier Altair Community Member
    edited November 2020
    tinh said:

    Hi,

    try this script:

    *createmark beamsects 1 all foreach bsId [hm_getmark beamsects 1] { 	set dim1 [hm_getentityvalue beamsects $bsId beamsect_dim1 0 -byid] 	set prop_name dia_[string trimright [format %.3f [expr 2*$dim1]] 0] 	*collectorcreateonly properties "$prop_name" "" 11 	*createmark properties 2 -1 	set prop_id [hm_getmark props 2] 	*dictionaryload properties 2 "[hm_info templatefilename]" "PBAR" 	*attributeupdateentity properties $prop_id 3179 1 2 0 beamsects $bsId 	*attributeupdateint properties $prop_id 3240 1 2 0 1 	*attributeupdatedouble properties $prop_id 72 1 2 0 0 	*attributeupdatestring properties $prop_id 130 1 0 0 "" 	*attributeupdateint properties $prop_id 108 1 2 0 0 	*attributeupdateint properties $prop_id 3899 1 2 0 0 }

    Tested on HM2019

    image

    thank you sir,

    it helped alot and saved a lot of time.