Load two or more DXF files into one View and do layout
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Load two or more DXF files into one View and do layout
I am a new one to QCAD. And I am trying to do some work about load and display DXF file.
This post about "Loading and Displaying DXF file" helps a lot.
But what I need is to load two or more dxf files into one view and do layout work automatically, after that save the result as a new dxf file.
I have checked the API documents, but because I am newer here , I found nothing.
Is there someone kind enough to give me some script sample about that?
Thanks a lot!
This post about "Loading and Displaying DXF file" helps a lot.
But what I need is to load two or more dxf files into one view and do layout work automatically, after that save the result as a new dxf file.
I have checked the API documents, but because I am newer here , I found nothing.
Is there someone kind enough to give me some script sample about that?
Thanks a lot!
Re: Load two or more DXF files into one View and do layout
Hello Wang,
Please have a look at this script command line tool which merges multiple DXF/DWG files based on a simple XML input file:
https://github.com/qcad/qcad/blob/maste ... rawings.js
Actually, if you only need to merge drawings without displaying, etc, you might be able to use this tool out of the box. The XML format is:
input.xml:
This would merge the files myfile001.dxf and myfile002.dxf into output.dxf:
The tool is currently available in our git repository only, but will be included in the next QCAD release.
Please have a look at this script command line tool which merges multiple DXF/DWG files based on a simple XML input file:
https://github.com/qcad/qcad/blob/maste ... rawings.js
Actually, if you only need to merge drawings without displaying, etc, you might be able to use this tool out of the box. The XML format is:
input.xml:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<merge xmlns="http://qcad.org/merge/elements/1.0/" unit="Millimeter">
<item src="myfile001.dxf">
<insert x="0" y="0" angle="15" scale="1.2" flipx="true" flipy="false" />
<insert x="50" y="0" />
</item>
<item src="myfile002.dxf">
<insert x="100" y="50" angle="30" />
</item>
</merge>
Code: Select all
./merge -o output.dxf -f input.xml
Re: Load two or more DXF files into one View and do layout
The source is great.
I found that the source you gave, the paste operation do the work to merge two dxf files, that is good sample of know-how.
The positions and angles was pre-defined in XML file.
Should the position and angle be determined by user interactive operation or layout automatically positions calculated.
Another question is if two files were merged, could I still operate the dxf individually, such as drag to move or rotate the objects in one dxf file together to do layout work manully.
I found that the source you gave, the paste operation do the work to merge two dxf files, that is good sample of know-how.
The positions and angles was pre-defined in XML file.
Should the position and angle be determined by user interactive operation or layout automatically positions calculated.
Another question is if two files were merged, could I still operate the dxf individually, such as drag to move or rotate the objects in one dxf file together to do layout work manully.
Re: Load two or more DXF files into one View and do layout
You could simply use the QCAD Library Browser for this (View > Library Browser). It allows you to drag items form the part library into an empty drawing to merge them.wang wrote:Should the position and angle be determined by user interactive operation or layout automatically positions calculated.
Yes, the items are inserted as block references ('grouped') with block name = file name (myitem001.dxf creates block 'myitem001').Another question is if two files were merged, could I still operate the dxf individually, such as drag to move or rotate the objects in one dxf file together to do layout work manully.
- dfriasb
- Senior Member
- Posts: 119
- Joined: Thu Mar 10, 2016 1:08 pm
- Location: Calafell, Tarragona, Spain
Re: Load two or more DXF files into one View and do layout
Hello,
I'm using QCAD-Pro 3.15.3.0 in Mac OS X. I'm trying to use merge command but I had no success. I guess I have to activate some additional module or configuration in order to use "Command Line Tools", is it? And, has the XML file to be placed in some specific folder?
I would like also to ask why QCAD is using xml file format instead of csv, for example. It looks it should be easier to manage with merge kind of data (more like a table than like a tree, I think).
Thanks a lot. Best regards!
David
I'm using QCAD-Pro 3.15.3.0 in Mac OS X. I'm trying to use merge command but I had no success. I guess I have to activate some additional module or configuration in order to use "Command Line Tools", is it? And, has the XML file to be placed in some specific folder?
I would like also to ask why QCAD is using xml file format instead of csv, for example. It looks it should be easier to manage with merge kind of data (more like a table than like a tree, I think).
Thanks a lot. Best regards!
David
Re: Load two or more DXF files into one View and do layout
Hallo Andrew,
Hallo QCAD Experts,
at the time beeing i am struggling with the MERGE COMMAND LINE TOOL of QCAD. Is it possible to merge dxf files as single blocks (Layer) into one dxf file together?
Andrews answer gave me a bit of hope back : "Yes, the items are inserted as block references ('grouped') with block name = file name (myitem001.dxf creates block 'myitem001')." or did i understood something wrong?
Can i have a little example for the XML-Code with respect to my problem? How does it work?
I would be very grateful for a quick response.
Wish you all a nice and successful day!
Best,
Bo
Hallo QCAD Experts,
at the time beeing i am struggling with the MERGE COMMAND LINE TOOL of QCAD. Is it possible to merge dxf files as single blocks (Layer) into one dxf file together?
Andrews answer gave me a bit of hope back : "Yes, the items are inserted as block references ('grouped') with block name = file name (myitem001.dxf creates block 'myitem001')." or did i understood something wrong?
Can i have a little example for the XML-Code with respect to my problem? How does it work?
I would be very grateful for a quick response.
Wish you all a nice and successful day!
Best,
Bo
Re: Load two or more DXF files into one View and do layout
Yes, that's the idea behind merge. See my post above for a complete example (XML file and command line parameters).BoKai wrote:at the time beeing i am struggling with the MERGE COMMAND LINE TOOL of QCAD. Is it possible to merge dxf files as single blocks (Layer) into one dxf file together?
Re: Load two or more DXF files into one View and do layout
Hallo Andrew,Yes, that's the idea behind merge. See my post above for a complete example (XML file and command line parameters).
thank you for your fast response. Maybe i wasn't able to describe my problem good enough. As you already recognized - i am not a CAD pro.
What i try to achieve with respect to the XML-Manipulation are the following points:
Workflow description:
1) "Explode" the blocks into single objects
2) sort the entities into seperate layers like you mentioned Block name = file name. (Most important part)
3) Eleminate all block definitions
If there is a way to maipulate the xml file for this purpose, would be nice to get a hint or an XML-Example. Would definitely help me a lot.
Thank you in advance.
Best regards,
Bo
Re: Load two or more DXF files into one View and do layout
No, merge does not do that.BoKai wrote:1) "Explode" the blocks into single objects
Note that layers and blocks are two different concepts not to be confused:BoKai wrote:2) sort the entities into seperate layers like you mentioned Block name = file name. (Most important part)
http://www.qcad.org/rsforum/viewtopic.php?f=47&t=3736
Again, not a part of the merge tool. merge only creates a new drawing file with blocks for the various 'merged' drawings in it. Everything else would have to be done in a separate (command line) tool.BoKai wrote:3) Eleminate all block definitions