# [Gmsh] Create mesh for 1D geometry

Deepa deepamahm.iisc at gmail.com
Fri Feb 7 14:04:12 CET 2020

```Hi Max,

Thanks a lot. It works like a charm!

I'd like to know if it is possible to create NASTRAN bulk data file for
geometries like the following

[image: Untitled.png]

I have the geometry in  dwg and dxf file format created from AutoCAD.
Basically, I have specified coordinate positions to create points at every

Many thanks,
Deepa

On Fri, Feb 7, 2020 at 1:52 AM Max Orok <morok at mevex.com> wrote:

> Using the python api, building on Jeremy's nice example, but omitting
> physical groups:
>
> -----
> import gmsh
>
> delx = 0.5
> xend = 20
>
> gmsh.initialize()
>
> point_a = gmsh.model.geo.addPoint(0.0, 0.0, 0.0, meshSize=delx)
> point_b = gmsh.model.geo.addPoint(20.0, 0.0, 0.0, meshSize=delx)
>
>
> gmsh.model.geo.synchronize()
>
> # make a 1d mesh
> gmsh.model.mesh.generate(1)
>
> # save the mesh as a NASTRAN bulk data file
> gmsh.write("line.bdf")
>
> gmsh.finalize()
> -----
>
> Sincerely,
> Max
>
> On Thu, Feb 6, 2020 at 1:25 PM Jeremy Theler <jeremy at seamplex.com> wrote:
>
>> delx = 0.5;
>> xend = 20;
>> Point(1) = {0, 0, 0, delx};
>> Point(2) = {xend, 0, 0, delx};
>>
>> Line(1) = {1, 2};
>>
>> Physical Point("left") = {1};
>> Physical Point("right") = {2};
>> Physical Line("bulk") = {1};
>>
>> On Thu, 2020-02-06 at 23:11 +0530, Deepa wrote:
>> > >
>> > > I am a beginner here.
>> > >
>> > > I'm looking for ways of creating a mesh for a 2D geometry. It's a
>> > > straight line, the nodes have to be positioned along the x
>> > > directions and all y-coordinates have to be zero.
>> > >
>> > > Example: 0 : delx : xend, where delx =0.5, xend = 20.
>> > >
>> > > I have to create the input file in a format that will be compatible
>> > > for importing in COMSOL.
>> > >
>> > > Any suggestions on how to proceed will be really helpful
>> > >
>> > > Thanks,
>> > > Deepa
>> > >
>> > >
>> >
>> > _______________________________________________
>> > gmsh mailing list
>> > gmsh at onelab.info
>> >
>> > http://onelab.info/mailman/listinfo/gmsh
>> >
>> >
>>
>>
>> _______________________________________________
>> gmsh mailing list
>> gmsh at onelab.info
>> http://onelab.info/mailman/listinfo/gmsh
>>
>
>
> --
> Max Orok
> Contractor
> www.mevex.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20200207/49aa611c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled.png
Type: image/png
Size: 60375 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20200207/49aa611c/attachment-0001.png>
```