Hi,
I am running an excel macro that creates elements in Microstation. Each element is placed in a graphic group, so I know the graphic group number assigned.
Is it possible to select this graphic group by its number only to enable it to be copied.
Any help (or even better a simple example) wouldbe much appreciated.
Cheers Craig
Unknown said:I am running an Excel macro that creates elements in MicroStation
Which version of MicroStation?
Unknown said:Is it possible to select a graphic group by its number only to enable it to be copied
Use the ModelReference.Scan method. Pass it an ElementScanCriteria object that excludes everything but the graphic group (GG) that you want to include.
ModelReference.Scan
ElementScanCriteria
Untested example...
Sub SelectGraphicGroup (ByVal gg As Long, ByVal oModel As ModelReference) Dim oCriteria As New ElementScanCriteria oCriteria.IncludeOnlyGraphicGroup gg Dim oElementsInGraphicGroup As ElementEnumerator Set oElementsInGraphicGroup = oModel.Scan (oCriteria) Do While oElementsInGraphicGroup.MoveNext Dim oElement As Element Set oElement = oElementsInGraphicGroup.Current ' Do something with oElement oModel.SelectElement oElement Loop End Sub
Example call...
Sub TestSelectGraphicGroup () Const gg As Long = 123 ' Your call SelectGraphicGroup gg, ActiveModelReference End Sub
Regards, Jon Summers LA Solutions
Answer Verified By: Craig Stevens
Perfect! Just what I needed.
Many thanks Jon.