To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10873
10872  |  10874
Subject: 
Re: dll file for use with Visual Basic Express
Newsgroups: 
lugnet.cad.dev
Date: 
Thu, 19 Jun 2008 15:42:53 GMT
Viewed: 
8642 times
  
In lugnet.cad.dev, Travis Cobbs wrote:
In lugnet.cad.dev, Roland Melkert wrote:
But I think, if there was going to be an 'official' LDraw api it should
be open source C++ or even C core wise.

You could then compile this 'core' source into a DLL for windows and
create additional source for Delphi, Visual Basic, etc wrapping it in
classes in the client language.

For what it's worth, LDView is Open Source (GPL v2), and all of its LDraw file
loading code is kept in a separate library (which I call LDLoader).  This
library depends on one other of my libraries (which I call TCFoundation, short
for Travis Cobbs's Foundation library).  In theory, anyone who is happy with GPL
v2 can use LDLoader from LDView, but I've never really advertised it as a
general-purpose solution.  LDLoader is C++.  Accessing it from C would require a
C wrapper library to be written.

LDLoader compiles and builds on Windows, Mac, and Linux (as well as likely other
platforms).  Also, in Windows it has been built under VC++ 6, VC++ 2003, VC++
2005, and VC++ 2008.

Since LDLoader makes sure not to have multiple copies of the same file loaded
into memory (it uses multiple references to the same data), it cannot provide a
full BFC solution.  Some of the actual BFC logic has to be in the code that
traverses LDLoader's tree, since a cylinder primitive (for example) can be used
in different places with three different BFC states: unknown, normal, or
inverted.

But it might be hard to create an efficient api because reading dat
files is mostly about pushing data around, and every application has
different requirements on how that data is used. Therefore the services
of the API might be little more then returning a list of eg triangle
coordinates.

LDLoader provides a model object (LDLMainModel), and actually turning that into
geometry is the responsibility of the user.  All the model information is kept
in easily accessible format, though.  So, for instance when you're looking at a
triangle line, you get a list of 3 points, a color, and BFC info.  A quad line
is the same, but with 4 points.  Triangles, quads, lines and conditional lines
all share a common base class, so you can ask it for the point count and
individual points.  And LDView itself of course can act as a sample
implementation of using LDLoader.


And because most applications need different kinds of data structures
using the API might cause considerable overhead due to converting the
API data to internal data etc.

Well, the data needs to be loaded into memory, and while it's possible to load
things directly into your final data structures, I'm not sure it's possible to
do this particularly efficiently.  LDLoader caches all the files that have been
loaded so that when it comes to a reference to a file that has already been
loaded, it simply hooks into the existing one, instead of reloading the file.
Any good parser will do this, of course, but doing this while having the data
end up directly in final data structures is tough.  For example, many (most?)
LDraw tools really want parts to be individual entities.  So they don't need the
hierarchy of information underneath, they just want all the geometry for the
whole part.  So you need to first load the part as a hierarchy, and then
"flatten" it.  At the moment, part flattening is left up to LDLoader users (and
LDView is the only user), but I could add the flattening as a discreet operation
there fairly easily.

LDLoader also has some other useful stuff, like a primitive recognition class.
Create a subclass of that, and call into its primitive recognition function, and
it will call a different member function in your sub-class for each type of
recognized primitive, after having extracted all the pertinent data from the
filename (like knowing that 1-4cyli.dat is a cylinder primitive with 0.25 as the
cylinder fraction).  I do this while traversing the LDLoader's model tree to
trigger my custom primitive substitution code in LDView.

--Travis

I know that LDView is a very good tool. And I know also that the code is under
GPL.
But there are people out there (me too) that do not know about C or C++.
So it would be great to have a DLL to handle the core methods (and maybe
objects) for LDraw related file.
I am a programmer by hobby and I think not so bad with VB. But the other
languages I am not familar with and so my wish is to have a DLL that I can use
in my progs for LDraw related files.
If there is somebody (maybe you) that can make a DLL out of the source code I
would be glad, because then I do not need to code that.
Also I am with you that it would be best to have progs that can be used und many
OS. But for real, most people are using Windows.

This are just my thought about this issue.

cu
mikeheide



Message has 1 Reply:
  Re: dll file for use with Visual Basic Express
 
(...) I really should have responded to your original message before posting my message about LDView's parser. As far as I'm concerned, having a public VB parser for LDraw files would be great. I won't use it, but if others find it useful, that's (...) (16 years ago, 19-Jun-08, to lugnet.cad.dev)

Message is in Reply To:
  Re: dll file for use with Visual Basic Express
 
(...) For what it's worth, LDView is Open Source (GPL v2), and all of its LDraw file loading code is kept in a separate library (which I call LDLoader). This library depends on one other of my libraries (which I call TCFoundation, short for Travis (...) (16 years ago, 18-Jun-08, to lugnet.cad.dev)

8 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR