Description
The Support.AssignSupportToNode method accepts a list of node IDs (NodeIDs), but only the first node in the list actually receives the support assignment. All subsequent nodes are silently ignored.
Root Cause
The current implementation passes the node list as a raw SAFEARRAY via self._b.in_int_array(NodeIDs):
def AssignSupportToNode(self, NodeIDs, SupportID: int):
if isinstance(NodeIDs, int):
NodeIDs = [NodeIDs]
self._support.AssignSupportToNode(self._b.in_int_array(NodeIDs), SupportID)
While the underlying COM method OSSupportUI::AssignSupportToNode(const VARIANT FAR& varnNodeNo, const VARIANT FAR& varnSupportNo) accepts a VARIANT (which can hold an array), the STAAD.Pro COM server only processes the first element of the array. This is a server-side limitation, not a marshalling issue — confirmed by testing all possible VARIANT wrapping strategies (raw SAFEARRAY, VT_BYREF | VT_ARRAY | VT_I4, VT_ARRAY | VT_I4), all of which produce the same result: only array[0] is assigned.
All official VBA examples in the STAAD.Pro documentation loop over nodes one at a time, and the direct array-passing form is commented out:
'assignSupport = objOpenSTAAD.Support.AssignSupportToNode(SelNodes, pinnedSupport)
Steps to Reproduce
from openstaad import ops
s = ops.connect()
pinned = s.CreateSupportPinned()
# Pass a list of 4 nodes
s.AssignSupportToNode([5, 6, 7, 8], pinned)
print(s.GetSupportNodes())
# Expected: [..., 5, 6, 7, 8]
# Actual: [..., 5] ← only the first node
Environment
- STAAD.Pro 2024
- Python 3.12 / comtypes
- Windows 11
Suggested Fix
Loop over the node list and call the COM method once per node, matching the pattern used in all official VBA examples:
def AssignSupportToNode(self, NodeIDs, SupportID: int):
if isinstance(NodeIDs, int):
NodeIDs = [NodeIDs]
for node_id in NodeIDs:
self._support.AssignSupportToNode(node_id, SupportID)
This has been tested and confirmed working — all nodes in the list receive the support assignment correctly.
Description
The
Support.AssignSupportToNodemethod accepts a list of node IDs (NodeIDs), but only the first node in the list actually receives the support assignment. All subsequent nodes are silently ignored.Root Cause
The current implementation passes the node list as a raw SAFEARRAY via
self._b.in_int_array(NodeIDs):While the underlying COM method
OSSupportUI::AssignSupportToNode(const VARIANT FAR& varnNodeNo, const VARIANT FAR& varnSupportNo)accepts aVARIANT(which can hold an array), the STAAD.Pro COM server only processes the first element of the array. This is a server-side limitation, not a marshalling issue — confirmed by testing all possible VARIANT wrapping strategies (raw SAFEARRAY,VT_BYREF | VT_ARRAY | VT_I4,VT_ARRAY | VT_I4), all of which produce the same result: onlyarray[0]is assigned.All official VBA examples in the STAAD.Pro documentation loop over nodes one at a time, and the direct array-passing form is commented out:
'assignSupport = objOpenSTAAD.Support.AssignSupportToNode(SelNodes, pinnedSupport)Steps to Reproduce
Environment
Suggested Fix
Loop over the node list and call the COM method once per node, matching the pattern used in all official VBA examples:
This has been tested and confirmed working — all nodes in the list receive the support assignment correctly.