helppyFormex - Support: sr #108394, Export Wire stent in INP or CAD...

 
 

sr #108394: Export Wire stent in INP or CAD format

Submitted by:  None
Submitted on:  Fri 20 Sep 2013 10:07:53 AM UTC  
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Open Operating System:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Thu 18 Sep 2014 08:18:32 AM UTC, comment #10: 

Re comment #8:

I think the default TriSurface.close() method would work well in this case. Suppose open_mesh is the resulting triangle mesh from
sweeping:


from pyformex.plugins.surface import TriSurface
open_surf = TriSurface(open_mesh)
closed_surf = open_surf.close()

Benedict Verhegghe <bverheg>
Project Administrator
Thu 18 Sep 2014 08:13:03 AM UTC, comment #9: 

Re comment #7:

The mesh module contains a function QuarterCircle, which creates a quadrilateral mesh over a quarter circle. Reflecting it twice will create a full circle. Sweeping the resulting Mesh along the wires should produce a Hex8 mesh of the wires.

I include the QuarterCircle function below, for older versions not having it.



def quarterCircle(n1, n2):
    """Create a mesh of quadrilaterals filling a quarter circle.

    Parameters:

    - `n1`: number of elements along sides of the kernel
    - `n2`: number of elements through the border layer

    Returns a Mesh representing a quarter circle with radius 1 and
    center at the origin.

    The quarter circle mesh has a kernel of n1*n1 cells, and two
    border meshes of n1*n2 cells. The resulting mesh has n1+n2 cells
    in radial direction and 2*n1 cells in tangential direction (in the
    border mesh).

    """
    from pyformex.plugins.curve import Arc, PolyLine
    r = float(n1)/(n1+n2)  # radius of the kernel
    P0, P1 = Coords([[0., 0., 0.], [r, 0., 0.]])
    P2 = P1.rot(45.)
    P3 = P1.rot(90.)
    # Kernel is a quadrilateral
    C0 = PolyLine([P0, P1]).approx(ndiv=n1).toMesh()
    C1 = PolyLine([P3, P2]).approx(ndiv=n1).toMesh()
    M0 = C0.connect(C1, div=n1)
    # Border meshes
    C0 = Arc(center=P0, radius=1., angles=(0., 45.)).approx(ndiv=n1).toMesh()
    C1 = PolyLine([P1, P2]).approx(ndiv=n1).toMesh()
    M1 = C0.connect(C1, div=n2)
    C0 = Arc(center=P0, radius=1., angles=(45., 90.)).approx(ndiv=n1).toMesh()
    C1 = PolyLine([P2, P3]).approx(ndiv=n1).toMesh()
    M2 = C0.connect(C1, div=n2)
    return M0+M1+M2

Benedict Verhegghe <bverheg>
Project Administrator
Mon 04 Aug 2014 09:51:30 AM UTC, comment #8: 

Dear Mr. Verhegghe,

Thank you for your answer concerning the generation of a wirestent geometry in STL format.
I did what you suggested and it worked well.
The only problem is that the wirestent geometry generated is open at its extremities.
Is it possible to close the geometry by adding a 'disc' at each wire extremity?

Thank you in advance for your help.

Best regards.

Corso <pasco31>
Tue 15 Jul 2014 10:06:03 PM UTC, comment #7: 

Benedict wrote:

"Another note on the example: the swept cross section is the circumference of a circle, thus the resulting structure is one with hollow tubes along the wire axes. If you want solid wired, you would have to create a cross section first which is a surface."

Is there an example of how to create a circular cross section in order to create a solid wired double helix stent? Also how do I mesh the cross section so that the created solid wires are represented by 3D hexahedral elements?

Thank you.

Ismail Guler

Ismail Guler <guler>
Tue 22 Apr 2014 01:27:44 PM UTC, comment #6: 

The script attached below (https://savannah.nongnu.org/support/download.php?file_id=29226) creates surface meshes for the wires, using quadrilateral elements. These meshes can be converted to triangular meshes and then to a TriSurface, which can be exported in STL format.

Notice that the variable M in the script contains a nested list of surfaces: an individual mesh for each wire, grouped for the two winding directions. If you want a single STL model containing all wires, the best is to first concatenate all meshes into a single Mesh.

The following code would probably be what you want:

    # Concatenate the individual meshes
    M = Mesh.concatenate([ Mesh.concatenate(m) for m in M ])
    # Convert the Mesh to a TriSurface
    S = M.convert('tri3').toSurface()
    # Write the TriSurface to a file in STL format
    S.write('stentwires.stl', ftype='stla')

In the last line, you can use ftype='stlb' to get a binary STL
file.

 
Benedict Verhegghe <bverheg>
Project Administrator
Tue 22 Apr 2014 11:34:15 AM UTC, comment #5: 

I am a Ph.D. student at the University of Mons in Belgium and I would like to use the WireStent pyFormex geometry to perform CFD simulations.

For that purpose, is it possible to export the solid WireStent geometry (achieved thanks to the sweeping of a circular surface cross-section) into .STL (or parasolid, IGES...) format ?

If there is no way for exporting directly the geometry, is it possible to convert a .INP mesh into a geometry format ?

Thank you in advance.

Regards.

Corso <pasco31>
Thu 26 Sep 2013 03:07:22 PM UTC, comment #4: 

I attached a script that demonstrates the sweeping of a circular section along the wire axes of the stent. Also attached is an image of the result.

Some notes on the sweeping: You can sweep anything, but generally you want to sweep a plane figure. The sweep function requires a 'normal' to this plane figure, that will be aligned with the path tangent. If the plane figure is in the x,y plane, you set the normal to [0.,0.,1.], as in the comment of francesco. I got an error however in that case, but setting a very small x value made a work: normal=[0.0001,0.,1.]
Another way to avoid the problem is to rotate the plane figure in the x,y plane, and use the default [1.,0.,0.] normal. I used this in the attached file.

Another note on the example: the swept cross section is the circumference of a circle, thus the resulting structure is one with hollow tubes along the wire axes. If you want solid wired, you would have to create a cross section first which is a surface.

(file #29226,

Benedict Verhegghe <bverheg>
Project Administrator
Sat 21 Sep 2013 05:45:21 PM UTC, comment #3: 

If you dont have yet the mesh of the cicular section have a look at the Isopar example. For the sweeping check the examples Sweep and SweepBeams that do what you need.
Though to sweep you need to remove the connectors between the wires and sweep every wire separately. you can do easily using the command

sweepedmesh = Section.sweep(wire,normal=[0.,0.,1.],upvector=[0.,1.,0.]))

if you get weird results, try to change normal and upvector.
Make sure that you first convert every wire into a PolyLine using

wire = wire.toCurve()

francesco <francio>
Project Member
Fri 20 Sep 2013 10:30:14 AM UTC, comment #2: 

You have several options for exporting as an .inp to abaqus
The easiest one is to have your stent as a "mesh" format.
If it is a Formex, you can simply do .toMesh()
Then, there is a mesh function in the fe_abq.py plugin

from plugins.fe_abq import *
M.exportMesh(filename,mesh,eltype=None,header='')
You can then import the .inp into ABQ CAE to add loads, BC's etc (file -> import)

The fe_abq.py plugin is able to write a complete abaqus input file too (including sections, loads and steps and BCs). See e.g. the FeAbq.py example.

There also exists a Dxf export function in the dxf and dxf_menu plugin, which is able to export lines only. I have not used that one before, as the .inp export is easier.

For building a wirestent there is the WireStent.py example

Sander De Bock <sdebock>
Project Member
Fri 20 Sep 2013 10:15:40 AM UTC, comment #1: 

To export the wire stent from the pyFormex WireStent example, you can just add the following to the example's run() function:

    from plugins.fe_abq import exportMesh
    M = H.getFormex().toMesh()
    exportMesh('stent.inp',M,eltype='B31')

It transforms the geometry into a Mesh, and writes the Mesh in
Abaqus INP format, using a B31 element type. That will allow you
to import the model in Abaqus.

Benedict Verhegghe <bverheg>
Project Administrator
Fri 20 Sep 2013 10:07:53 AM UTC, original submission:  

I am PhD student at University of Calgary. My research is about designing stent.

I have just found the pyFormex software and want to use it for modeling of

Wire stent. I don’t know how can I export it in INP or CAD format.

Could you please help me to figure out this issue?

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #29227:  sweepstent.png added by bverheg (117KiB - image/png - Script and image illustrating the sweeping of a section along wire stent)
file #29226:  sweepstent.py added by bverheg (967B - text/x-python - Script and image illustrating the sweeping of a section along wire stent)
file #29187:  stent.inp added by mehdijam (1MiB - application/octet-stream - how can I sweep the circle among the wires? I think the WireStent which is is creates by WireStent Script is not geometry it is just sketch.)
file #29183:  wire stent.pyf added by mehdijam (264B - application/octet-stream - I use the WireStent script ( Script/examples/add/T-Z/WireStent ))

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by guler (Posted a comment)
  • -email is unavailable- added by pasco31 (Posted a comment)
  • -email is unavailable- added by francio (Posted a comment)
  • -email is unavailable- added by mehdijam (Updated the item)
  • -email is unavailable- added by sdebock (Posted a comment)
  • -email is unavailable- added by bverheg (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-26 bverheg Attached File- => Added sweepstent.py, #29226
        Attached File- => Added sweepstent.png, #29227
    2013-09-20 mehdijam Attached File- => Added stent.inp, #29187
    2013-09-20 mehdijam Attached File- => Added wire stent.pyf, #29183
    2013-09-20 sdebock CategoryExamples => None
        Assigned tobverheg => None
    2013-09-20 bverheg CategoryNone => Examples
        Assigned toNone => bverheg

    Back to the top


    Powered by Savane 3.5