cancel
Showing results for 
Search instead for 
Did you mean: 

loading a library from API does not work

Creator
Creator

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

Re: loading a library from API does not work

Genius
Genius

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

Creator
Creator

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?