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

Home » Public Forums » archive » Create DXF file out of vertices and connectivities
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: Create DXF file out of vertices and connectivities [message #39992 is a reply to message #39913] Mon, 28 June 2004 23:38 Go to previous messageGo to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
[Please ignore my previous post, I improved my testing code for clarity]

"Karl Schultz" <kschultz_no_spam@rsinc.com> wrote in message
news:<10e0jrc69hn5715@corp.supernews.com>...
>
> "Tukee10" <turgutkaracay@hotmail.com> wrote in message
>
news:e6feeb9d9fa4d9dad40235e15f6ab40b@localhost.talkaboutpro gramming.com...
>> Hello,
>> I have following problem: I created the mesh structure of a volume
with
>> INTERVAL_VOLUME, which gives me vertices (3,n) and connectivities
(1,m).
>> When I display it with XOBJVIEW, I get a wonderful 3d structure. How
do I
>> create a DXF file that contains the mesh structure ?
>> I know that it works with an IDLffDXF object.
[...]
>> It creates a DXF file, but when I open the file with AutoCAD, it
seems to
>> connect all the point in a strange way.
>> Is there anyone who has an idea ?
>
> INTERVAL_VOLUME returns a list of vertices and a connectivity list
that
> represents tetrahedra (3D pyramid-like objects). If you used this
vertex
> list and this connectivity list to create an IDLgrPolygon that you
then
> displayed in XOBJVIEW, you should have seen quite a mess - or you got
very
> lucky.
>
> You should use TETRA_SURFACE [...]

"Tukee10" <turgutkaracay@hotmail.com> wrote in message
news:2d0234904ddaf48a12f5006bb0ae4bdb@localhost.talkaboutpro gramming.com...
> Thank you for your response.
> I forgot to add, that I`m using TETRA_SURFACE to display in XOBJVIEW,
> which worked quite well. It displays the mesh structure I want, but
when I
> write a DXF file, the mesh looks weird when I open it with AutoCAD. Is
> IDL_DXF_POLYGON the right structure format, if yes, does the DXF_TYPE
has
> to be 10 and are there other parameters to consider ?

Hi Tukee, Karl,

I tried this out too, and indeed it seems the file is mucked up. It does
look like a DXF writing bug to me. If you want to look further, here's
what I did:

=====

PRO WriteDXFTest

;; Make a surface (from online help for Interval_Volume)

RESTORE, FILEPATH('clouds3d.dat', $
SUBDIRECTORY=['examples','data'])
INTERVAL_VOLUME, rain, 0.1, 0.6, verts, conn
conn = TETRA_SURFACE(verts, conn)
; oRain = OBJ_NEW('IDLgrPolygon', verts, POLYGONS=conn, $
; COLOR=[255,255,255], SHADING=1)
; XOBJVIEW, oRain, BACKGROUND=[150,200,255]

;; Simplify mesh

ntri=mesh_decimate(verts,conn,connout,vertices=vertsdec, $
percent_poly=10)
verts=vertsdec
conn=connout

polyColor = [255, 0, 0]
dxfFile = 'Mesh_Model.dxf'
XObjView, Obj_New('IDLgrPolygon', verts, Polygons=conn, $
Color=polyColor), $
Title='IDLgrPolygon Made From Raw Data'

;; From Tukee10

ptr_verts = ptr_new(Verts)
ptr_conn = ptr_new(Conn)

oDXF = OBJ_NEW('IDLffDXF')
poly = {IDL_DXF_POLYGON}
poly.vertices = ptr_verts
poly.connectivity = ptr_conn
poly.dxf_type = 10

oDXF->PutEntity, poly
IF (not oDXF->Write(dxfFile)) THEN PRINT, 'Write Failed.'
OBJ_DESTROY, oDXF

;; Try it out

oModel = Get_DXF_Objects(dxfFile)
oDXFRead = oModel -> Get(/All) ; IDLgrPolygon
oModel -> Remove, /All

;; Vert_Colors are all black, change color to
;; something more visible
oDXFRead -> SetProperty, Vert_Colors=-1, Color=polyColor
XObjView, oDXFRead, Title='Read From DXF File'

END ; WriteDXFTest

=====

... it looks like mostly-correct points are being joined up in a
haphazard way, with a lot of joining of points in sequence along x and
y.

Are we missing something in the DXF writing?

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: Arrays
Next Topic: inverse function of binary.pro

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

Current Time: Sat Oct 11 09:41:14 PDT 2025

Total time taken to generate the page: 0.08241 seconds