POV-Ray : Newsgroups : povray.off-topic : STL binary floating data. Server Time
29 Mar 2024 07:52:30 EDT (-0400)
  STL binary floating data. (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: GioSeregni
Subject: STL binary floating data.
Date: 9 Mar 2020 08:35:01
Message: <web.5e663747abe031ad2c923fbd0@news.povray.org>
HI all.
One of my interests is export shapes during my work with IntelliCAD (but Autocad
is the same), using the lisp language at runtime.
I write *.pov, *.inc and *.stl also.
Unfortunately from cad i can only write STL with the heavy ASCII format, because
I have a problem with the lisp.
Autocad uses double precision float numbers. STL binary want single precision
floats. But the AutoLISP (seems that) does not allow me this conversion.
Allow me to ask here, maybe some experienced 3D programmer knows a solution?
Thanks in advanced!
G.


Post a reply to this message

From: jr
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 13:15:01
Message: <web.5e667876517dbb51451952ca0@news.povray.org>
hi,

"GioSeregni" <gms### [at] hotmailcom> wrote:
> HI all.
> One of my interests is export shapes during my work with IntelliCAD (but Autocad
> is the same), using the lisp language at runtime.
> I write *.pov, *.inc and *.stl also.
> Unfortunately from cad i can only write STL with the heavy ASCII format, because
> I have a problem with the lisp.
> Autocad uses double precision float numbers. STL binary want single precision
> floats. But the AutoLISP (seems that) does not allow me this conversion.
> Allow me to ask here, maybe some experienced 3D programmer knows a solution?
> Thanks in advanced!
> G.

STL to POV-Ray conversion has been discussed before, people seem to use various
utilities:
<http://news.povray.org/povray.general/thread/%3C59799a41%241%40news.povray.org%3E/?ttop=419996&toff=50&mtop=417481>

not being an "experienced 3D programmer" (but interested in file format
conversion(s)), I'd be tempted to output ASCII as now, then use a small (Tcl[*])
script to convert to binary STL.


regards, jr.

[*] guessing that, coming from LISP, you'll appreciate Tcl's list handling.


Post a reply to this message

From: Bald Eagle
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 13:30:01
Message: <web.5e667caf517dbb514eec112d0@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:
> HI all.
> One of my interests is export shapes during my work with IntelliCAD (but Autocad
> is the same), using the lisp language at runtime.
> I write *.pov, *.inc and *.stl also.
> Unfortunately from cad i can only write STL with the heavy ASCII format, because
> I have a problem with the lisp.
> Autocad uses double precision float numbers. STL binary want single precision
> floats. But the AutoLISP (seems that) does not allow me this conversion.
> Allow me to ask here, maybe some experienced 3D programmer knows a solution?
> Thanks in advanced!
> G.

Maybe you can post a question to another forum to get an answer that will let
you do exactly what you want?
https://stackoverflow.com/questions/21353376/how-to-use-double-float

If all else fails, in the meantime maybe try https://www.cadmesh.com/   ?

It would be nice if POV-Ray gets a READ binary command in the future.  :)


Post a reply to this message

From: GioSeregni
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 14:50:01
Message: <web.5e668f9f517dbb512c923fbd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "GioSeregni" <gms### [at] hotmailcom> wrote:
> > HI all.
> > One of my interests is export shapes during my work with IntelliCAD (but Autocad
> > is the same), using the lisp language at runtime.
> > I write *.pov, *.inc and *.stl also.
> > Unfortunately from cad i can only write STL with the heavy ASCII format, because
> > I have a problem with the lisp.
> > Autocad uses double precision float numbers. STL binary want single precision
> > floats. But the AutoLISP (seems that) does not allow me this conversion.
> > Allow me to ask here, maybe some experienced 3D programmer knows a solution?
> > Thanks in advanced!
> > G.
>
> Maybe you can post a question to another forum to get an answer that will let
> you do exactly what you want?
> https://stackoverflow.com/questions/21353376/how-to-use-double-float
>
> If all else fails, in the meantime maybe try https://www.cadmesh.com/   ?
>
> It would be nice if POV-Ray gets a READ binary command in the future.  :)

Thanks!
Interesting discussion, but unfortunately AutoLISP is a reduced version of the
LISP language, and does not have all the commands covered.
Unfortunately, I haven't been able to find them.
Regards! :)
G.


Post a reply to this message

From: GioSeregni
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 15:00:00
Message: <web.5e66917b517dbb512c923fbd0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "GioSeregni" <gms### [at] hotmailcom> wrote:
> > HI all.
> > One of my interests is export shapes during my work with IntelliCAD (but Autocad
> > is the same), using the lisp language at runtime.
> > I write *.pov, *.inc and *.stl also.
> > Unfortunately from cad i can only write STL with the heavy ASCII format, because
> > I have a problem with the lisp.
> > Autocad uses double precision float numbers. STL binary want single precision
> > floats. But the AutoLISP (seems that) does not allow me this conversion.
> > Allow me to ask here, maybe some experienced 3D programmer knows a solution?
> > Thanks in advanced!
> > G.
>
> STL to POV-Ray conversion has been discussed before, people seem to use various
> utilities:
>
<http://news.povray.org/povray.general/thread/%3C59799a41%241%40news.povray.org%3E/?ttop=419996&toff=50&mtop=417481>
>
> not being an "experienced 3D programmer" (but interested in file format
> conversion(s)), I'd be tempted to output ASCII as now, then use a small (Tcl[*])
> script to convert to binary STL.
>
>
> regards, jr.
>
> [*] guessing that, coming from LISP, you'll appreciate Tcl's list handling.
Thanks! If you are interested, this is my small Autolisp program.
I dont know if it works on your specific CAD without adjustments, I'm afraid
not, but the concept is this. 3DFACE ---> STL faces
WARNING all is working in a folder ... C:\CADEXT... and at the end It calls
Meshlab.
I put it only as a guide to the code, but it will certainly have to be adapted.
A minimum of experience is needed.
Regards!
G.


Post a reply to this message


Attachments:
Download 'cad2stl.zip' (3 KB)

From: GioSeregni
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 15:20:04
Message: <web.5e669669517dbb512c923fbd0@news.povray.org>
Otherwise the conversion to POV from Autocad needs (for me) another system.
STLs are geometry, architectural designs are something else.
Using LISP from my CAD I solved so.

FACES:
3Dfaces become mesh, simple, and the texture is chosen according to the name of
the CAD Layer.

Complex objects:
they are very simplified CAD blocks (dwg). Then my converter chooses much more
sophisticated objects (* .inc), specially written for POV.
The converter scales them if necessary, positions them, and loads the necessary
finishes.

This is a quick render ...


Post a reply to this message


Attachments:
Download 'cad2pov.jpg' (383 KB)

Preview of image 'cad2pov.jpg'
cad2pov.jpg


 

From: GioSeregni
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 15:45:02
Message: <web.5e669c72517dbb512c923fbd0@news.povray.org>
I forgot, the converter uses not only blocks and 3DFACE, but also 3DLINE and
Arcs. They become pipes (soften connected or not by small spheres [declared in
CAD]) with the diameter declared in CAD linetype scale.
The chosen layer defines color or texture.
This is a really quick system.


Post a reply to this message

From: jr
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 15:55:07
Message: <web.5e669dff517dbb51451952ca0@news.povray.org>
hi,

"GioSeregni" <gms### [at] hotmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > ...
> Thanks! If you are interested, this is my small Autolisp program.
> I dont know if it works on your specific CAD without adjustments, I'm afraid
> not, but the concept is this. 3DFACE ---> STL faces

thanks.  sorry, no CAD s/ware here.

had a v quick look at '2STL.lsp' (although I don't "speak" LISP), but the ASCII
format output is clear.

now thinking that if you were to write each face as as line of comma-separated
values instead (ie nx,ny,...,v3z), converting that CSV to binary STL would be
(famous last words.. :-)) trivial.

> ...


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 17:35:01
Message: <web.5e66b5b2517dbb514eec112d0@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> now thinking that if you were to write each face as as line of comma-separated
> values instead (ie nx,ny,...,v3z), converting that CSV to binary STL would be
> (famous last words.. :-)) trivial.

I believe jr is correct.

POV-RAY can read in the ASCII STL file, and write out the data to a binary STL.

As I have investigated doing this not long ago, the real PITA here is trying to
parse and process the ASCII in POV-RAY.

What _I_ wound up doing was just using a LibreOffice spreadsheet to go from
ASCII STL to a POV-RAY mesh object.   If that initial pre-processing step in the
workflow isn't a big deal, then you could do the same to format your ASCII STL
data, and then use POV-RAY to read in and write out a binary STL file.


Post a reply to this message

From: GioSeregni
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 21:50:00
Message: <web.5e66f0eb517dbb512c923fbd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> POV-RAY can read in the ASCII STL file, and write out the data to a binary STL.
>
> As I have investigated doing this not long ago, the real PITA here is trying to
> parse and process the ASCII in POV-RAY.
>
> What _I_ wound up doing was just using a LibreOffice spreadsheet to go from
> ASCII STL to a POV-RAY mesh object.   If that initial pre-processing step in the
> workflow isn't a big deal, then you could do the same to format your ASCII STL
> data, and then use POV-RAY to read in and write out a binary STL file.

Thanks! I have my import export for generale purpose, a lot of work in many
years, this problem is solved ...
The goal for export bin stl WHILE I am working on the CAD dwg, is for to view a
runtime quickly step by step the design, and without I have to save the dwg (or
DXF).
I am able to export in ASCII file from CAD immediately, it works fine but the
ascii is big and slow to write and to read...
I should understand how to write an AutoLISP function that reads a double float
but writes a single (as bin STL needs).
In the real LISP it is possible without trick, but in the reduct set of the
functions of AutoLISP does not have this option.
I saw on internet but to write a trick is over my capacity.
There is a need to build a binary string by manipulating the individual bits
:(


Post a reply to this message


Attachments:
Download 'clipboard01.jpg' (55 KB)

Preview of image 'clipboard01.jpg'
clipboard01.jpg


 

Goto Latest 10 Messages Next 2 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.