General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

Object step status batch editing

    • Grigory Tarasevich
      Hello! I was wondering if there is a way to efficiently edit the tabular data (in particular - element birth/death status for a particular time step) for the objects that do not have a worksheet option enabled? Let's say I have a hundred birth/death element objects I need to edit the step status for and every object has a unique step sequence. The python script recorder does not pick up the status switch action unfortunately, but maybe someone knows the object function that would do it? Or how to enable the worksheet view for these objects? Thanks!
    • mjmiddle
      Ansys Employee

      Mechanical allows alive/dead status for an "Element Birth and Death" and "Contact Step Control." The following was tested in 2023 R2:

      analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
      numSteps = analysis.AnalysisSettings.NumberOfSteps
      elemBirthDeath = analysis.AddElementBirthAndDeath()
      control = ["Alive", "Dead", "Alive", "Dead", "Dead"]    # list length needs to match number of steps
      control = [eval("ElementControlsStatus."+cont) for cont in control]
      with Transaction():
          for step in range(1, numSteps+1):
              elemBirthDeath.CurrentStep = step
              elemBirthDeath.Status = control[step-1]


Viewing 1 reply thread
  • You must be logged in to reply to this topic.