Forum
Panel – Robot Python API
Home › Forums › Temas ou Discussões › Panel – Robot Python API
-
AuthorPosts
-
louispips50Guest9 de June, 2022 at 23:29Post count: 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
kanezaGuest10 de June, 2022 at 11:03Post count: 172Hello
how did you define the type label, provide previous lines.
Best regards
louispips50Guest10 de June, 2022 at 15:03Post count: 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,
LouiskanezaGuest10 de June, 2022 at 16:14Post count: 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
louispips50Guest11 de June, 2022 at 9:04Post count: 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,
LouiskanezaGuest11 de June, 2022 at 14:04Post count: 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
louispips50Guest11 de June, 2022 at 18:13Post count: 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,
LouiskanezaGuest11 de June, 2022 at 19:19Post count: 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
-
AuthorPosts
- You must be logged in to reply to this topic.
Home › Forums › Temas ou Discussões › Panel – Robot Python API