hexagon logo

How to Create multiple fields based on number of load case.

I am trying to create multiple fields based on load case count using PCL. My requirement is every time the field name should be changed. I used concatenate option. But it doesn't work. Any other way it can be done ? 
Please find my code below .
#########################
######### Create fields
#########################
Function field_create()
## Variable declarations
STRING s_name[31]
STRING s_group[32]
STRING s_type[32]
INTEGER i_extrap_method
STRING s_coord[32]
INTEGER i_result_flag
INTEGER i_return_value
INTEGER j
INTEGER lc_count
# Count all the load cases
db_count_load_cases(lc_count)
db_get_all_load_cases()
# Create FEM field
FOR (j=1 TO lc_count)
s_name  =  "field"//(j)
s_group = "GFEM_Elms"
s_type  = "Scalar"
i_extrap_method = 1
s_coord = "Coord 0"
i_result_flag = 0
i_return_value = fields_create_fem ( s_name, s_group, s_type, i_extrap_method, @
         s_coord, i_result_flag )
      
END FOR
END FUNCTION
Parents
  • Hi Vishal
    a quick caveat
    When naming your PCL functions you need to make sure that the name e.g."field_create" is unique. As Patran is written in PCL there are an enormous number of functions and you must keep yours different or they will be used instead of the standard version.
    Initially I thought your name was a duplicate of "fields_create" then realised it was singular.
    As a general guideline users typically take their initials or company abbreviation as a prefix to all the functions they write. Patran itself uses application names like fem_, flds_, asm_, sgm_, db_ etc to group functions, remember also that a number of the math functions mth_ also can be called without the mth_ e.g. mth_cosd or cosd.
    best regards
    Arthur
     
Reply
  • Hi Vishal
    a quick caveat
    When naming your PCL functions you need to make sure that the name e.g."field_create" is unique. As Patran is written in PCL there are an enormous number of functions and you must keep yours different or they will be used instead of the standard version.
    Initially I thought your name was a duplicate of "fields_create" then realised it was singular.
    As a general guideline users typically take their initials or company abbreviation as a prefix to all the functions they write. Patran itself uses application names like fem_, flds_, asm_, sgm_, db_ etc to group functions, remember also that a number of the math functions mth_ also can be called without the mth_ e.g. mth_cosd or cosd.
    best regards
    Arthur
     
Children
No Data