Is it possible to export the actual mesh used to display the model in
the viewport? Yes, I know you can export it as an STL and it's
options but you don't know how it's going to triangulate the model
until you've imported the STL into another program and viewed it
there. Is there a way to just say "make it just like the viewport" so
you can get it to the way you'd like it (lowest res without it turning
to crap for example) and export as is?
If I understood correctly, you'd like to display this tesselation
superimposed with your model, in wireframe ?
I can do it, for some money ...
As far as I know, the STL export will simply dump the triangulated model to
file "just like the viewport". You can actually show the tessellated model
in SW viewport by using the following macro:
Sub main()
Dim swApp As SldWorks.SldWorks
Set swApp = Application.SldWorks
Dim m As SldWorks.ModelDoc2
Set m = swApp.ActiveDoc
If m Is Nothing Then Exit Sub
m.ViewDisplayFaceted
End Sub
It does not, however, seem to work in SW 2008, what a pity!
-h-
Sorry, Philippe, I did not realize someone could ask money for a such macro
;o)
-h-
Hah, hah. That's cute. Figuring out the quirks of Solidworks' STL
exporter isn't rocket science but it is tedious. BTW if you're
charging for what amounts to a tip I don't think you'll get many
takers.
That seems to be the case (still importing the 700,000 poly mesh so
we'll see). Although it wasn't what I was looking for thank you very
much for the effort of providing the macro. I guess the part I'm most
frustrated with is the STL exporter in general. It seems to roll the
dice a lot if you know what I mean. You can have two identical
features and they'll come out triagulated differently- on the same
part. The only way to minimize this is to export the highest detail
possible but then you get a zillion needle-thin polys that renderers
HATE because as soon as you start playing with ratios and angles it's
gap city. And then there's the triangulation of the mesh in the
display itself. If you go to the lower resolutions it becomes most
noticable but it's as if every surface (not surface body but the
surface "faces" making up the solid bodies) is completely unaware of
it's adjacent faces. For instance the trangulation of the chamfer on
a cylinder might be clocked differently than the cylindrical surface
and end caps so you end up with gaps. WTF? Why isn't the thing smart
enough to know that if you split the cylinder into 24 segments you
DON'T split the chamfer into 27? Or that "hey, it might be a - now I
know this is radical- but it might be a good idea if the points line
up". End of rant.
The API does allow for a little more control over tesselations, it
even provides a TesselationQuality parameter(!)... but unfortunately
getting what you want probably is the sort of thing you're going to
have to pay for - it's definitely NOT a one-line macro. If you want
the sort of tesselations useful for FEA or what-have-you, you'd most
likely have to take control of ratios etc, and generate your own. The
problem is SW's tesselation algorithms are purely geared towards
display, as far as I can tell, and are speedy, but that's about it -
hence different touching features/faces tesselate differently.
oops (blush), I wasn't aware of ViewDisplayFaceted ...
was thinking about doing the same by drawing the mesh either in OpenGL
or in a 3d sketch...
Sorry. Will find a better way to make some money, one day ;-)
BTW, it does work on SW2008.
:-D That came into my mind, too. Btw, have you been able to draw OpenGL into
SW viewport? I've been playing with OpenGL some years ago, I even wrote a
SolidWorks screen saver which put your SW models flying on the screen. It
would be nice to see a sample project - I have an interesting idea I could
share.
>BTW, it does work on SW2008.
How did you do it? I did not succeed, I thought it was RealView issue or
something.
-h-