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

VBA itemtype

$
0
0

Hey all,

I try to write a macro and the problem is: the run time error 451.

I’m an absolute beginner in vba in microstation. I need your help.

So, I got a dgn file (3D) made by ORD 10.01.00.15. I added extra properties by using “Item Types”.

“Objetosc2” stands for volume of element.

Next step is to find every mesh in model and copy its value of volume and paste it Objetosc2.

This is my code:

 

Sub ScanForElemsv2()'g_10.51
Dim oEnumerator As ElementEnumerator
Dim oScanCriteria As New ElementScanCriteria
Dim ee As ElementEnumerator
Dim l() As String
Dim found As Boolean

Set ee = ActiveModelReference.GraphicalElementCache.Scan
Do While ee.MoveNext

    If ee.Current.Type = msdElementTypeMeshHeader Then

        Set oProp = CreatePropertyHandler(ee.Current)

        ' All out by name:
        l = oProp.GetAccessStrings

        found = False
        For i = LBound(l) To UBound(l)
            Debug.Print l(i)   ' Lists all names in the VBA EDitor
            If l(i) = "Volume" Then found = True'GoTo ziomski
        Next'ziomski:
        If found Then
            oProp.SelectByAccessString("NowaVolume2") = l
        End If
    End If
Loop

End Sub

Any advice?

Regards

Paweł


Viewing all articles
Browse latest Browse all 7260

Latest Images

Trending Articles



Latest Images