Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

PutAllArray method for elements - Femap API

Hi all,

 

I am trying to use the Putallarray method for the fast creation of elements, however I cannot get it to work using the line below. 

 

RC = Elem.PutAllArray(Num_Elem, eNID, PID, Elemtype1, TOP, layer, color, Form, Orien, Offset, Releases, OrientSet, OrientID, Nodes, connect_type, connectSEG)

 

The sub does work if I replace the above line with a loop based on element.put method. In this method I used the input from the array's. Which makes me think the input in the array's is good, at least for the ones referenced by the element.put method. I have attached the code in a text file, where both methods are included.

 

If anyone knows what's going wrong your help is much appreciated! 

 

Regards,

Marcel

 

2 REPLIES
Solution
Solution
Accepted by topic author Marcel23
‎12-21-2016 08:06 AM

Re: PutAllArray method for elements - Femap API

Your connect_type and connectSEG arrays are too small. They both need to be 2*Num_Elem in size, not just 2. 

 

Alternatively, for arrays like this where you probably want to define every element the same, instead of allocating and filling the entire array, you can do something like this...

 

Dim connect_type As Long
connect_type = 0

Dim connectSEG As Long
connectSEG = 0

 

In this case FEMAP will treat the single Long value as if you had done

 

Dim connect_type () As Variant
ReDim connect_type (1 To 2* Num_Elem)

For i = 1 To Num_Elem

  connect_type(i) = 0

Next i

Re: PutAllArray method for elements - Femap API

Thank you for your help!