POV-Ray : Newsgroups : povray.off-topic : STL binary floating data. Server Time
27 Oct 2021 06:36:52 EDT (-0400)
  STL binary floating data. (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
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


 

From: Bald Eagle
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 22:25:00
Message: <web.5e66f99d517dbb514eec112d0@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:

> 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).

So, you're trying to export from CAD to STL so that you can render in POV-RAY
while you're in the process of making edits to the "mesh" model?


I'm wondering if you can somehow use FreeCAD in your workflow?

https://wiki.freecadweb.org/index.php?title=Raytracing_Module
https://wiki.freecadweb.org/Raytracing_tutorial

This is some pretty impressive work that you've done, and the results look
_really_ nice.   I wish I had some LISP or other language programming experience
to better offer a viable solution.

Hopefully someone who does will eventually see this thread and have some
suggestions.
Leroy and Dick Balaska seem to do a fair bit of coding like this.

I'm certainly interested in learning more about your work and how to implement
it.   There are a lot of people who _want_ to use POV-Ray but don't, because
there is no actively-supported modeler.

The rest of us use CSG, or some of us are driven to distraction writing
specialized workarounds....  ;)

http://news.povray.org/povray.binaries.images/thread/%3Cweb.5da27a2a65c96eb4eec112d0%40news.povray.org%3E/


Post a reply to this message

From: GioSeregni
Subject: Re: STL binary floating data.
Date: 9 Mar 2020 23:35:01
Message: <web.5e670a58517dbb512c923fbd0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "GioSeregni" <gms### [at] hotmailcom> wrote:
>
> > 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).
>
> So, you're trying to export from CAD to STL so that you can render in POV-RAY
> while you're in the process of making edits to the "mesh" model?
>
>
> I'm wondering if you can somehow use FreeCAD in your workflow?
>
> https://wiki.freecadweb.org/index.php?title=Raytracing_Module
> https://wiki.freecadweb.org/Raytracing_tutorial
>
> This is some pretty impressive work that you've done, and the results look
> _really_ nice.   I wish I had some LISP or other language programming experience
> to better offer a viable solution.
>
> Hopefully someone who does will eventually see this thread and have some
> suggestions.
> Leroy and Dick Balaska seem to do a fair bit of coding like this.
>
> I'm certainly interested in learning more about your work and how to implement
> it.   There are a lot of people who _want_ to use POV-Ray but don't, because
> there is no actively-supported modeler.
>
> The rest of us use CSG, or some of us are driven to distraction writing
> specialized workarounds....  ;)
>
>
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5da27a2a65c96eb4eec112d0%40news.povray.org%3E/


A CAD and a rendering program have very different philosophies, so I'll show you
how my exporter works with a small example. It only translates simple faces and
lines. But I have a trick. Very simple and fast blocks in CAD, which they call
most useful blocks written for POV.
Instead the export for STL I need just to build the blocks (inc) to give to POV
making and testing the future inc files for my lib.
STL uses only faces, and therefore it is very suitable for helping CAD.


Post a reply to this message


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

Preview of image 'clipboard01.jpg'
clipboard01.jpg


 

<<< Previous 2 Messages Goto Initial 10 Messages

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