General Mechanical

General Mechanical

How to parameterize the drape angle in ACP?

Tagged: ,

    • julius.langenhorst
      Subscriber
      Hello,nThe model I'm working on consists of a composite fabric that is placed in 0? and 90? direction in a stackup. The ModelingPly uses this stackup as ply material and 'Internal Draping' is activated.nI would like to run a parameter study in which one of the parameters is supposed to be the drape angle (a.k.a. shear angle a.k.a. the value that is shown in the legend after creating a Draping Mesh Plot). If I try to create a parameter in ACP I do not find the option for using this specific value. I tried using 'Expression Output' with this code:nmodel = db.active_modelnresult=model.mesh_query(name='draped_fiber_directions',position='nodal',selection='all',simulate=True)nreturn_value = resultnNeedless to say, it did not work. Do you have a better idea on how to extract the drape angle? Or at least why my solution is not working? Let me know if you need further information.nThank you!n
    • julius.langenhorst
      Subscriber
      I found a solution to get the shear angle in a specific area. I changed the example code found in the Parameters' section of the ACP User Guide:n# Get active modelnmodel = db.active_modeln# Create new selection of all elements attached to a specific plynmodeling_ply = model.modeling_groups['ModelingGroup.1'].plies['ModelingPly.1']nmodel.select_elements(selection='sel10',op='new',attached_to=[modeling_ply])n# Get total shear angle of the first entity of selection sel0nshear_angles = list(model.mesh_query(name='angles',position='centroid',selection='sel10',entities=[modeling_ply],component='shear')[0])n# Get maximum shear anglenmax_shear_angle = max(shear_angles)n# Pass the found maximum shear angle as the script's result.nreturn_value = max_shear_anglenWhile it's great that I solved this problem, I don't quite understand what is happening as I'm not familiar with Python. nWhat does selection='sel10' stand for? Why can't it be changed to e.g. selection='all' (following error message:Failed to convert all to selection set enum. Must be of type 'selX'.) nWhy is the returned max shear angle not the same as shown in the legend of my draping mesh plot (38.93 and 44.83)?nIs it possible to create a list of all shear angles in the model?nBest Regards!n
    • Govindan Nagappan
      Ansys Employee
      nThe selection parameter is an object which is used in the backend to create and store the selection. selection='sel10' means that the current selection is stored as sel10. If you query some data, then you need to pass the name of the selection. If selection is `all`, then the backend selects all elements. So if selection is`all`, then you can skip the first command model.select_elements and directly execute the mesh_query command. The select_elements is needed to ensure that the mesh query only returns the values for the elements which are covered by the ply.n nIn your case:n#select all element of modeling_ply and store it under selection `sel10`nmodel.select_elements(selection='sel10',op='new',attached_to=[modeling_ply])n#query data from a certain selection (here shear angles of a modeling ply using selection object `sel10`)n model.mesh_query(name='angles',position='centroid',selection='sel10',entities=[modeling_ply],component='shear')n nAlternative (and easier to understand)nInstead of using model.select_elements and model.mesh_query, you can use plot objects and use their get_data methodn n#create angle plotnplot=db.active_model.layup_plots.create_angle_plot() nplot.component = 'shear' # set the componentnplot.color_table.auto_upper_value = Truenplot.color_table.upper_value = 90.0nplot.color_table.auto_lower_value = Truenplot.update()nplot.get_data(selected=modeling_ply) # returns the shear angles of a certain plynn n n
    • julius.langenhorst
      Subscriber
      Thanks for Your answer! nBut since get_data returns a n-dimensional array I can not use it as a parameter, right? Besides, everytime I change something in the code it creates a new layup plot called angle.X, that is supposed to happen?nIn any case, I found a different solution by writing a small python script that stores the angle in a .txt file. It is not an automated process but better than nothing.n
Viewing 3 reply threads
  • You must be logged in to reply to this topic.