Help to translate simple VBA code to Python

Alexandr N Zamaraev tonal at promsoft.ru
Mon Feb 11 07:15:34 CET 2008


I use Bentley MicroStation through Automation interface.
But I do not known how translate some VBA code to Python.
For example ("Copy Element Example" from documentation):

<code>
'The following code starts the command
Sub RunCopyElement()
     CommandState.StartLocate New clsCopyElementCommand
End Sub

'This following code must be in a class that implements 
ILocateCommandEvents. In this example, it is in the class 
clsCopyElementCommand.

Implements ILocateCommandEvents

' This is called when the user enters a data point after the
'  LocateFilter has accepted an element
Private Sub ILocateCommandEvents_Accept(ByVal Element As Element, Point 
As Point3d, ByVal View As View)
'skip function body
End Sub

Private Sub ILocateCommandEvents_Cleanup()
End Sub

Private Sub ILocateCommandEvents_Dynamics(Point As Point3d, ByVal View 
As View, ByVal DrawMode As MsdDrawingMode)
'skip function body
End Sub

Private Sub ILocateCommandEvents_LocateFailed()
'skip function body
End Sub


Private Sub ILocateCommandEvents_LocateFilter(ByVal Element As Element, 
   Point As Point3d, Accepted As Boolean)
'skip function body
End Sub

Private Sub ILocateCommandEvents_LocateReset()
'skip function body
End Sub

Private Sub ILocateCommandEvents_Start()
'skip function body
End Sub
</code>
Also sample using interface ILocateCommandEvents: 
http://www.la-solutions.co.uk/content/MVBA/MVBA-MeasureArea.htm

All interface derived from IDiapach.

How to realize in Python without external DLL?



More information about the Python-list mailing list