Help with XML file for curved line import

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
alle_kjellan
Posts: 5
Joined: Fri Mar 31, 2023 7:05 am

Help with XML file for curved line import

Post by alle_kjellan »

Hi, I have an XML file which describes a curved line in 3D space. Is there a simple way (or hard) to import this XML file and display the line in FreeCAD?

Thanks! /AK
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Help with XML file for curved line import

Post by wmayer »

Without the file we won't know.
alle_kjellan
Posts: 5
Joined: Fri Mar 31, 2023 7:05 am

Re: Help with XML file for curved line import

Post by alle_kjellan »

OK, thanks!

I have attached the XML files.

The XML files work fine with Tekla Structures.

Is there a specific way the XML needs to be formated?

/AK
Attachments
RoadOverHighwayAlignmentsForBridgeCreator.xml
(12.96 KiB) Downloaded 16 times
HighwayAlignmentsForBridgeCreator.xml
(92.07 KiB) Downloaded 9 times
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Help with XML file for curved line import

Post by wmayer »

The file format isn't something FreeCAD could load out of the box but it can be implemented as an add-on. Most of the XML elements are self-explanatory but not everything. Do you know if there are official specs available for this data format?
alle_kjellan
Posts: 5
Joined: Fri Mar 31, 2023 7:05 am

Re: Help with XML file for curved line import

Post by alle_kjellan »

OK, then how do I implement it as an add-on? How do FreeCAD read a XML? I dont know about official specs, the lines descibes roads for bridge engineering purposes.

Edit: How should the XML look like in order for FreeCAD to load and display the lines?

/AK
User avatar
chennes
Veteran
Posts: 3878
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with XML file for curved line import

Post by chennes »

Do you know any Python? What is needed is for someone (possibly you!) to write a Python tool that reads in that XML data, figures out what it means, and creates the appropriate shapes in FreeCAD. If you have the official specification for that file format it will probably be considerably easier (but still not totally trivial).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Help with XML file for curved line import

Post by heda »

obviously this is a different format, and one will need to either have full spec of said format or reverse engineer it.
but if you know a bit of python,
this Macro_3DXML_import can be used as starting point to decipher, parse and create fc geometry for any xml format
alle_kjellan
Posts: 5
Joined: Fri Mar 31, 2023 7:05 am

Re: Help with XML file for curved line import

Post by alle_kjellan »

Sorry for some missinformation. I now learned that the attached XML files are LandXML version 1.2, see http://www.landxml.org/Spec.aspx. Does this help to sole my problem?

/AK
User avatar
chennes
Veteran
Posts: 3878
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Help with XML file for curved line import

Post by chennes »

Well, sort of! As I said before:
chennes wrote: Fri Mar 31, 2023 3:48 pm What is needed is for someone (possibly you!) to write a Python tool that reads in that XML data, figures out what it means, and creates the appropriate shapes in FreeCAD.
You might investigate whether someone has written a converter for LandXML into a format FreeCAD already supports, though a look through the standard makes me think that's pretty unlikely. Otherwise, there's http://www.carlsonsw.com/support/softwa ... &ss_email=
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Help with XML file for curved line import

Post by wmayer »

When searching for "Landxml" in the forum you will find that some people has already worked on it. It's best to ping them directly and ask about the current status: search.php?keywords=landxml&style=3

It's mainly HakanSeven12 and Joel_graff

See also: https://github.com/joelgraff/freecad.trails
Post Reply