Forum
Panel – Robot Python API
Início › Fóruns › Temas ou Discussões › Panel – Robot Python API
-
AutorArtigos
-
louispips50Convidado9 de Junho, 2022 às 23:29Número de artigos: 172
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
kanezaConvidado10 de Junho, 2022 às 11:03Número de artigos: 172Hello
how did you define the type label, provide previous lines.
Best regards
louispips50Convidado10 de Junho, 2022 às 15:03Número de artigos: 172Hey,
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 Environmentapp = RobotApplicationClass()
project = app.Project
project.New(IRobotProjectType.I_PT_SHELL)
labels = structure.LabelsRegards,
LouiskanezaConvidado10 de Junho, 2022 às 16:14Número de artigos: 172Hello,
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
louispips50Convidado11 de Junho, 2022 às 9:04Número de artigos: 172Thank 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,
LouiskanezaConvidado11 de Junho, 2022 às 14:04Número de artigos: 172same 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
louispips50Convidado11 de Junho, 2022 às 18:13Número de artigos: 172Thanks 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,
LouiskanezaConvidado11 de Junho, 2022 às 19:19Número de artigos: 172first close the topic and accept one or several solutions as accepted.
Second create a new thread with new questions in this category.
Best regards
-
AutorArtigos
- Tem de iniciar sessão para responder a este tópico.
Início › Fóruns › Temas ou Discussões › Panel – Robot Python API