- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello evereyone!
I am trying to write code that will be responsible for setting the parameters needed to check SLS and ULS. Using API 2025, I did not find the appropriate ****tions to invoke the parameters I need. It seems that the API is not complete (available only from version 3.5). I found sample codes on the Internet that allowed me to set the parameters I needed, but none of them worked. Using python and C#, I always got an error. Have any of you had a similar problem and would be able to help me with it?
using RobotOM;
IRobotLabel rLabel;
IRDimMembDefData rdimLabelData;
IRDimMembParamsCM66 rDimMembParams;
RobotApplicationClass app = new RobotApplicationClass();
rLabel = app.Project.Structure.Labels.Create(IRobotLabelType.I_LT_MEMBER_TYPE, "My Label");
rdimLabelData = (IRDimMembDefData) rLabel.Data;
rDimMembParams = (IRDimMembParamsCM66) rdimLabelData.CodeParams;
rDimMembParams.BuckLenghtCoeffY = 10;
rdimLabelData.CodeParams = rDimMembParams;
app.Project.Structure.Labels.Store(rLabel);
win32-x64\.debugger\x86_64\vsdbg.exe' '--interpreter=vscode' 'connection=8d7050243c4c4b068fd3be8c045b68b3'
Unhandled exception. System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'RobotOM.IRDimMembParamsCM66'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{34C1F17A-9D20-4775-B57A-B154A033C1FA}' failed due to the following error: Such an interface is not supported. (0x80004002 (E_NOINTERFACE)).
import clr
import sys
from System import Environment
from System import Object
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReference(user + r"\Dynamo\Dynamo Revit\3.2\packages\Structural Analysis for Dynamo\bin\interop.RobotOM.dll")
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
from RobotOM import *
app = RobotApplicationClass()
r_label = IRobotLabel
print(type(r_label))
r_label = app.Project.Structure.Labels.Create(IRobotLabelType.I_LT_MEMBER_TYPE, "My Label")
rdim_label_data = IRDimMembDefData
rdim_label_data = r_label.Data
r_dim_memb_params = IRDimMembParamsEC3
r_dim_memb_params = rdim_label_data.CodeParams
r_dim_memb_params.BucklingDiagramY = IRDimBuckDiagramEC3.I_DBD_EC3_TRUSS_DIAGONAL_0_8
rdim_label_data.CodeParams = r_dim_memb_params
print("Etykieta została utworzona i zapisana.")
I am the most interesting to use it in python, because i want to do this script in Dynamo
Best Regards!
Solved! Go to Solution.