As we all know, Ray3d/Plane3d Intersection are Boolean function in VBA. We can use RaySolidIntersection method to get the intersection point between SmartSurface and Ray3d. However, if there are no intersection, error will be occur.
SmartSolidElement Object were introduced in MSV8i whereas in version 08.05.01 Bentley has known that similar issue. Thus, what are the general designed measures for Bentley to handle this runtime exception?
Reference:
Note that after MicroStation V8 2004 Edition (8.5.0), the Plane3dIntersectPlane3d and Plane3dIntersectRay3d methods were deprecated. These methods returned the intersection ray/point if one was found; otherwise they threw a runtime exception. Their replacements Plane3dIntersectsPlane3d and Plane3dIntersectsRay3d return a Boolean value to indicate the presence or absence of intersection and return in the first parameter the intersection ray/point if found.
clever_anthony said:what are the general designed measures for Bentley to handle this runtime exception?
Wrap a function that may cause an exception in an exception handler. Like this...
Sub ProcedureThatCatchesAnException () On Error Goto err_CaughtException ... your code here Exit Sub err_CaughtException: Select Case Err.Number Case -2147218305 ' Caught a specific exception Case Else ' Caught some other exception End Select End Sub
Regards, Jon Summers LA Solutions
Answer Verified By: clever_anthony
ic..... that is to ask us create a function RaySolidIntersections(outPoint, SmartSolidElement, Ray3d) As Boolean by ourself....
Thanks.
clever_anthony said:that is to ask us create a function RaySolidIntersections(outPoint, SmartSolidElement, Ray3d) As Boolean by ourself....
I think to create own libraries and to wrap existing API into own layers, better suited to particular project requirements, is daily developers' task ;-)
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I thought Bentley was long for a intact program solution. If you add an error handler, the drawback is you no longer get the runtime exception message box and stop the program automatically.
clever_anthony said:If you add an error handler, the drawback is you no longer get the runtime exception message box and stop the program automatically
Please study Microsoft VBA error handlers in more detail. If you write your own error handler, then you can decide what action to take when an exception occurs.
I don't think in VBA error handlers we can make a runtime exception message box which allow you to click "Debug" and automatically highlight that code which called that function :-(
clever_anthony said:I don't think in VBA error handlers we can make a runtime exception message box which allow you to click "Debug" and automatically highlight
VBA is Microsoft technology, which Microsoft considers to be obsolete. Things are not going to change.
clever_anthony said:I don't think in VBA error handlers we can make a runtime exception message box which allow you to click "Debug" and automatically highlight that code which called that function :-(
As Jon wrote: Check what VBA error handling mechanism is able to do. Even when it is limited, when implemented in the right way, it offers some flexibility.
But the question is why to use VBA, when advanced debugging options are required? To use VBA in MicroStation is always very limiting, offering an access to only a fraction of MicroStation features, through obsolete langauge and not actively developed API.
Hi,
I have investigated the use of the method RaySolidIntersection and filed the regression bug # 923862 with high priority.While in V8i an error handler was able to catch the runtime error, if the method does not provide a result, in CE it just fails.An error handler in CE is ignored and it seems there is no workaround. Best regards,Artur