General Mechanical

General Mechanical

Inserting Tabular data using python script:Can’t assign to read-only property Inputs of type ‘Field’

    • prakhars962
      Subscriber
      I was trying to insert a tabular data for displacement as follows:nSlMn = ExtAPI.SelectionManagernSlMn.ClearSelection()nSel = SlMn.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)ndisp=DataModel.AnalysisList[0].AddDisplacement()nSel.Ids=[25] # ID 25 is an edgendisp.Location=Selndisp.XComponent.Output.DefinitionType=VariableDefinitionType.Discretendisp.YComponent.Output.DefinitionType=VariableDefinitionType.Discretendisp.ZComponent.Output.DefinitionType=VariableDefinitionType.Discretendisp.YComponent.Inputs=[Quantity('0 [sec]'),Quantity('0.1[sec]'),Quantity('0.2 [sec]'),Quantity('1[sec]')]nI am getting this error:ncan't assign to read-only property Inputs of type 'Field'nnI was using the same syntax prescribed for forces in the ANSYS ACT developer guide. How can a tabular data be read-only if I can manually input values in the table?nIs there anything wrong with my code? Also, I have tried the tree children method (disp=Model.Analyses[0].Children[5]). This gives the same error.n
    • Erik Kostson
      Ansys Employee
      HinnThis link shows how to do it for a convection load, but the same principle there can be applied to any load so AddDisplacement(), AddForce, etc.nn

      Dear Ansys Learning Forum Team,I am writing an Iron Python script on Ansys Mechanical for a thermal problem.When a convection load is created (A), in order to define the Film coefficient (, I need to perform a click on the dropdown list and then, I can select the Tabular option (C). (See attached figure).However, if I want to automatize this task, I can not do it manually. Therefore, my question is how to define a film coefficient table by command line? (i.e. to perform task (C) ).Any suggestion will be appreciated.Best regards,Ramiro M.Ps: After reading the Ansys ACT manual, it saysField Convection.FilmCoefficient { get; }Gets the FilmCoefficient.RemarksThis property cannot be set. When one wants to change its value, one should operate on the returned Field object, either on its inputs or on its output variables .https://us.v-cdn.net/6032193/uploads/T3H9BDTUA69B/filmcoefficient.jpg:https://forum.ansys.com/discussion/26059/how-to-define-a-film-coefficient-table-by-command-line-in-ansys-mechanical

      nThank younnErikn
    • prakhars962
      Subscriber
      nThanks its working now.nAlso, I was trying to make some directions ramped or constant, but I couldn't find any option. See the following snip, there is no option for ramped or constant.nn
    • Erik Kostson
      Ansys Employee
      HinnYes, I see, there is no such option.nnIf we assign it like I showed , then we can have it as constant via our tabular values or ramped (as needed).nnSo that is the workaround - i think we can close this discussion now - but if you have any other questions, then feel free to open up a new discussion.nnAll the bestnnErik
Viewing 3 reply threads
  • You must be logged in to reply to this topic.