MicroStation VBA doesn't include reference clipping in its API. You have to call some MDL functions. Read this article to find out more.
Regards, Jon Summers LA Solutions
Thanks for your reply. I'm interested in the clip boundary of the reference file.My main goal is to extract the points of the boundary.
Sujit Bhunia said:I'm interested in the clip boundary of the reference file.My main goal is to extract the points of the boundary.
What do you want to do with those points? What is the purpose of your VBA macro?
To get Clip Boundary and elements of reference file.
Sujit Bhunia said:get Clip Boundary and elements of reference file
In that case, the mdlClip_api is a better bet.
mdlClip_api
First, use the VBA Scan method on an Attachment to get the elements in that attachment. Next filter those elements using the clip functions.
Scan
Attachment
Declare MDL functions at the top of a VBA module, before any other code...
Declare Function mdlClip_getFence Lib "stdmdlbltin.dll" ( _ ByRef clipPP As Long ) As Long Declare Function mdlClip_isElemInside Lib "stdmdlbltin.dll" ( _ ByRef overlap As Long , _ ByVal edP As Long , _ ByVal clipP As Long , _ ByVal view As Long , _ ByVal allowOverlap As Long ) As Long Declare Sub mdlClip_free Lib "stdmdlbltin.dll" ( _ ByRef clipPP As Long Declare Function mdlClip_getRefBoundary Lib "stdmdlbltin.dll" ( _ ByRef clipPP As Long , _ ByVal modelRef As Long , _ ByVal view As Long ) As Long
In your scan method, get the clip descriptor from the attachment before you look for elements, and free the descriptor after you've finished the scan...
Sub ScanElementsInAttachmentClipBoundary ( _ ByVal oAttachment As Attachment, _ ByVal nView As Long) Dim clip As Long mdlClip_getRefBoundary clip, oAttachment.MdlModelRefP(), nView ... setup scan ... scan elements ... for each element Dim overlap As Long overlap = 0 Const AllowOverlap As Long = 0 ' Or -1 If mdlClip_isElemInside ( _ overlap, _ oElement.MdlElementDescrP(), _ clip, _ nView, _ AllowOverlap) Then ... do something with this Element End If ' Free clip descriptor mdlClip_free clip End Sub
Thanks for your replay,can you provide me in Programming C language using MDL api.
Sujit Bhunia said:can you provide me in Programming C language using MDL api
No: I am not Bentley Systems.
You can download the MicroStation SDK from the Bentley Systems software download site. The SDK includes the MDL Programming Reference manual and the MicroStationApi C++ manual. The SDK also provides many MDL examples.