Cancel
Showing results for 
Search instead for 
Did you mean: 

#Request# Code for meshing beams in API

Pioneer
Pioneer
Dear all the experts in Femap,
 
I am learning about programming in Femap and trying to make a small plugin to make the work easier.
Can anyone please offer me the code or bas file for meshing beam elements in API?
 
Best,
Zhengyu
43 REPLIES

Re: #Request# Code for meshing beams in API

Phenom
Phenom

When you use the term "meshing"... in Femap this typically means creating elements automatically on geometry,  Eg. 3D elements in solids; 2D elements on surfaces; or 1D elements along curves.  If you mean meshing beam elements onto curves, you need the Meshing Method "feMeshCurve". 

 

If you are using the beams as node-to-node links or rivets,then you may be interested in "feMeshClosestLink".

Re: #Request# Code for meshing beams in API

Legend
Legend

Dear Zhengyu,

 

 

We did similar tool to mesh example crane with beams. Here is an example of curve mesh:

In attachment you can find text file with code. 

 

 

curvemesh.png

 

Few important moments:

- You can set mesh size or number of elements using feMeshSizeCurve;

- You can mesh single curve or set of curve;

- After meshing call feCheckCoincidentNodes2 to merge nodes;

 

Yarko

 

P.S: my example is done in Visual Studio 2010 and Visual Basic.Net. If would like to run code in Femap (API Programming windows) use attached BAS file (there are minor changes in code).

Re: #Request# Code for meshing beams in API

Pioneer
Pioneer

Dear Yarko,

 

Thank you for your detailed reply. It is of great help. 

I searched your page and found some of your posts about constraints.

 

Here I want to raise another question.

During my modeling with Femap, I feel it quite annoying to click various buttons to do mesh for different groups. I think there should be a fast way to make this work to save time.
So here I want to ask if you have the code to define the  "Constraint","property type" and "Material".
 
Best,
Zhengyu

Re: #Request# Code for meshing beams in API

Legend
Legend

Dear Zhengyu,

 

 

I'm glad that example was helpful. 

I like to do automation or optimisation. In our company we have library with helpful functions on top of Femap. Maybe I can find there functions you need but I didn't understand completely your request.

 

Few questions to clarify:

1) You would like to have 3 different API tools to create Constraint, Property (different types) and Material?

2) In constraint tool you want to apply only nodal type or any type (on curve, on surface, on mesh)?

 

Waiting for your reply. 

 

P.S: I don't know if you saw on forum free tools for femap in my posts. Check them maybe they can be helpful to you as well: Mass Tuner and Thickness Plotter. Below you can find two links (registration is not required):

Mass Tuner - http://www.sdcverifier.com/sites/default/files/open/MassTunerPortable.zip

Thickness Ploter: http://www.sdcverifier.com/sites/default/files/open/Thickness%20Plot%20Portable.zip

 

Yarko

 

 

Re: #Request# Code for meshing beams in API

Pioneer
Pioneer

Dear Yarko,

 

Can't believe you reply so fast..Actually , your first reply gave me much inspiration.

 

Currently, I am making a plugin to connect Femap and Grasshopper to do parametric design and optimisation. To reach this goal,  I need to define the parameters like curves, loads, constraints, mesh, ... in GH and export them to Femap..That's why I need different API files.

About constraint I only need point or nodal.

 

You are really nice and helpful to offer me these desired information. I'll check the link tomorrow.

 

Best,

Zhengyu

Re: #Request# Code for meshing beams in API

Pioneer
Pioneer

Oh, I am in NL, it's 21:00 at this moment.

Re: #Request# Code for meshing beams in API

Legend
Legend

Dear Zhengyu,

 

 

It's very cool that you are doing the plugin.

Now it's clear what you need.

 

Our main office is also located in NL, so same time zone.

I found the parametric tool we did and in the evening I will prepare some examples.

 

The only one question: you wrote plugin in Femap (Programming API window) or use some external development environement (like visual studio)?

 

Yarko

Re: #Request# Code for meshing beams in API

Pioneer
Pioneer

Beste Yarko,

 

Are you also in Delft? What a coincidence!

I use Visual Studio with Grasshopper assembly(to provide the template) to make such a plugin.

 

Zhengyu

Re: #Request# Code for meshing beams in API

Legend
Legend

Dear Zhengyu,

 

 

Main office was in Delft but now it's in Haarlem.

But I'm working in other office (in Ukraine).

 

I found parametric tool we did for TU Delft enginerring course. I took few functions that can be helpfull:

- create material;

- create beam property (Nastran Box);

- create point;

- create curve;

- create surface;

The code for visual studio is attached in text file.

Material example:

CreateMaterialFunction.png

Beam Property:

CreatePropertyFunction.png

 

Tomorrow I will look for the following functions: create plate property, constraint and load.

 

Yarko

 

Warning: Code is written for Visual Studio and can not be executed in Femap Programming API window.