Applies To | |||
Product(s): | STAAD.Pro | ||
Version(s): | All | ||
Environment: | N/A | ||
Area: | OpenSTAAD | ||
Subarea: | Geometry | ||
Original Author: | Bentley Technical Support Group, Shreyanka Bhattacharjee | ||
Problem Description:
How to intersect members using OpenSTAAD function (VBA and python)
Solution:
IntersectBeams function is used to intersect members. GetIntersectBeamsCount can also be used along with this function
IntersectBeams: A function that takes a list of beam numbers and either identify those that would be split/connected due to overlapping each other and highlighting them on the model or simply performing the intersection routine and returning a list of members resulting from running the intersection routine that have been added to the model.
GetIntersectBeamsCount: Returns number of new beams that will be created if the specified list of beams are intersected. This method can be used to get the count of beams that can be used to define the size of output array while using the API IntersectBeams
Parameter:
IntersectBeams:
[Input] Method: Pass 1 to highlight the member(s) or 2 to intersect the member(s)
[Input] BeamNosArray: Array of Beams numbers. If the array is either null or empty then all members in current model will be considered
[Input] Tolerance: Tolerance to be used for finding beam intersection, should not be negative value, meter for Metric and inch for English in Base Unit
[Input] NewBeamNosArray: The ids of the beams that have been added, extract beam number ID only for method 2.
GetIntersectBeamsCount
[Input] BeamNosArray: Array of Beams numbers. If the array is either null or empty then all members in current model will be considered
[Input] Tolerance: Tolerance to be used for finding beam intersection, should not be negative value, meter for Metric and inch for English in Base Unit
Sample VBA Syntax:
Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
Dim beams() As Long
Dim Tolerance As Double
Dim method As Long
ReDim beams(3) As Long
Dim newBeamCount As Long
Dim newBeams() As Long
beams(0) = 1
beams(1) = 2
beams(2) = 3
beams(3) = 4
Tolerance = 0.01
newBeamCount = objOpenStaad.Geometry.GetIntersectBeamsCount(beams, Tolerance)
ReDim newBeams(newBeamCount - 1) As Long
method = 1
retval = objOpenStaad.Geometry.IntersectBeams(method, beams, Tolerance, newBeams)
Python syntax:
GetIntersectBeamsCount_IntersectBeams.py file is attached
communities.bentley.com/.../GetIntersectBeamsCount_5F00_IntersectBeams.py communities.bentley.com/.../IntersectBeams.STD