[GRASS5] v.in.dxf

Hi,

I've committed v.in.dxf in CVS and it now supports z coordinate import, which
means v.in.dxf3d is not required to build a 3d vector file. The label import
feature in the previous version is not yet supported. Don't forget to run
v.build after v.in.dxf. In addition, v.surf.idw can read in z values from a 3d
vector.

Huidae Cho

Thanks very much. This will be a great help. Hopefully, label support can be
added soon.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Huidae Cho <grass4u@gmail.com>
Date: Fri, 24 Mar 2006 17:51:12 -0600
To: <grass5@grass.itc.it>, <grasslist@baylor.edu>
Subject: [GRASS5] v.in.dxf

Hi,

I've committed v.in.dxf in CVS and it now supports z coordinate import, which
means v.in.dxf3d is not required to build a 3d vector file. The label import
feature in the previous version is not yet supported. Don't forget to run
v.build after v.in.dxf. In addition, v.surf.idw can read in z values from a
3d
vector.

Huidae Cho

On 3/25/06, Huidae Cho <grass4u@gmail.com> wrote:

Hi,

I've committed v.in.dxf in CVS and it now supports z coordinate import, which
means v.in.dxf3d is not required to build a 3d vector file. The label import
feature in the previous version is not yet supported.

        fclose(layers[count].Map->dig_fp.file);
        layers[count].Map->dig_fp.file =
            G_fopen_modify(buf, GRASS_VECT_COOR_ELEMENT);

What was the intention?
BTW, vector structure members should never be accessed directly
in modules, use Vect_ functions.

Don't forget to run v.build after v.in.dxf.

I see Vect_build(layers[count].Map, stderr) in create_layers.c
and that builds topology.

It seems that you import each DXF layer as separate vector map?
I think that it would be better to import everything in one map
with more layers. You can assign layer to each line with cat.

   Vect_cat_set (Cats, layer_number, category );

Note that DWG/DXF files usually contain many layers, it is realy impractical
to import a single DXF as 60 GRASS maps.
It would also simplify the v.in.dxf code as you don't need to handle many
vector maps.

Radim

In addition, v.surf.idw can read in z values from a 3d
vector.

Huidae Cho

Actually, the current v.in.dxf is not a rewrite version, but a port from GRASS
5.x, so what I did is only to make it run with 6.x. That being said, I didn't
have enough time to improve it.

On Mon, Mar 27, 2006 at 10:18:37AM +0200, Radim Blazek wrote:

On 3/25/06, Huidae Cho <grass4u@gmail.com> wrote:
> Hi,
>
> I've committed v.in.dxf in CVS and it now supports z coordinate import, which
> means v.in.dxf3d is not required to build a 3d vector file. The label import
> feature in the previous version is not yet supported.

        fclose(layers[count].Map->dig_fp.file);
        layers[count].Map->dig_fp.file =
            G_fopen_modify(buf, GRASS_VECT_COOR_ELEMENT);

What was the intention?
BTW, vector structure members should never be accessed directly
in modules, use Vect_ functions.

According to the comment, the original version opened layers with
G_fopen_append() and needed to open it again with G_fopen_modify() to add head
info.

> Don't forget to run v.build after v.in.dxf.

I see Vect_build(layers[count].Map, stderr) in create_layers.c
and that builds topology.

That's what I added after the first posting.

It seems that you import each DXF layer as separate vector map?
I think that it would be better to import everything in one map
with more layers. You can assign layer to each line with cat.

   Vect_cat_set (Cats, layer_number, category );

Note that DWG/DXF files usually contain many layers, it is realy impractical
to import a single DXF as 60 GRASS maps.
It would also simplify the v.in.dxf code as you don't need to handle many
vector maps.

I agree with you on that. The module should import all layers automatically
regardless of whether or not users know the names of the layers that they want.
Selecting specific layers should be an option, not a default behaviour.

Huidae Cho

Radim

> In addition, v.surf.idw can read in z values from a 3d
> vector.
>
> Huidae Cho
>
>

At 10:48, lunedì 27 marzo 2006, Huidae Cho has probably written:

I didn't have enough time to improve it.

It would be great if someone could do it.
pc

--
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953

On 3/27/06, Huidae Cho <grass4u@gmail.com> wrote:

> fclose(layers[count].Map->dig_fp.file);
> layers[count].Map->dig_fp.file =
> G_fopen_modify(buf, GRASS_VECT_COOR_ELEMENT);
>
> What was the intention?
> BTW, vector structure members should never be accessed directly
> in modules, use Vect_ functions.

According to the comment, the original version opened layers with
G_fopen_append() and needed to open it again with G_fopen_modify() to add head
info.

I recommend to remove that.

> It seems that you import each DXF layer as separate vector map?
> I think that it would be better to import everything in one map
> with more layers. You can assign layer to each line with cat.
>
> Vect_cat_set (Cats, layer_number, category );
>
> Note that DWG/DXF files usually contain many layers, it is realy impractical
> to import a single DXF as 60 GRASS maps.
> It would also simplify the v.in.dxf code as you don't need to handle many
> vector maps.

I agree with you on that. The module should import all layers automatically
regardless of whether or not users know the names of the layers that they want.
Selecting specific layers should be an option, not a default behaviour.

It should be done before stable release (6.2.0).

Radim

On Mon, Mar 27, 2006 at 12:26:58PM +0200, Radim Blazek wrote:

On 3/27/06, Huidae Cho <grass4u@gmail.com> wrote:
> > fclose(layers[count].Map->dig_fp.file);
> > layers[count].Map->dig_fp.file =
> > G_fopen_modify(buf, GRASS_VECT_COOR_ELEMENT);
> >
> > What was the intention?
> > BTW, vector structure members should never be accessed directly
> > in modules, use Vect_ functions.
>
> According to the comment, the original version opened layers with
> G_fopen_append() and needed to open it again with G_fopen_modify() to add head
> info.

I recommend to remove that.

> > It seems that you import each DXF layer as separate vector map?
> > I think that it would be better to import everything in one map
> > with more layers. You can assign layer to each line with cat.
> >
> > Vect_cat_set (Cats, layer_number, category );
> >
> > Note that DWG/DXF files usually contain many layers, it is realy impractical
> > to import a single DXF as 60 GRASS maps.
> > It would also simplify the v.in.dxf code as you don't need to handle many
> > vector maps.
>
> I agree with you on that. The module should import all layers automatically
> regardless of whether or not users know the names of the layers that they want.
> Selecting specific layers should be an option, not a default behaviour.

It should be done before stable release (6.2.0).

Radim

Done in CVS except for layer selection. BTW, why does "d.vect layer=" display
ALL layers? I had to add cats=1-9999999 to see what's in a given layer. Is this
a feature?

d.vect map=mymap layer=4 # is the same as d.vect map=mymap
d.vect map=mymap layer=4 cats=1-99999999 # displays the layer 4

Huidae Cho

On 3/27/06, Huidae Cho <grass4u@gmail.com> wrote:

Done in CVS except for layer selection.

Thanks.

BTW, why does "d.vect layer=" display
ALL layers? I had to add cats=1-9999999 to see what's in a given layer. Is this
a feature?

d.vect map=mymap layer=4 # is the same as d.vect map=mymap
d.vect map=mymap layer=4 cats=1-99999999 # displays the layer 4

Yes, layer=4 should only display the layer 4. I think that evolution was
  d.vect
  d.vect cats=
  d.vect cats= layer=
but d.vect layer= was not implemented.

Radim

Huidae Cho

Is that correct that v.in.dxf works with version R12 only?
We tested with R14 and 2000, and got no results.
pc

At 21:31, lunedì 27 marzo 2006, Huidae Cho has probably written:

Done in CVS except for layer selection. BTW, why does "d.vect layer="
display ALL layers? I had to add cats=1-9999999 to see what's in a given
layer. Is this a feature?

d.vect map=mymap layer=4 # is the same as d.vect map=mymap
d.vect map=mymap layer=4 cats=1-99999999 # displays the layer 4

Huidae Cho

--
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953

v.in.dxf was originally written in 1989, so there is a great chance that it
will not work with a newer version of DXF. If you don't mind, could you please
give me DXFs that you tried so that I can take a look at the format?

Huidae Cho

On Thu, Mar 30, 2006 at 06:19:17PM +0200, Paolo Cavallini wrote:

Is that correct that v.in.dxf works with version R12 only?
We tested with R14 and 2000, and got no results.
pc

At 21:31, lunedì 27 marzo 2006, Huidae Cho has probably written:
>
> Done in CVS except for layer selection. BTW, why does "d.vect layer="
> display ALL layers? I had to add cats=1-9999999 to see what's in a given
> layer. Is this a feature?
>
> d.vect map=mymap layer=4 # is the same as d.vect map=mymap
> d.vect map=mymap layer=4 cats=1-99999999 # displays the layer 4
>
> Huidae Cho
--
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Is that correct that v.in.dxf works with version R12 only?

No. I don't know if it will work with anthing newer than R10.
Do you have it working with a R12 file?

We tested with R14 and 2000, and got no results.

You will need v.in.dwg for those.

see http://grass.itc.it/pipermail/grassuser/2006-March/033407.html
     https://intevation.de/rt/webrt?serial_num=2451

Hamish

At 05:10, venerdì 31 marzo 2006 you presumably wrote:

> Is that correct that v.in.dxf works with version R12 only?

No. I don't know if it will work with anthing newer than R10.
Do you have it working with a R12 file?

I confirm: it is working with R12 (still have to check whether anything is
missing, but it seems OK).

> We tested with R14 and 2000, and got no results.

You will need v.in.dwg for those.

Wouldn't it be feasible to upgrade v.in.dxf? Perhaps borrowing some code from
other software, like qcad?

see http://grass.itc.it/pipermail/grassuser/2006-March/033407.html
     https://intevation.de/rt/webrt?serial_num=2451

Hamish

--
Paolo Cavallini
email+jabber: cavallini@faunalia.it
www.faunalia.it
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy Tel: (+39)348-3801953

> > We tested with R14 and 2000, and got no results.
>
> You will need v.in.dwg for those.

Wouldn't it be feasible to upgrade v.in.dxf? Perhaps borrowing some
code from other software, like qcad?

I see that qcad claims to open dxf 2004, via "dxflib", which is GPL.

http://www.ribbonsoft.com/dxflib.html

Can you open your 2004 files in QCAD cleanly? resave from there in a
compatible format?

> see http://grass.itc.it/pipermail/grassuser/2006-March/033407.html
> https://intevation.de/rt/webrt?serial_num=2451

Hamish