comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » DXF and other CAD file formats
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
DXF and other CAD file formats [message #28300] Thu, 29 November 2001 06:15 Go to next message
Georg Wiora is currently offline  Georg Wiora
Messages: 13
Registered: November 2001
Junior Member
Hi everybody,

I have problems using the polyline feature in an IDLffDXF object. I connect 4 points with a line, using the CONNECTIVITY array. When I add this object, I allways get the following message:
% IDLFFDXF::PUTENTITY: DXF error: DXF Polyline: explicit connectivity ignored
For a little test program see the code below.

Does anyone know about this problem?

Is there any other free code to create 3D-CAD-Files formats like STL or IGES or whatever?

Thanks for your help!

Georg


---- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ---
PRO Write_DXF_Lines

dxf = OBJ_NEW('IDLffDXF')

; 4 points
points = DBLARR(3,5)
points(*,0) = [0,0,0]
points(*,1) = [1,0,0]
points(*,2) = [1,1,0]
points(*,3) = [1,1,1]
points(*,4) = [0,1,1]
; Connectivity
connect = [0,1,2]
; Create pointers
ppoints = PTR_NEW(points,/NO_COPY)
pconnect = PTR_NEW(connect,/NO_COPY)


; Create a polyline object
pline = {IDL_DXF_POLYLINE}
pline.Vertices=ppoints
pline.Connectivity=pconnect
pline.Color=256
pline.DXF_Type=7 ; 7=POLYLINE
pline.BLOCK='' ; default block
pline.Layer='0' ; default layer

dxf->PutEntity, pline

IF NOT dxf->Write('test.dxf') THEN $
MESSAGE,'Write failed',/INFORMATIONAL

; Free pointers
PTR_FREE,ppoints
PTR_FREE,pconnect
OBJ_DESTROY,dxf

xdxf,'test.dxf'
END
---- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ---
Re: DXF and other CAD file formats [message #28329 is a reply to message #28300] Tue, 04 December 2001 09:37 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"Georg Wiora" <georg.wiora@DaimlerChrysler.com> wrote in message
news:1103_1007453886@rtulmrb142...

> Thank you Rick! I tried it, but it did not work. I got a hint
> from RSI that the polyline feature is not implemented in
> IDLffDXF yet.
> There seems to be another problem with IDLffDXF: The point
> coordinates I supplied to the object are clearly 3
> dimensional, but the object displayed with the XDXF procedure
> is flat!
>
> So there is either a lack of documentation for the IDLffDXF
> object or a lack of implementation :-(

Looking a little deeper, it really is ignoring whatever you put as the
connectivity. I did this after running your Write_DXF_Lines:

IDL> toView = Get_DXF_Objects('test.dxf')
IDL> o=toview->get()
IDL> xobjview,o

It looks like a flat polyline shaped like this: ] :-)
But this is what's surprising...

IDL> o->getproperty,polylines=poly
IDL> print,poly
5 0 1 2 3 4

... so it has five vertices, four segments, and...

IDL> o->getproperty,data=data
IDL> print,data
0.00000000 0.00000000 0.00000000
1.0000000 0.00000000 0.00000000
1.0000000 1.0000000 0.00000000
1.0000000 1.0000000 0.00000000
0.00000000 1.0000000 0.00000000

The five points are there, but they're all flattened to Z=0. Now I'm not a
fluent reader of DXF, but looking into the DXF file, it looks like there's
something called an AcDb2dVertex, here's a sample:

VERTEX
5
29
100
AcDbEntity
8
0
100
AcDbVertex
100
AcDb2dVertex
10
0.0
20
1.0
30
1.0
0

It looks like it *should* be the point [0,1,1] (that's XYZ at the end), but
it ends up treated as [0,1,0] when read in. I'd guess this is where
PutEntity is making a mistake.

Sorry, this probably doesn't help a lot, but it's curious.

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
Re: DXF and other CAD file formats [message #28340 is a reply to message #28300] Tue, 04 December 2001 00:18 Go to previous messageGo to next message
Georg Wiora is currently offline  Georg Wiora
Messages: 13
Registered: November 2001
Junior Member
Am Mon, 3 Dec 2001 09:45:07 -0800, hat "Rick Towler"
<rtowler@u.washington.edu> geschrieben:
> Although I haven't tried writing DXF files, my guess is
that your
> connectivity array is wrong. I know that if I were trying
to create an IDL
> (opengl) polyline, my connectivity array would have more
elements than that
> (in your case it would be [4,0,1,2,3]). I didn't see any
documentation
> regarding this in the IDLffDXF docs but there was an
example similar to
> yours. Maybe you should start there?

Thank you Rick! I tried it, but it did not work. I got a hint
from RSI that the polyline feature is not implemented in
IDLffDXF yet.
There seems to be another problem with IDLffDXF: The point
coordinates I supplied to the object are clearly 3
dimensional, but the object displayed with the XDXF procedure
is flat!

So there is either a lack of documentation for the IDLffDXF
object or a lack of implementation :-(

regards, Georg

#################################
Dr. Georg Wiora
DaimlerChrysler AG
Metrology and Rapid Prototyping
Ulm Germany
georg.wiora@DaimlerChrysler.com
#################################
Re: DXF and other CAD file formats [message #28354 is a reply to message #28300] Mon, 03 December 2001 10:21 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
> "Georg Wiora" <georg.wiora@DaimlerChrysler.com> wrote in message
> news:1104_1007043323@rtulmrb142...
>> Hi everybody,
>>
>> I have problems using the polyline feature in an IDLffDXF object. I
> connect 4 points with a line, using the CONNECTIVITY array. When I add
this
> object, I allways get the following message:
>> % IDLFFDXF::PUTENTITY: DXF error: DXF Polyline: explicit connectivity
> ignored
>> For a little test program see the code below.
>>
>> dxf = OBJ_NEW('IDLffDXF')
>>
>> ; 4 points
>> points = DBLARR(3,5)
>> points(*,0) = [0,0,0]
>> points(*,1) = [1,0,0]
>> points(*,2) = [1,1,0]
>> points(*,3) = [1,1,1]
>> points(*,4) = [0,1,1]
>> ; Connectivity
>> connect = [0,1,2]
>> ; Create pointers
>> ppoints = PTR_NEW(points,/NO_COPY)
>> pconnect = PTR_NEW(connect,/NO_COPY)
>>
>> ; Create a polyline object
>> pline = {IDL_DXF_POLYLINE}
>> pline.Vertices=ppoints
>> pline.Connectivity=pconnect

"Rick Towler" <rtowler@u.washington.edu> wrote in message
news:9ugdov$hd6$1@nntp6.u.washington.edu...
>
> Although I haven't tried writing DXF files, my guess is that your
> connectivity array is wrong. I know that if I were trying to create an
IDL
> (opengl) polyline, my connectivity array would have more elements than
that
> (in your case it would be [4,0,1,2,3]). I didn't see any documentation
> regarding this in the IDLffDXF docs but there was an example similar to
> yours. Maybe you should start there?

Rick's right, there is this clue in IDLffDXF::GetEntity help:

CONNECTIVITY is the array used to connect these points into polygons (see
the POLYGONS keyword for IDLgrPolygon::Init). If this array is not present,
the connectivity is implicit in (U, V) space defined by the values in
MESH_DIMS; the vertices represent a quad mesh of dimensions (MESH_DIMS[0],
MESH_DIMS[1]).

and this leads to this clue in IDLgrPolygon::Init:

A polygon description is an integer or longword array of the form: [n, i0,
i1, ..., in-1], where n is the number of vertices that define the polygon,
and i0..in-1 are indices into the X, Y, and Z arguments that represent the
polygon vertices.

This explains how to describe one polygon, but doesn't tell the whole story,
that you can put any number of polygons in one description array. It's just
treated as a 1D array of numbers, e.g.:

[3, 0, 1, 2, 4, 2, 1, 3, 4] describes two polygons:
| \ | / | \ \ / /
| indices | indices
# vertices # vertices

So we get a triangle joining vertices 0, 1 and 2, and a quadrilateral
joining vertices 2, 1, 3 and 4.

If you have a set of polygons of same type (same number of sides), you might
find it easier to work with a 2D array, e.g:

[[3, 0, 1, 2],
[3, 2, 1, 3],
[3, 3, 4, 0]] describes three triangles
| \ | /
| indices of each triangle
# vertices (will all be same)

This is a technique that comes up in a few places when working with IDL
polygons. Hope this helps.

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
Re: DXF and other CAD file formats [message #28355 is a reply to message #28300] Mon, 03 December 2001 09:45 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
I have waited a few days for someone who knows what they are talking about
to sound off and that hasn't happened. Sorry Georg, I guess you'll have to
put up with my response...

Although I haven't tried writing DXF files, my guess is that your
connectivity array is wrong. I know that if I were trying to create an IDL
(opengl) polyline, my connectivity array would have more elements than that
(in your case it would be [4,0,1,2,3]). I didn't see any documentation
regarding this in the IDLffDXF docs but there was an example similar to
yours. Maybe you should start there?

-Rick


"Georg Wiora" <georg.wiora@DaimlerChrysler.com> wrote in message
news:1104_1007043323@rtulmrb142...
> Hi everybody,
>
> I have problems using the polyline feature in an IDLffDXF object. I
connect 4 points with a line, using the CONNECTIVITY array. When I add this
object, I allways get the following message:
> % IDLFFDXF::PUTENTITY: DXF error: DXF Polyline: explicit connectivity
ignored
> For a little test program see the code below.
>
> Does anyone know about this problem?
>
> Is there any other free code to create 3D-CAD-Files formats like STL or
IGES or whatever?
>
> Thanks for your help!
>
> Georg
>
>
> ---- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here -------
Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ---
> PRO Write_DXF_Lines
>
> dxf = OBJ_NEW('IDLffDXF')
>
> ; 4 points
> points = DBLARR(3,5)
> points(*,0) = [0,0,0]
> points(*,1) = [1,0,0]
> points(*,2) = [1,1,0]
> points(*,3) = [1,1,1]
> points(*,4) = [0,1,1]
> ; Connectivity
> connect = [0,1,2]
> ; Create pointers
> ppoints = PTR_NEW(points,/NO_COPY)
> pconnect = PTR_NEW(connect,/NO_COPY)
>
>
> ; Create a polyline object
> pline = {IDL_DXF_POLYLINE}
> pline.Vertices=ppoints
> pline.Connectivity=pconnect
> pline.Color=256
> pline.DXF_Type=7 ; 7=POLYLINE
> pline.BLOCK='' ; default block
> pline.Layer='0' ; default layer
>
> dxf->PutEntity, pline
>
> IF NOT dxf->Write('test.dxf') THEN $
> MESSAGE,'Write failed',/INFORMATIONAL
>
> ; Free pointers
> PTR_FREE,ppoints
> PTR_FREE,pconnect
> OBJ_DESTROY,dxf
>
> xdxf,'test.dxf'
> END
> ---- Cut Here ------- Cut Here ------- Cut Here ------- Cut Here -------
Cut Here ------- Cut Here ------- Cut Here ------- Cut Here ---
>
>
Re: DXF and other CAD file formats [message #28456 is a reply to message #28300] Thu, 13 December 2001 02:27 Go to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
Georg,

No solution but just to reiterate:
Does anyone out there know of an alternative CAD reader to DXF format for
IDL which can read any of (.par, .igs, .stp, .stl, .sat)?

Thanks

Martin

"Georg Wiora" <georg.wiora@DaimlerChrysler.com> wrote in message
news:1104_1007043323@rtulmrb142...
>
> Is there any other free code to create 3D-CAD-Files formats like STL or
IGES or whatever?
>
> Thanks for your help!
>
> Georg
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Unable to acquire a GL context (IDLDE and w2000)
Next Topic: Re: Unable to acquire a GL context (IDLDE and w2000)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:37:51 PDT 2025

Total time taken to generate the page: 0.00633 seconds