cancel
Showing results for 
Search instead for 
Did you mean: 

API femap.feMeasureMeshMassProp

Legend
Legend

Hello,

 

i am trying to use femap.feMeasureMeshMassPro but it does work. It says problems with the types. Does anybody now why? I tried to use also "variant" instead of "array double type"

 

Csys=3

Dim leng, Area, volume, structMass, nonstructMass, totalMass As Double

Dim structCG(2) As Double
Dim nonstructCG(2) As Double
Dim totalCG(2) As Double
Dim inertia(5) As Double
Dim inertiaCG(5) As Double

rc = femap.feMeasureMeshMassProp(-1, 3, False, False, leng, Area, volume, structMass, nonstructMass, totalMass, structCG, nonstructCG, totalCG, inertia, inertiaCG)

6 REPLIES

Re: API femap.feMeasureMeshMassProp

Siemens Phenom Siemens Phenom
Siemens Phenom

There are several issues with the code below. The first is one that always gets me also since I don't do most of my coding in Basic. When you say...

 

Dim leng, Area, volume, structMass, nonstructMass, totalMass As Double

 

Only totalMass is a Double, the others are Variants. To make them all double you either need to split them on multiple Dim statements or say

 

Dim leng As Double, volume As Double, structMass As Double... etc

 

I know this seems like extra typing for nothing but unfortunately that is the correct Basic syntax.

 

The second issue is the one you already mentioned... all of the array types need to simply be Variants.  So

 

Dim structCG As Variant

Dim nonstructCG as Variant

etc...

 

Because of OLE/COM limitations Variants should always be used for Array parameters to methods. The only exception to that is if you are coding in the FEMAP API Window you can get away with using Dim'd Arrays instead of Variants for input arguments... Variants are still always required for arguments that are "output"

 

Hope this helps.

 

Re: API femap.feMeasureMeshMassProp

Legend
Legend

thanks for the answer. I will do it as you have explained it

Re: API femap.feMeasureMeshMassProp

Legend
Legend

Hi,

 

Here you are an example of how to declare the femap.feMeasureMeshMassProp objects:

 

Dim csysID As Long
Dim printResults As Boolean
Dim printDetails As Boolean
Dim longueur As Double
Dim area As Double
Dim volume As Double
Dim structmass As Double
Dim nonstructmass As Double
Dim totalmass As Double
Dim structCG As Variant
Dim nonstructCG As Variant
Dim totalCG As Variant
Dim inertia As Variant
Dim inertiacG As Variant

 

printResults = False
printDetails = False
csysID = 0

 

App.feMeasureMeshMassProp(ElemSet.ID, csysID, printResults , printDetails , longueur, area, volume, structmass, nonstructmass, totalmass, structCG, nonstructCG, totalCG, inertia, inertiacG)

 

 

 

Seifeddine Naffoussi

Re: API femap.feMeasureMeshMassProp

Legend
Legend

Thanks again for the help. It works

Re: API femap.feMeasureMeshMassProp

Creator
Creator

Hi,

I have a similar problem, followed all steps for fe.measuremeshmassprop, still it says :

API Error (Line 31): (10091) ActiveX Automation: no such property or method

 

My program is as follows:

could any one please help.

The HTML Clipboard

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

'Dim App As Object

Dim tmp, tmp2, a As Integer
Dim el, elset As Object
Dim cs As Variant
Dim lenth As Double
Dim area As Double
Dim structMass As Double
Dim nonstructMass As Double
Dim totalMass As Double
Dim structCG As Variant
Dim nonstructCG As Variant
Dim totalCG As Variant
Dim Inertia As Variant
Dim inertiaCG As Variant

Dim tmp1 As Integer

cs = Array(0, 0, 0)
'Set App = GetObject(, "femap.model")

Set el = App.feElem
Set elset = App.feSet()
tmp = elset.AddAll(FT_ELEM)
MsgBox (elset.Count)

App.feMeasureMeshMassProp(elset.setID, 0, False, False, lenth, area, volume, structMass, nonstructMass, totalMass, structCG, nonstructCG, totalCG, Inertia, inertiaCG)


End Sub

Re: API femap.feMeasureMeshMassProp

Legend
Legend

Hello Sarnath,

 

Try this code, I think it's work:

 

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

	Dim tmp, tmp2, a As Integer
	Dim el, elset As Object
	Dim cs As Variant
	Dim length As Double
	Dim area As Double
	Dim volume As Double
	Dim structMass As Double
	Dim nonstructMass As Double
	Dim totalMass As Double
	Dim structCG As Variant
	Dim nonstructCG As Variant
	Dim totalCG As Variant
	Dim Inertia As Variant
	Dim inertiaCG As Variant

	Dim tmp1 As Integer

	cs = Array(0, 0, 0)

	Set el = App.feElem
	Set elset = App.feSet()
	tmp = elset.AddAll(FT_ELEM)
	MsgBox (elset.Count)

	App.feMeasureMeshMassProp(elset.ID, 0, False, False, length, area, volume, structMass, nonstructMass, totalMass, structCG, nonstructCG, totalCG, Inertia, inertiaCG)
	MsgBox (Str(structMass))

End Sub

You forgot dimensioning variable volume, and I made a small corrections in feMeasureMeshMassProp.

 

Best regards,

 

Peter Kaderasz