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

How to use RemoveDatabaseLink for RIS data base connection (Oracle)

$
0
0

 

Hi,

I am tiring to remove all database links from a drawing which is NOT connected to the database.

I am using:

status = myElem.RemoveDatabaseLink(RIS, EmsLink)

But it does not remove the links as expected.

I used:  myLinks = myElem.GetDatabaseLinks(RIS) command

and was able to retrieve the data links information of the elements.

 

Here is the code I'm using, I hope you can tell me what I am doing wrong.

 

 

Public Function RemoveDBLinkage()


  
    Dim myLinks() As DatabaseLink
    Dim myLink As DatabaseLink
    Dim myElems As ElementEnumerator
    Dim Filter As New ElementScanCriteria
    Filter.IncludeOnlyVisible
    Set myElems = ActiveModelReference.Scan(Filter)
    Dim myElem As Element

    While myElems.MoveNext
         Set myElem = myElems.Current
         ' Retrieve the element's msLink and other DB entities
         myLinks = myElem.GetDatabaseLinks(RIS)
        
        Dim i As Integer
        'Assign the attributes to the EED_Elem entity
        For i = LBound(myLinks) To UBound(myLinks)
               Set myLink = myLinks(0)
               Set ClsElem = New EEDElement ' Create instance of the EED Element class and assign its properties
                ClsElem.EType = myLink.EntityNumber
                ClsElem.EidLow = myElem.id.Low
                ClsElem.EidHigh = myElem.id.High
               
               Dim LinkType As Long
               LinkType = myLink.DatabaseType
               ClsElem.EmsLink = myLink.msLink

            Dim status As Long
          ' Both commands are not removing the datalinks:
            status = myElem.RemoveDatabaseLink(RIS, ClsElem.EmsLink)
            myElem.RemoveAllDatabaseLinks
           
            If status = 1 Then Debug.Print EmsLink & " was removed"
       Next i
      
    Wend
    
 
End Function

/////

Thanks

Irina and Ella


Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>