Cancel
Showing results for 
Search instead for 
Did you mean: 

FEMAP API: Creating pressure on element with datasurface using API code

Experimenter
Experimenter

Hi,

 

I have tried to create API code which will create "pressure on element" using data surface. I can easily create the load manually. I can not find support from loadmesh object for data surfaces. How loads should be created using API codes? Which object should be used?

 

I found one topic for creating geometric loads with data surface. According to my understandin I need geometry for that. I dont have that in my model.

 

Regards,

Risto Juujärvi

16 REPLIES

Re: FEMAP API: Creating pressure on element with datasurface using API code

Legend
Legend

Re: FEMAP API: Creating pressure on element with datasurface using API code

Experimenter
Experimenter

Hi,

I have understood that LoadGeom object can be used only with geometries. For my case I need an API which can create element pressures without geometry based models. I dont have geometries for the models which needs to be analysed.

 

Is it possible to create element pressures with API codes using data surfaces but without geometry? It can be done manually.

 

Regards,

Risto Juujärvi

Re: FEMAP API: Creating pressure on element with datasurface using API code

Legend
Legend

It should be feasible. you would use the LoadMesh instead of the LoadGeom

Look at the API help chapter : 5.37 LoadMesh objects.

Seifeddine Naffoussi

Re: FEMAP API: Creating pressure on element with datasurface using API code

Experimenter
Experimenter

I would appreciate a lot If you could assist me with Loadmesh object. I cannot find anything for datasurface under Ch. 5.37. Under LoadGeom object there is Loadgeom.datasurface command. Under loadmesh object there are no Loadmesh.datasurface command.

 

Regards,

Risto Juujärvi

Re: FEMAP API: Creating pressure on element with datasurface using API code

Legend
Legend

You are right. Now I want to make through mesh loading and it seems to be that there is no way to load data surface in a mesh not in a surface.  Any help it wolud be appreciate.

Re: FEMAP API: Creating pressure on element with datasurface using API code

Siemens Phenom Siemens Phenom
Siemens Phenom

You are correct in saying that there is no direct way on the Load Mesh object to specify a Data Surface to create Loads. However, you can approach this from the opposite direction...use the Data Surface object to evaluate load values that are then used to create individual loads. 

 

Here is a simple, not very elegant example.  Say I have a mesh of a square plate, using this Data Surface which simply specifies a linear variation from one corner to opposite diagonal corner...

 

 

ID = 1

 

Title = 2 Point Linear Data Surface

 

Type = 2 Point Linear, CSys = 0

 

0

1

2

3

4

5

6

 

Corners

Coordinates

Value

0

0.

0.

0.

0.

10.

 

 

1

1.

1.

1.

0.

30.

 

 

 

You can use the API to create loads like the attached picture.   

 

Here is the API that I used to create the loads. There is a lot you could still do to make it better...more error checking, specifying additional load information (color, load definition, etc..). It also creates the loads in a new load set each time.. you might want to simply choose an existing set, but that depends on what you need. In any case, the basics are here that you can follow and customize to your application.

 

Hope this helps.

 

The HTML Clipboard

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim d As femap.DataSurf
    Set d = App.feDataSurf

    Dim s As femap.Set
    Set s = App.feSet

    Dim e As femap.Elem
    Set e = App.feElem

    Dim ls As femap.LoadSet
    Set ls = App.feLoadSet

    Dim ld As femap.LoadMesh
    Set ld = App.feLoadMesh

    Dim xyz As Variant
    Dim v As Variant
    Dim pressure As Double


    If d.SelectID( "Choose Data Surface" ) = FE_OK Then
        If s.Select( FT_ELEM, True, "Choose Elements to Apply Pressure" ) = FE_OK Then
            ls.title = "Pressures from Data Surface" + Str$(d.ID)
            ls.Put( ls.NextEmptyID() )

            d.Evaluate( 0, FT_ELEM, s.ID, True )
            While e.NextInSet( s.ID ) = FE_OK
                e.GetFaceCentroid( 1, xyz )
                d.GetData( 0, 0, xyz, pressure, v )

                ld.setID = ls.ID
                ld.meshID  =e.ID
                ld.type = FLT_EPRESSURE
                ld.FaceNumber = 1
                ld.LoadValue = pressure

                ld.Put( ld.NextEmptyID() )

            Wend
        End If
    End If

End Sub

Re: FEMAP API: Creating pressure on element with datasurface using API code

Legend
Legend

Thanks a lot. It works after adaptaing some stuff. Just one probelm. If I run the macro internally in FEMAP /API programming it runs fast. If I do it through excel (vba) ,it takes a long time. 

Re: FEMAP API: Creating pressure on element with datasurface using API code

Siemens Phenom Siemens Phenom
Siemens Phenom

Unfortunately that is simply because of the overhead involved in OLE/COM transactions. We avoid some of that when running internally but can't do much about it when you run from outside the FEMAP environment. The best way to speed things up is to reduce the number of calls that you make. That is why we have a number of "array type" methods throughout the FEMAP API. You can accumulate information in your application and then load multiple things in one transaction. In your case, you might want to look into the AddArray() method of the Load Mesh object.

Re: FEMAP API: Creating pressure on element with datasurface using API code

Legend
Legend

You are right. So I decided to copy the routine in the API programming . But I have a problem. API does not understand for example Worksheets("Body_Pres_data_FEM_combi").Cells (1,1). Is there any way to call an excel cell when you are in the API programming environment?

I am trying but always error. Some help?