Forum

Panel – Robot Python API

Início Fóruns Temas ou Discussões Panel – Robot Python API

A visualizar 8 artigos - de 1 a 8 (de um total de 8)
  • Autor
    Artigos
  • louispips50
    Convidado
    Número de artigos: 1788

    Hello everyone,

    I tried to do add new label for thicknness panel :

    label = labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS,”25mm”)
    thData=IRobotThicknessData
    thData = label.Data
    thData.MaterialName = “S235”
    thData.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS
    homo = IRobotThicknessHomoData
    homo = thData.Data
    homo.Thickconst = “0,025”
    labels.Store(label)
    same think on my python script but I have the following error :

    I have the following error :

    thData = label.Data
    AttributeError: ‘__ComObject’ object has no attribute ‘Data’

    Do you have a solution to fix this problem ?

    Thank you in advance,

    Louis

    kaneza
    Convidado
    Número de artigos: 1788

    Hello

    how did you define the type label, provide previous lines.

    Best regards

    louispips50
    Convidado
    Número de artigos: 1788

    Hey,

    Here is the definition :

    import clr
    ref = clr.AddReference(
    “C:\Program Files\Autodesk\Autodesk Robot Structural Analysis Professional 2021\System\Exe\Interop.RobotOM.dll”)
    from RobotOM import *
    from System import *
    from System import Environment

    app = RobotApplicationClass()
    project = app.Project
    project.New(IRobotProjectType.I_PT_SHELL)
    labels = structure.Labels

    Regards,
    Louis

    kaneza
    Convidado
    Número de artigos: 1788

    Hello,

    As explained, your problem is probably due to not converting the label variable to a RobotLabel type, reason why you cannot access to datas.

    label = RobotLabel(labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS,”25mm”))
    Don’t do implicit casting with robot API in python try setting explicitly your variable.

    Best regards

    louispips50
    Convidado
    Número de artigos: 1788

    Thank you for your reply !

    I have another error:

    label = IRobotLabel(labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS,”E120″))
    thData=IRobotThicknessData
    thData = label.Data
    thData.MaterialName = “C30/37”
    thData.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS
    homo = IRobotThicknessHomoData
    homo = thData.Data
    homo.Thickconst = “120”
    labels.Store(label)

    File “testrobot.py”, line 82, in
    homo = thData.Data
    AttributeError: ‘__ComObject’ object has no attribute ‘Data’

    Thank a lot for your support,
    Louis

    kaneza
    Convidado
    Número de artigos: 1788

    same issue, label.data and thData.Data returns dynamics vars so cast is necessary.

    1 | thData = IRobotThicknessData(label.Data)
    2 | […]
    3 | homo = IRobotThicknessHomoData(thData.Data)

    To understand, try to find topics on boxing/unboxing ___.data returns on multiple types and all are specific that is equal to using same object but recept it in different container declining himself into parts also.

    Best regards

    louispips50
    Convidado
    Número de artigos: 1788

    Thanks a lot for your help. It works !

    I would like talk about other subject. On my panel I have a to add several node forces (for example 4)

    I did like following example :

    case_number = cases.FreeNumber
    dl= cases.CreateSimple(case_number, “n1”, IRobotCaseNature.I_CN_EXPLOATATION, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR)
    dl_record = dl.Records.Create(IRobotLoadRecordType.I_LRT_NODE_FORCE)
    dl_record = IRobotLoadRecord(dl_record)
    dl_record.Objects.AddOne(node1) # select nodes
    dl_record.SetValue(IRobotNodeForceRecordValues.I_NFRV_FZ,XXX)
    dl_record.SetValue(IRobotNodeForceRecordValues.I_NFRV_FX,XXX)

    The only solution I find is to do that for each nodes (ie x4) and combine in a “load combinaison” after

    Do you have any ideas to be more efficient about that ?

    Thank you in advance,
    Louis

    kaneza
    Convidado
    Número de artigos: 1788

    first close the topic and accept one or several solutions as accepted.

    Second create a new thread with new questions in this category.

    Best regards

A visualizar 8 artigos - de 1 a 8 (de um total de 8)
Resposta a: Panel – Robot Python API
A sua informação




Início Fóruns Temas ou Discussões Panel – Robot Python API