Cancel
Showing results for 
Search instead for 
Did you mean: 

API Script Causing Femap to Crash

Valued Contributor
Valued Contributor

I have written a script to automatically generate PBUSH properties using some common aerospace methods for calculating fastener flexibility. Each time I run it, though, it seems to crash Femap. I've tried stepping through the script one line at a time, and everything seems to work as it's supposed to until it gets to the "End Sub" line. As soon as it passes over it, Femap goes unresponsive. Is there something I'm missing?

4 REPLIES 4
Highlighted

Re: API Script Causing Femap to Crash

Siemens Phenom Siemens Phenom
Siemens Phenom

The orient_csys.ID is not getting set properly if you leave it as whatever the default would be. 

 

orient_csys.ID = -1 

 

 With p_pbush
        .type = 6  ' spring/damper property
        .cbush = 1
        .flag(0) = orient_csys.ID  ' orient csys
        .refCS = orient_csys.ID
        .pval(36) = e_f * d^2 * pi / 4  ' k_x = (EA)_bolt
        .pval(37) = 1 / c  ' k_y = 1/c
        .pval(38) = 1 / c  ' k_z = 1/c
        .Put(.ID)
    End With

Re: API Script Causing Femap to Crash

Valued Contributor
Valued Contributor
That did it! Thanks! I changed it to default to the global rectangular (0) and it worked. Is `-1` always assumed to be the default value for an `ID` property? I've seen it used for specific entities, but couldn't find that anywhere in the documentation as a general rule.

Re: API Script Causing Femap to Crash

Siemens Phenom Siemens Phenom
Siemens Phenom

orient_csys.ID = -1 right at the line:

Set orient_csys = App.feCSys

It appears the objects are initialized to -1 until they are initialized in the API. 

Re: API Script Causing Femap to Crash

Valued Contributor
Valued Contributor
Ah, okay. Thanks!