[idea] using XSL/XSLT to extend FreeCAD's XMLs
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
[idea] using XSL/XSLT to extend FreeCAD's XMLs
Following this discussion, where I tried to explain the benefits of using FreeCAD XML files for programmatic CAD instead of Python API, I did some research. Marc Jeanmougin, one of the Inkscape developers, suggested using the XSLT to extend XMLs. So I'm no expert by any means but using XSL/XSLT to extend FreeCAD's native XMLs seems like a great idea. Basically, you can have document transclusion, variables, procedures, generative design... it seems to be a full-fledged programing language.
I know Lei Zheng (aka RealThunder) has already added Link to FreeCAD 19* but using XSLT one can transclude one XML into another even changing their internal parameters (as I have requested here). One can create templates and use them as classes inside other designs, Kind of like OOP but with XMLs. There are already Python libraries (e.g., lxml.etree) to pars XML+XSLT, so it shouldn't be impossible to implement.
I know Lei Zheng (aka RealThunder) has already added Link to FreeCAD 19* but using XSLT one can transclude one XML into another even changing their internal parameters (as I have requested here). One can create templates and use them as classes inside other designs, Kind of like OOP but with XMLs. There are already Python libraries (e.g., lxml.etree) to pars XML+XSLT, so it shouldn't be impossible to implement.
Last edited by foadsf on Sat Oct 12, 2019 9:04 pm, edited 1 time in total.
Re: [idea] using XLS/XSLT to extend FreeCAD's XMLs
I don't see why you need this nesting inside of the xml file. Could you explain this a bit further? I would think it is enough to create xml files of the same structure as they have now.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [idea] using XLS/XSLT to extend FreeCAD's XMLs
TL;dr: because of assembly and modularization.
Consider the SolidWorks workflow: you first design the parts and then import them into different assemblies multiple times. Though you can save them as separate files or right inside the assembly. As far as I can see this is the reason why RealThunder is developing the Link functionality.
Re: [idea] using XSL/XSLT to extend FreeCAD's XMLs
Here I'm being told that there are other options to have XML transclusion. For example, using W3C Xinclude specification or W3C standard XProc XInclude step. Also for variables, as suggested here by Martin Owens (one of Inkscape developers/maintainer), one can use XML namespace. Another option for having variables accross the XML file are the Entity References. All in all, I think a lot can be achieved with the XMLs and their extensions/flavors. There seems to be a lot of untapped potential in this corner of FreeCAD.
Last edited by foadsf on Sun Oct 13, 2019 12:13 pm, edited 1 time in total.
Re: [idea] using XLS/XSLT to extend FreeCAD's XMLs
I'm not familiar with SolidWorks, but watching Celica_Supra's videos it does not seem to be all that different.foadsf wrote: ↑Sat Oct 12, 2019 9:09 pm Consider the SolidWorks workflow: you first design the parts and then import them into different assemblies multiple times. Though you can save them as separate files or right inside the assembly. As far as I can see this is the reason why RealThunder is developing the Link functionality.
Link is already included in FreeCAD. There should be everything available to create a FreeCAD document. It doesn't have to have exactly the same structure as a SolidWorks file.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [idea] using XLS/XSLT to extend FreeCAD's XMLs
I'm not familiar with "Celica_Supra's videos" but one of the major differences between SolidWorks and FreeCAD workflow has been modularization. In SW, one can basically modularize the design into parts and assemblies and save them in separate files. So far, FreeCAD didn't have this option, and one had to clone a body internally, and there was no option AFIK to transclude parts/bodies/sketches/variables...
Again I'm not sure how Link is implemented. But using XML transclusion, one should be basically able to include any aspects of one design into another. Including a sketch, a variable in a spreadsheet...
Please consider that I'm not asking for a feature, but this is an open discussion to explore the possibilities of XML extensions and standards. As I said in this Tweet, there seems to be a lot of untapped potential in XML, which could significantly improve FreeCAD's capabilities, from version control, assembly and modularization to generative design ...
Re: [idea] using XSL/XSLT to extend FreeCAD's XMLs
Maybe @realthunder can shed some light/insight. He's the one behind App:Link
realthunder wrote:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: [idea] using XSL/XSLT to extend FreeCAD's XMLs
The XSL/XSLT idea may be useful if we are going to redesign FC, say build the document structure around XML DOM. In the current FC, we don't even use DOM. The XML semantic parsing is all hand written using SAX interface. For document persistence, Link simply stores the linked file path as a normal XML attribute, nothing special about it. The magic happens at a higher level, not at XML parsing.
Yes, with Link you can do that now. Of course, it is just the beginning. We can alway improve.foadsf wrote: ↑Sun Oct 13, 2019 11:45 am I'm not familiar with "Celica_Supra's videos" but one of the major differences between SolidWorks and FreeCAD workflow has been modularization. In SW, one can basically modularize the design into parts and assemblies and save them in separate files. So far, FreeCAD didn't have this option, and one had to clone a body internally, and there was no option AFIK to transclude parts/bodies/sketches/variables...
Re: [idea] using XLS/XSLT to extend FreeCAD's XMLs
Here is a link: https://forum.freecadweb.org/viewtopic.php?f=36&t=32131.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [idea] using XSL/XSLT to extend FreeCAD's XMLs
Perhaps adding this to the tracker wouldn't be a bad idea.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs