Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

loading a library from API does not work

Hi 

i am trying to access a property library by the following code:

Sub getlib()
Dim app As Object
Set app = GetObject(, "femap.model")

Dim prop As Object
Set prop = app.feProp

prop.GetLibrary (1)
MsgBox (prop.title)

End Sub

though i have content in my library, it does not work the first time. suppose i edit once in FEMAP, then this works fine.

why?

could someone pls help me with is.

 

2 REPLIES
Solution
Solution
Accepted by topic author Sarnath
‎05-12-2017 01:53 AM

Re: loading a library from API does not work

You must first set the active element type using

App.Info_ActiveType (FT_ELEM) = "Type of Element/Property to Get from Library" or use the GetLibraryOfType method from the property object.  See the remarks of sections 5.1.2.2 and 5.49.3.10 of the API Reference.

 

Sub getlib()
    
    Dim app As Object
    Set app = GetObject(, "femap.model")

    Dim prop As Object
    Set prop = app.feProp

    app.Info_ActiveType(8) = 6
    
    prop.GetLibrary (1)
    MsgBox (prop.Title)

End Sub
Sub getlib()
    
    Dim app As Object
    Set app = GetObject(, "femap.model")

    Dim prop As Object
    Set prop = app.feProp

    prop.GetLibraryOfType 1, 6
    MsgBox (prop.Title)

End Sub

Re: loading a library from API does not work

Thank you so much, and got your point. 

The "app.Info_ActiveType" worked but "getlibraryoftype" did not work.

It said Object doesnt support this property of method. I also searched in my help but i could not find.

Is it due to version, i use 10.3.1?