How to read & write xml elements into Autocad

How to read & write xml elements into Autocad

Anonymous
Not applicable
2,590 Views
10 Replies
Message 1 of 11

How to read & write xml elements into Autocad

Anonymous
Not applicable
Group,

I was wondering if someone could help me locate information related to xml
for use with drawing elements. I've searched all over the net and other than
landxml site I have yet to find any samples that show how to export drawings
elements to xml or control drawing elements from an xml file. The only data
I've found shows how to use the Landxml routines for input & export and I
want to see is if I can control placement of drawing elements linked by xml
if possible. I have several hundred routines which do a good job but to take
them to the next level of usability I'd like to see if I could write data
from these routines out to xml format so they could be used by other
utilities. as an example most of my routines use a baseline (two know
points) like an alignment in LDT where I select the same control points over
and over for processing the routines, I'd like to see if with the use of
xml I could possible link a project connection like LDT does where the
routines would know the controls points after a project have been created
and be able to toggle between several control points with N,E and N,E,Z.

My ultimate goal is to write most of our project data into xml file so that
it could not only be used by the vba utilities but also in our specs and
documents. I'll take any samples so that I can learn how to write data out
from a routine (xml) and be able to reuse that in tables, be able to input
blocks like the wblock xml or even draw polylines, lines

Any help, links, books, where to look for this type of information is
appreciated.

Thank you for your time & consideration
John
0 Likes
2,591 Views
10 Replies
Replies (10)
Message 2 of 11

dgorsman
Consultant
Consultant
Check out the MSXML documentation on MSDN. Have you read the W3C documentation on the XML standards?
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 3 of 11

Anonymous
Not applicable
sample drawing,

could I reproduce the linework in this drawing or move the endpoints with an
xml file?

could I reproduce the location and or offsets of the blocks with an xml
file?

could I link the start and end points (ones with leaders) so a form could
read from an xml file?




"Jcoon" wrote in message
news:5750406@discussion.autodesk.com...
Group,

I was wondering if someone could help me locate information related to xml
for use with drawing elements. I've searched all over the net and other than
landxml site I have yet to find any samples that show how to export drawings
elements to xml or control drawing elements from an xml file. The only data
I've found shows how to use the Landxml routines for input & export and I
want to see is if I can control placement of drawing elements linked by xml
if possible. I have several hundred routines which do a good job but to take
them to the next level of usability I'd like to see if I could write data
from these routines out to xml format so they could be used by other
utilities. as an example most of my routines use a baseline (two know
points) like an alignment in LDT where I select the same control points over
and over for processing the routines, I'd like to see if with the use of
xml I could possible link a project connection like LDT does where the
routines would know the controls points after a project have been created
and be able to toggle between several control points with N,E and N,E,Z.

My ultimate goal is to write most of our project data into xml file so that
it could not only be used by the vba utilities but also in our specs and
documents. I'll take any samples so that I can learn how to write data out
from a routine (xml) and be able to reuse that in tables, be able to input
blocks like the wblock xml or even draw polylines, lines

Any help, links, books, where to look for this type of information is
appreciated.

Thank you for your time & consideration
John
0 Likes
Message 4 of 11

Anonymous
Not applicable
dgorsman,

no not yet. This is my first look at xml other than using landxml from LDT &
C3D

John

wrote in message news:5750440@discussion.autodesk.com...
Check out the MSXML documentation on MSDN. Have you read the W3C
documentation on the XML standards?
0 Likes
Message 5 of 11

Anonymous
Not applicable
Hi,

The answer to all your questions is yes.

But you will need to have a suitable schema for the XML file.

The Land XML schema is only one of thousands of schemas and is not suitable
for drafting data.

I have some vague memory reading about a drafting schema and you are sure to
find something with a web search.

However, you could invent your own if the data is only to be used internally
and does not have to relate with other software using a defined schema.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com

"Jcoon" wrote in message
news:5750442@discussion.autodesk.com...
sample drawing,

could I reproduce the linework in this drawing or move the endpoints with an
xml file?

could I reproduce the location and or offsets of the blocks with an xml
file?

could I link the start and end points (ones with leaders) so a form could
read from an xml file?




"Jcoon" wrote in message
news:5750406@discussion.autodesk.com...
Group,

I was wondering if someone could help me locate information related to xml
for use with drawing
elements. I've searched all over the net and other than
landxml site I have yet to find any samples that show how to export drawings
elements to xml or control drawing elements from an xml file. The only data
I've found shows how to use the Landxml routines for input & export and I
want to see is if I can control placement of drawing elements linked by xml
if possible. I have several hundred routines which do a good job but to take
them to the next level of usability I'd like to see if I c
ould write data
from these routines out to xml format so they could be used by other
utilities. as an example most of my routines use a baseline (two know
points) like an alignment in LDT where I select the same control points over
and over for processing the routines, I'd like to see if with the use of
xml I could possible link a project connection like LDT does where the
routines would know the controls points after a project have been created
and be able to toggle between several control poi
nts with N,E and N,E,Z.

My ultimate goal is to write most of our project data into xml file so that
it could not only be used by the vba utilities but also in our specs and
documents. I'll take any samples so that I can learn how to write data out
from a routine (xml) and be able to reuse that in tables, be able to input
blocks like the wblock xml or even draw polylines, lines

Any help, links, books, where to look for this type of information is
appreciated.

Thank you for your time & conside
ration
John
0 Likes
Message 6 of 11

Anonymous
Not applicable
Laurie,

ok I'm ready, where should I look?

any books,blogs....links. This is my first try with xml simpler might be
better

Thanks
John

"Laurie Comerford" wrote in message
news:5750639@discussion.autodesk.com...
Hi,

The answer to all your questions is yes.

But you will need to have a suitable schema for the XML file.

The Land XML schema is only one of thousands of schemas and is not suitable
for drafting data.

I have some vague memory reading about a drafting schema and you are sure to
find something with a web search.

However, you could invent your own if the data is only to be used internally
and does not have to relate with other software using a defined schema.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com

"Jcoon" wrote in message
news:5750442@discussion.autodesk.com...
sample drawing,

could I reproduce the linework in this drawing or move the endpoints with an
xml file?

could I reproduce the location and or offsets of the blocks with an xml
file?

could I link the start and end points (ones with leaders) so a form could
read from an xml file?




"Jcoon" wrote in message
news:5750406@discussion.autodesk.com...
Group,

I was wondering if someone could help me locate information related to xml
for use with drawing
elements. I've searched all over the net and other than
landxml site I have yet to find any samples that show how to export drawings
elements to xml or control drawing elements from an xml file. The only data
I've found shows how to use the Landxml routines for input & export and I
want to see is if I can control placement of drawing elements linked by xml
if possible. I have several hundred routines which do a good job but to take
them to the next level of usability I'd like to see if I c
ould write data
from these routines out to xml format so they could be used by other
utilities. as an example most of my routines use a baseline (two know
points) like an alignment in LDT where I select the same control points over
and over for processing the routines, I'd like to see if with the use of
xml I could possible link a project connection like LDT does where the
routines would know the controls points after a project have been created
and be able to toggle between several control poi
nts with N,E and N,E,Z.

My ultimate goal is to write most of our project data into xml file so that
it could not only be used by the vba utilities but also in our specs and
documents. I'll take any samples so that I can learn how to write data out
from a routine (xml) and be able to reuse that in tables, be able to input
blocks like the wblock xml or even draw polylines, lines

Any help, links, books, where to look for this type of information is
appreciated.

Thank you for your time & conside
ration
John
0 Likes
Message 7 of 11

dgorsman
Consultant
Consultant
Start from scratch - learn about the XML format and how it works first. You can skim the W3C standards, they simply define the XML format and what values can be used. The MSXML documentation is *very* important, thats the interface you will be using (unless you write your own, which I don't recommend). Once you have that, you can have a look at what you need to store and how it will be accessed. That may take a couple of passes. After all that, you can start outlining program flow.

Sounds a little long winded (learning the good stuff rarely is), but you will get better, longer lasting results than the hack and slash machete code generated by web cut 'n' paste.
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 8 of 11

Anonymous
Not applicable
dgorsman,

I am going to try and learn xml but first I wanted to see if I got comments
from my questions & samples that indicated I could do some of the things I
wanted before I ran off trying to do something I couldn't do.

Thanks
John


wrote in message news:5750890@discussion.autodesk.com...
Start from scratch - learn about the XML format and how it works first. You
can skim the W3C standards, they simply define the XML format and what
values can be used. The MSXML documentation is *very* important, thats the
interface you will be using (unless you write your own, which I don't
recommend). Once you have that, you can have a look at what you need to
store and how it will be accessed. That may take a couple of passes. After
all that, you can start outlining program flow.

Sounds a little long winded (learning the good stuff rarely is), but you
will get better, longer lasting results than the hack and slash machete code
generated by web cut 'n' paste.
0 Likes
Message 9 of 11

dgorsman
Consultant
Consultant
Yes, you can, but it will be a complex task.
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 10 of 11

Anonymous
Not applicable
You don't have to post a sample file. The answer to your questions are all "yes", but you seem to be confusing XML files with applications/code or APIs that read and write XML files.

There is no existing application; code; or API that you can use, that is going to magically transform AutoCAD entities into XML, or the inverse. You must write the code that does that.

XML is just a file format. It's a tool programmers use to store data in a persistable/remotable form. That's all XML is. What you do with it is up to you, and anything you do with it requires you to be familiar with the XML format; how to design a schemas and transforms; how to read and write XML files from code, and so on.

LandXML is just a file format/schema that allows applications to write data in a form that other LandXML-enabled applications can read. LandXML, or the .XML file that contains LandXML data is not what does the actual work of reading data of AutoCAD or Civil3D objects and writing them to the XML stream. That is done by a lot of code in Civil3D.

And similarly, if you invent "JCoonsXML", that contains whatever information you want to store there, you must also write the code that reads and writes that data. IOW, an "XML file" does not do all of that for you, and there is no existing code/API that can do that for you either.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

"Jcoon" wrote in message news:5750442@discussion.autodesk.com...
sample drawing,

could I reproduce the linework in this drawing or move the endpoints with an
xml file?

could I reproduce the location and or offsets of the blocks with an xml
file?

could I link the start and end points (ones with leaders) so a form could
read from an xml file?




"Jcoon" wrote in message
news:5750406@discussion.autodesk.com...
Group,

I was wondering if someone could help me locate information related to xml
for use with drawing
elements. I've searched all over the net and other than
landxml site I have yet to find any samples that show how to export drawings
elements to xml or control drawing elements from an xml file. The only data
I've found shows how to use the Landxml routines for input & export and I
want to see is if I can control placement of drawing elements linked by xml
if possible. I have several hundred routines which do a good job but to take
them to the next level of usability I'd like to see if I c
ould write data
from these routines out to xml format so they could be used by other
utilities. as an example most of my routines use a baseline (two know
points) like an alignment in LDT where I select the same control points over
and over for processing the routines, I'd like to see if with the use of
xml I could possible link a project connection like LDT does where the
routines would know the controls points after a project have been created
and be able to toggle between several control poi
nts with N,E and N,E,Z.

My ultimate goal is to write most of our project data into xml file so that
it could not only be used by the vba utilities but also in our specs and
documents. I'll take any samples so that I can learn how to write data out
from a routine (xml) and be able to reuse that in tables, be able to input
blocks like the wblock xml or even draw polylines, lines

Any help, links, books, where to look for this type of information is
appreciated.

Thank you for your time & conside
ration
John
0 Likes
Message 11 of 11

Anonymous
Not applicable
Hi John,

A Google search for "xml for CAD data" will give you some further background
on Tony's expanations.

If you picture the XML file as simply another "database" file with (Trained)
human readable data, you can make a decision whether it is a good format for
storing your data.

Tony could tell you about .NET programming, but VBA programming to
read/write XML files is more complex than the programming to store the data
in a conventional SQL enabled database (such as Access) and in my
experience, data writing and data reading with XML are slower than using a
database. Geometric data for lines etc. can be easily stored in the AutoCAD
dwg (when is another database designed by Autodesk for holding this type of
data).

--


Regards

Laurie Comerford

--


Regards

Laurie Comerford

"Tony Tanzillo" wrote in message
news:5872010@discussion.autodesk.com...
You don't have to post a sample file. The answer to your questions are all
"yes", but you seem to be confusing XML files with applications/code or APIs
that read and write XML files.

There is no existing application; code; or API that you can use, that is
going to magically transform AutoCAD entities into XML, or the inverse. You
must write the code that does that.

XML is just a file format. It's a tool programmers use to store data in a
persistable/remotable form. That's all XML is. What you do with it is up to
you, and anything you do with it requires you to be familiar with the XML
format; how to design a schemas and transforms; how to read and write XML
files from code, and so on.

LandXML is just a file format/schema that allows applications to write data
in a form that other LandXML-enabled applications can read. LandXML, or the
.XML file that contains LandXML data is not what does the actual work of
reading data of AutoCAD or Civil3D objects and writing them to the XML
stream. That is done by a lot of code in Civil3D.

And similarly, if you invent "JCoonsXML", that contains whatever information
you want to store there, you must also write the code that reads and writes
that data. IOW, an "XML file" does not do all of that for you, and there is
no existing code/API that can do that for you either.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

"Jcoon" wrote in message
news:5750442@discussion.autodesk.com...
sample drawing,

could I reproduce the linework in this drawing or move the endpoints with an
xml file?

could I reproduce the location and or offsets of the blocks with an xml
file?

could I link the start and end points (ones with leaders) so a form could
read from an xml file?




"Jcoon" wrote in message
news:5750406@discussion.autodesk.com...
Group,

I was wondering if someone could help me locate information related to xml
for use with drawing
elements. I've searched all over the net and other than
landxml site I have yet to find any samples that show how to export drawings
elements to xml or control drawing elements from an xml file. The only data
I've found shows how to use the Landxml routines for input & export and I
want to see is if I can control placement of drawing elements linked by xml
if possible. I have several hundred routines which do a good job but to take
them to the next level of usability I'd like to see if I c
ould write data
from these routines out to xml format so they could be used by other
utilities. as an example most of my routines use a baseline (two know
points) like an alignment in LDT where I select the same control points over
and over for processing the routines, I'd like to see if with the use of
xml I could possible link a project connection like LDT does where the
routines would know the controls points after a project have been created
and be able to toggle between several control poi
nts with N,E and N,E,Z.

My ultimate goal is to write most of our project data into xml file so that
it could not only be used by the vba utilities but also in our specs and
documents. I'll take any samples so that I can learn how to write data out
from a routine (xml) and be able to reuse that in tables, be able to input
blocks like the wblock xml or even draw polylines, lines

Any help, links, books, where to look for this type of information is
appreciated.

Thank you for your time & conside
ration
John
0 Likes