Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[CONNECT VBA] Modify ComplexShape

$
0
0

Hi!

I have a two functions for work with ComplexShape:

Public Function ModifyElements(PCo() As Point3d, PTm() As Double) As Long    
    Dim myScan As New ElementScanCriteria
    Dim myEnum As ElementEnumerator

    myScan.ExcludeAllTypes
    myScan.IncludeType msdElementTypeComplexShape
    
    Set myEnum = ActiveModelReference.Scan(myScan)
    
Dim Modify As Long Modify = 0 While myEnum.MoveNext Modify = 0 If myEnum.Current.IsComplexShapeElement Then Dim ee As ElementEnumerator Set ee = myEnum.Current.AsComplexShapeElement.GetSubElements While ee.MoveNext Dim p() As Point3d
' X before change (for test) p = ee.Current.AsVertexList.GetVertices Debug.Print "Old X = " & p(0).x Modify = Modify + ModifyVertexes(ee.Current, PCo, PTm) ' Here i have realy new X p = ee.Current.AsVertexList.GetVertices Debug.Print "New X = " & p(0).x
Wend Else Modify = ModifyVertexes(myEnum.Current, PCo, PTm) End If Wend End Function ' Function for modify vertices
Public Function ModifyVertexes(E As Element, PCo() As Point3d, PTm() As Double) As Long ModifyVertexes = 0 Dim i As Long, k As Long, p() As Point3d, DblID As Double DblID = CDbl(DLongToString(E.id)) For i = LBound(PCo) To UBound(PCo) If PTm(i) = DblID Then For k = i To UBound(PCo) If PTm(k) = DblID Then E.AsVertexList.ModifyVertex ModifyVertexes, PCo(k) ModifyVertexes = ModifyVertexes + 1 Else Exit For End If Next k Exit For End If Next i E.Rewrite E.Redraw End Function

In Microstation v8 this code works 100%.

But in Microstation Connect he is not coorect.

Example:

What should I do to make the code to work correctly?


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>