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 
Return to the default flat view Create a new topic Submit Reply
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 previous 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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 19:31:42 PDT 2025

Total time taken to generate the page: 0.00445 seconds