1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] ETABS python (API)

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to ETABS. My idea is to have a code that reads a file with a response spectrum and defines it in ETABS. I've tried with the setuser and setfile functions. Since I was having errors, I kept trying with an easier case. When running the code, the function returns -99 and not 0 (with setuser and setfile). If anyone knows what the error could be, it would be a great help. Note that uploading the file manually works.

    import comtypes.client

    # Conectar con ETABS
    # Conectar con la instancia activa de ETABS
    try:

    etabs_object = comtypes.client.GetActiveObject("CSI.ETABS.API.ETABSObject")
    print("Conexión establecida con ETABS.")
    except Exception as e:
    print(f"Error al conectar con ETABS: {e}")
    exit()
    # Acceder al modelo de SAP
    try:

    SapModel = etabs_object.SapModel
    print("Modelo ETABS cargado exitosamente.")
    except Exception as e:
    print(f"Error al acceder al modelo de ETABS: {e}")
    exit()

    # Datos de prueba
    periodos = [0.0, 0.1, 0.2, 0.5, 1.0, 2.0]
    aceleraciones = [0.0, 0.5, 0.8, 1.2, 1.0, 0.6]
    damp_ratio = 0.05

    # Nombre del espectro
    nombre_espectro = "EspectroPrueba"

    ret=SapModel.Func.FuncRS.SetUser(nombre_espectro, len(periodos), periodos, aceleraciones,damp_ratio)
    T, A, st = ret

    if st != 0:
    print(f"Error al crear el espectro. Código de retorno: {st}")

    Continue reading...

Compartilhe esta Página