Cancel
Showing results for 
Search instead for 
Did you mean: 

API-calculatesummation2

Legend
Legend

Hello,

 

I am trying to use the "calculatesummatrion2" object but it does not work. It seems to work without erros but I can not find where. I always get 0 in the calculation values, I have checked the nodes and element selection and this is ok. Maybe with the freebody.display??.

I am using visual basic interface. Thanks in advance

 

Sub main()


'******************************************
Dim central_cyl_start, central_cyl_end As Double
Dim rc As Long

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

Dim entset_el As Object
Set entset_el = femap.feset
Dim entset_nd As Object
Set entset_nd = femap.feset


'******************freebody*******************************

Dim freebody As Object
Set freebody = femap.feFreebody

Dim nNUmsets As Long
Dim outsetIDS As Variant
Dim calculations As Variant
Dim sumcontributions(5) As Boolean


central_cyl_start = -5550 ' central cylidner beginning regarding water level
central_cyl_end = -26851 ' central cylidner ending regarding water level

Dim vbXYZ(2) As Boolean
vbXYZ(0) = False
vbXYZ(1) = False
vbXYZ(2) = True

Dim coordmin_el(2) As Double
Dim coordmax_el(2) As Double
Dim coordmin_nd(2) As Double
Dim coordmax_nd(2) As Double

coordmin_el(2) = central_cyl_start - 100
coordmax_el(2) = central_cyl_start
coordmin_nd(2) = central_cyl_start - 20
coordmax_nd(2) = central_cyl_start + 20

Dim vnmode(2) As Long
vnmode(0) = 3
vnmode(1) = 3
vnmode(2) = 3

rc = entset_el.AddCoordinate2(8, 3, vbXYZ, vnmode, coordmin_el, coordmax_el)
rc = entset_nd.AddCoordinate2(7, 3, vbXYZ, vnmode, coordmin_nd, coordmax_nd)

freebody.CSys = 0
freebody.DisplayMode = FBD_DISPLAYMODE_INTERFACE
freebody.group = 0
freebody.sumcontributions(0) = 1
freebody.sumcontributions(1) = 1
freebody.sumcontributions(2) = 1
freebody.sumcontributions(3) = 1
freebody.sumcontributions(4) = 1
freebody.sumcontributions(5) = 1
rc = freebody.setelements(True, entset_el.ID)
rc = freebody.SetNodes(True, entset_nd.ID)

Dim xyz_center_section As Variant

rc = freebody.CalculateNodalCenter(True, xyz_center_section)
freebody.x = xyz_center_section(0)
freebody.y = xyz_center_section(1)
freebody.z = xyz_center_section(2)

rc = freebody.CalculateSummation2(-10, False, nNUmsets, outsetIDS, calculations)

4 REPLIES

Re: API-calculatesummation2

Genius
Genius
It's difficult to tell w/o seeing your node and element selections, but are your SumContributions cancelling each other out? Maybe try setting SumContributions(4) = False

Re: API-calculatesummation2

Legend
Legend

ok I have changed the way of selecting making it interactively. Also I played with contribuitons flags. I have tried several output sets . It did not work. The point is that the centre of freebody is calculated correctly, Meaning that elements and nodes are selected correctly??

 

Sub main()

'******************************************
Dim central_cyl_start, central_cyl_end As Double
Dim rc As Long
Dim femap As Object
Set femap = GetObject(, "femap.model")
Dim entset_el As Object
Set entset_el = femap.feset
Dim entset_nd As Object
Set entset_nd = femap.feset

'******************freebody*******************************
Dim freebody As Object
Set freebody = femap.feFreebody
Dim nNUmsets As Long
Dim outsetIDS As Variant
Dim calculations As Variant
Dim sumcontributions(5) As Boolean


rc = entset_el.Select(8, True, "elements")
rc = entset_nd.Select(7, True, "Nodes")
freebody.CSys = 0
freebody.DisplayMode = FBD_DISPLAYMODE_INTERFACE
freebody.Group = 0
freebody.sumcontributions(0) = 1
freebody.sumcontributions(1) = 1
freebody.sumcontributions(2) = 1
freebody.sumcontributions(3) = 1
freebody.sumcontributions(4) = 0
freebody.sumcontributions(5) = 1
rc = freebody.setelements(True, entset_el.ID)
rc = freebody.SetNodes(True, entset_nd.ID)
Dim xyz_center_section As Variant
rc = freebody.CalculateNodalCenter(True, xyz_center_section)
freebody.x = xyz_center_section(0)
freebody.y = xyz_center_section(1)
freebody.Z = xyz_center_section(2)
rc = freebody.CalculateSummation2(-10, False, nNUmsets, outsetIDS, calculations)

Re: API-calculatesummation2

Genius
Genius
Do you have "Force Balance" checked on in the Nastran Output Request of your Analysis Set?

Re: API-calculatesummation2

Legend
Legend

Yes I have it. In fact firstly I am doing manually. Then check with the code. But I do not find the code error