[vba-v8iss3-v8 2004] v8i longer than v8

Hi All,

I'm using v8 2004 Ver08.05.02.70 And V8i 08.11.09.459

There is a difference of time's execution of this simple vba:

Sub speed_test2()
Dim Lg1 As LineElement
ActiveSettings.Scale.X = 2
ActiveSettings.Scale.Y = 2
ActiveSettings.Scale.Z = 2
For i = 0 To 100
Set Lg1 = CreateLineElement2(Nothing, Point3dFromXY(i, 0), Point3dFromXY(i, 100))
ActiveModelReference.AddElement Lg1
CadInputQueue.SendCommand ("scale")
CadInputQueue.SendDataPointForLocate Lg1, Point3dZero
CadInputQueue.SendDataPoint Point3dFromXY(i, 0)
CadInputQueue.SendReset
Next i
End Sub

Can you tell me why it's so longer with v8i ? Location ?? sendcommand ?

It's just an simple example, and I know it's not "pure vba" but what I am missing?

Laurent

Parents
  • Hi Laurent,

    what does it mean "so longer"? Is it ten times longer or even a hundred times? There is no guarantee API has the same speed in different versions. Many things has changed from V8 2004 Edition inside MicroStation, which is probably the reson of the different speed.

    Because there is no profiler available in MicroStation VBA, you should add a time counter to your code to check what step takes the most of the time.

    In my opinion your code is not very realistic, to use SendCommand, which simulates a user interaction, in a loop is nothing than should be found in well written code.

    So I think the target is not to discuss why one version is different to another (well, if it's hundreds time slower, of course report is as a bug), but if you will be able to identify what line is slower, to find a way how to optimize the code or to do the same thing in a different faster way.

    With regards,

     Jan

  • in  Microstation -VBA manner I would

    replace the scaling "CadInputQueue.SendCommand" with the MVBA equivalent tool set. Ther are plenty of examples in the help-file and indeed in the forum.

    Regards

    Frank

    since 1985: GIS, CAD, Engineering (Civil)  Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads,  HHK Geograf, IBr DAVID] :  Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML]
    [direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"
    Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)

  • Ok Jan and Frank,

    I undestand...

    In my real vba, i use the command "construct line minimum" between two elements: a point (lineelement in fact) and a ComplexStringElement ( Which I get subelements )

    So I Apply this command (construct line element) to each subelement 

    getLastValidGraphicalElement and compare the lenght of each lines ( keep the minimum length  and the endpoint of the line)

    So I don't find the good way in vba to  place a minimum line between a point and a element

    Sorry for my poor English, Merci

    Laurent


     

Reply
  • Ok Jan and Frank,

    I undestand...

    In my real vba, i use the command "construct line minimum" between two elements: a point (lineelement in fact) and a ComplexStringElement ( Which I get subelements )

    So I Apply this command (construct line element) to each subelement 

    getLastValidGraphicalElement and compare the lenght of each lines ( keep the minimum length  and the endpoint of the line)

    So I don't find the good way in vba to  place a minimum line between a point and a element

    Sorry for my poor English, Merci

    Laurent


     

Children