Cancel
Showing results for 
Search instead for 
Did you mean: 

How to create RSPLINE elements through API?

Valued Contributor
Valued Contributor

Hello, everybody!

 

I would like to write a routine to create rigid elements RSPLINE type automatically. The user should only select two lists, one of independent nodes and another of dependent nodes. The problem is that I looked up the FEMAP’s API Manual and couldn’t find a method or property that defines the element as a RSPLINE. Using FEMAP’s UI is quite simple, you just need to click at Model/Element in the Menu Bar, so click at “Type…” button; in the window that popups select rigid, click at “Formulation…” button and choose the option “RSPLINE” at the “NASTRAN” combobox. I needed to do the same thing, but using API. Does somebody know how to do this?

Besides, also needed to know how to define the dependent and independent nodes, once differently of the rigid elements RBE2 or RBE3 types, the node list must be supplied in a sequential order.

 

Best regards,

 

Fabiano.

4 REPLIES

Re: How to create RSPLINE elements through API?

Phenom
Phenom

Sorry I don't know the specific answer because I haven't done it and there appears to be no clear reference in the API.PDF - as you have clearly discovered.

 

However you may be able to deduce how to do it by creating an RSPLINE in Femap and then using an API to show you information about the element object's properties, such as type, shape, formulation, GetNodeLists etc.  You should then be able to create an API to replicate those properties for an element object.  If you're lucky, it might be as simple as there being two node lists/indexes (like slidelines), plus a particular formulation.

Re: How to create RSPLINE elements through API?

Valued Contributor
Valued Contributor

Hello, EndZ!

 

Regarding your statement: "you may be able to deduce how to do it by creating an RSPLINE in Femap and then using an API to show you information about the element object's properties, such as type, shape, formulation, GetNodeLists etc.", I don't know how to do this. I've already done something like this using macros; I recorded a specific operation, understood what Femap did and use the code on a new macro. If I understood, you are suggesting that I do the same thing, but with API. How to do this? In the Program File window there is a button to record the macros, but I couldn't find a record button in the API Programming window. If you could post a step-by-step here it would be helpful.

 


Best regards,

 

Fabiano.

Re: How to create RSPLINE elements through API?

Phenom
Phenom

If you are just starting out with API's then the Knowledge Base API articles and some of the stuff from Applied CAX is very useful.  You cannot "record" an API like you record a Program File, so the API is a more complex learning process, and every operation must be created by the user.

 

It may be easier for you to record a macro by creating an RSPLINE, but replace the recorded explicit node selection with the <USER> macro command (twice) for choosing the dependent and independent nodes.

 

Otherwise, if you must use an API, then I suggest that you create an RSPLINE in Femap, and then start off the API with something like this:

The HTML Clipboard

Sub Main
    Dim App As femap.model
    Set App = feFemap()
' Always in every API to connect API with Femap

    Dim feElem As femap.Elem
    Set feElem = App.feElem
    Dim elID As Long
Dim elType As Long
Dim elTopol As Long
'Declare and dimension variables
' feElem is an element object
' elID is the element ID
' elType is the element type
' elTopol is the element topology
' etc. etc. for other relevant element properties and node lists.
' Refer to section 5.21.1 of the API.PDF rc = feElem.SelectID( "Pick the RSPLINE Element off the screen" ) 'brings up a single entity selection box to pick the element off the screen. If rc <> -1 Then
Exit Sub
End If ' Continue only if an element was successfully selected.
rc = App.feViewShow( FT_ELEM, elID ) ' Highlight the element on the screen
rc = feElem.get(elID)
' Get / Load the element data elType = feElem.type
' type is a property of the element object see API.PDF section 5.21.1
elTopol = feElem.topology
' topology is also a property of an element Msg = "Selected Element Type is" +Str$(elType) rc = App.feAppMessage(FCM_NORMAL, Msg) ' Write in the Messages Window the value of the element Type. Msg = "Selected Element topology is" + Str$(elTopol)
rc = App.feAppMessage(FCM_NORMAL, Msg) ' Write in the Messages Window the value of the element Topology.
' Similar things should be done for other relevant element properties
' And you will also need to use the GetNodeList element object method
' But RSPLINE was probably the most complicated of elements to start
' with to learn about element object properties etc.

' Once you reverse engineer the properties and lists of the RSPLINE element
' then creating an RSPLINE involves Getting an empty element then
' populating the element properties and node lists and then Putting
' the element so it is saved in the model.
' Whether by API or by macro, you will need to graphically
' select the nodes, unless you have a well arranged node numbering scheme. End Sub

Re: How to create RSPLINE elements through API?

Siemens Phenom Siemens Phenom
Siemens Phenom

Assuming you already had Nodes 1 thru 4 in your model, here is some sample code to create an RSPLINE element using those nodes. I don't claim that this is a valid Nastran RSPLINE... this just shows how to set it up. You can easily add more nodes or change the DOF for any node by changing the values being set below.  Hope this helps.

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

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

    Dim nd(3) As Long
    Dim face(3) As Long
    Dim wt(3) As Double
    Dim dof(6*4) As Long

    e.type = FET_L_RIGID
    e.topology = FTO_RIGIDLIST
    e.formulation(1) = 4
    nd(0) = 1
    nd(1) = 2
    nd(2) = 3
    nd(3) = 4

    dof(6*1+0) = 1
    dof(6*1+1) = 1
    dof(6*1+2) = 1

    dof(6*2+0) = 1
    dof(6*2+1) = 1
    dof(6*2+2) = 1

    wt(0) = 0.15

    e.PutNodeList( 0, 4, nd, face, wt, dof )
    e.Put(1)

End Sub