converting paper space to model space in dxf files  
Author Message
apopescu





PostPosted: 2006-1-13 0:36:00 Top

java-programmer, converting paper space to model space in dxf files Hello wise guys!

I'm writing a piece of code (java) that shold parse and draw the
content of a DXF file. The trouble is that some blocks (usually texts
or legend) are given in paper space. Can anyone give me a hint how
paper coordinates should be converted to model coordinates? Thanks a
lot!

Adrian

 
Oliver Wong





PostPosted: 2006-1-13 4:40:00 Top

java-programmer >> converting paper space to model space in dxf files
<email***@***.com> wrote in message
news:email***@***.com...
> Hello wise guys!
>
> I'm writing a piece of code (java) that shold parse and draw the
> content of a DXF file. The trouble is that some blocks (usually texts
> or legend) are given in paper space. Can anyone give me a hint how
> paper coordinates should be converted to model coordinates? Thanks a
> lot!

Not familiar with DXF, but after some quick googling, and my preconceive
notions of the term "model space" and "paper space", it would seem like
there is no "one size fits all" solution to your problem.

Presumably, model space uses units for describing the scale of the
conceptual model, while paper space uses units for describing the scale of
things on a sheet of paper, when the model is printed out (onto a blueprint,
for example). So, perhaps text will be described as being in size 12 point
font, while an skyscrapper will be described as a couple of hundred meters
tall. Typically, you want to both be able to see the building, and read the
text at the same time.

I seems like the DXF files occasionally define a "view", which aids in
the creating a scale between paper space and model space. If your files
always contain a defined "view", you might want to investigate further in
that direction.

Otherwise, I can think of two basic design decisions. One is to just
prompt the user for what scale (s)he wishes to use. The other is to assume a
scale such that the size of the virtual sheet of paper is the same as the
size of your application's viewport (e.g. if your application is maximized,
then the paper size is approximately the same as the size of the whole
screen).

You would want to find an minimum enclosing rectilinear-rectangle that
encloses all the objects in paper space, and call that the size of the sheet
of paper, then scale it to fit the application viewport.

Do something similar for the model, so that the model is as zoomed in as
much as possible, while still having the whole model visible.

Then use these two sizes to calculate the ratio between model space and
paper space.

- Oliver