Hi all
I've been having a problem with the AssembleComplexStringsAndShapes, which was suggested in this forum as the method for combining a set of lines into a complex string as it would deal away with the problem of having to sort or order the lines which would otherwise be necessary using the CreateComplexString method.
However, as much as I have tried, there is a type mismatch error in the AssembleComplexStringsAndShapes line, even though I am inputting a ChainableElement() array which is what the method seems to want based on its definition.
I am hopeful that I am missing a notation thing somewhere but I have tried the various options (including sending in other arrays and assigning the ChainableElement() array differently but nothing seems to be that missing link!
Any help is greatly appreciated.
Cheers
Koit
Private Sub StringChainer(levelName As String) ' Set up corresponding level object Dim oLevel As Level Set oLevel = ActiveDesignFile.Levels(levelName) ' Set up scan criteria Dim oScanCriteria As ElementScanCriteria Set oScanCriteria = New ElementScanCriteria oScanCriteria.ExcludeAllLevels oScanCriteria.ExcludeAllTypes oScanCriteria.IncludeLevel oLevel oScanCriteria.IncludeType msdElementTypeLine Dim oEnumerator As ElementEnumerator Set oEnumerator = ActiveModelReference.Scan(oScanCriteria) Dim oElements() As Element Dim oStringElements() As ChainableElement oElements = oEnumerator.BuildArrayFromContents ReDim oStringElements(0 To UBound(oElements)) Dim i As Long For i = 0 To UBound(oElements) Set oStringElements(i) = oElements(i) Next i Dim chained As ComplexStringElement Set chained = AssembleComplexStringsAndShapes(oStringElements) ' Add the element to the active model (whether or not it's displayed) ActiveModelReference.AddElement chained End Sub
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan
Sorry, should have figured that would help.
Attached example. Layer "Lines" is the one to check -- on which I would be operating.
Running that method (StringChainer from the previous post) on that level results in a type mismatch error for me.
EDIT: I attached the MVBA as well.
Chaining.mvba
temp_Chaining.dwg