how to extract data including areas as XML, CSV, SVG?

  • Thread starter Thread starter Graeme
  • Start date Start date
G

Graeme

Hi

I'm actually a Java programmer familiar with XML and CSV and need to
write an application that processes information extracted from
AutoCAD.

At the moment I mainly need to find out if it is possible to extract
the information I want - if anyone can also tell me how to do it, that
would be much appreciated.

Given a building floor plan in AutoCAD I want to be able to extract
the size of enclosed areas and identifiers for the area's contents
(desks, filing cabinets, other attributes.)

Is it possible to extract this information as a simple XML or CSV
file? Is it possible to extract just this information without all the
superfluous information that is within the AutoCAD floorplan (although
I know I can filter that out if required.) And is it possible to
extract the floorplan as SVG for rendering in other applications?

Thank you for any help.

Graeme
 
Hi

Graeme said:
hmmmm.... not sure about this. Area calculations are going to be
quite complicated for arbitrary shapes - my junior school maths might
let me work out the areas of triangles and rhombuses (rhombi?) but
I'll struggle when the shape gets more complicated. Is it possible to
ask AutoCAD for the area calculations?

Now this is possible but there are a few limitations, but the best thing first ;
The "Area" function will in AutoCAD calculate both area and perimeter and store
these in the sys.var list . ------- You get these values _after_ you used the
"area" function in Lisp, by stating (getvar "Area") or (getvar "perimeter")
Shuld be obvious to you how to extract this to be the value of a symbol like
this ;
(setq my-area (getvar "arear"))
But trouble is that if you trigger the Arear command, you must do so with a call
to the "Command" function , and please don't confuse this with the command-line
prompt .
I just tried ;
( command "area" a b c "")
and this acturly work if I set a to one point , by (setq a (getpoint)) , ans
likevise with B and C.
Now from my point of view , you can judge a AutoLisp application from how many
Command function calls , --- the fewer the better as command calls make Lisp
into a macro language, but As you say there are no reson to write area
calculations yourself, when AutoCAD acturly offer a perfect area calculation
tool, even the results is not the yield of the function call, but stores among
the other system vars. and therefor need to be extracted seperatly, after you
fed point after point ending with Enter, or as when you feed it to the Command
function , end it with "" ------- that make an Enter hit ,when trigging a top
level function with the Command Lisp function.
---------- Hope you still follow.
Acturly you hit just the weak point of doing AutoLisp applications, as you need
to first gather the points for the Area function, then use the Command function
,with a serious restriction that you acturly don't know how _many_ points you
need to feed , and this realy is a weak point in AutoLisp that don't offer the
"&rest " variable list option , and this mean that you soon end up with quite
complicated Lisp programming, just becaurse the Area function work that way, and
don't have a AutoLisp counterpart as most other functions have, --------- but
with a bit care what you ask is possible.
One option is to make a polyline follow the points and then trigger the Area
function like this if the polyline is the last entity created ;
(command "area" "o" (entlast))
This way there can be as many points you want, as long as the Area function is
told to calculate an Object by the "o" option and pointed with the entity name
yieled by (entlast)

Acturly with Lisp, you can in one go and one line of code ,feed the calculation
formated as you want , to a file and then add next area. -------- also the Area
function is just nice, as you don't need any math. ; you just feed it with
points.

P.C.
http://www.designcommunity.com/scrapbook/2648.html
 
All of that very useful, time to actually get myself more acquainted
with AutoCAD itself and AutoCAD programming I think.

Many thanks for your help,

Graeme
 
Hi Graeme,

As for the SVG part: we have commercial software that batch converts
drawings to SVG from PDF or (E)PS input, both of which are
high-quality vector formats and easily created from AutoCAD (e.g.
PSOUT). Our software is available on Linux, Windows and UNIX
platforms. See URL below. You're welcome to send me a couple of sample
EPS/PDF files for testing if interested.

Jeroen Dekker
 
Back
Top