How can I ensure that a path is uninterrupted?
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
How can I ensure that a path is uninterrupted?
Hi All,
I have to programmatically create a large amount of 2D drawings for a laser cutting project and I'm trying to use QCAD and its ECMAScript interface for this task (no code yet, just few drawings). Each drawing will be different from any other so no manual tweaking or optimization "at the source" is possible. Each operation must be performed by code.
In particular, each drawing must be generated by concatenating a small number of sub-drawings (that is: QCAD Blocks) and, of course, the resulting block or drawing must be composed by continuous (uninterrupted) lines/curves/paths that a laser cutter could follow without problems.
How can I be sure that the result of my assembly operation is a continuous path? Is there any programmatic way to perform a check 'n fix?
I do not see any "automagically connect all selected entities" command in QCAD's menu so I understand I should perform my checks/fixes by hand. Unfortunately, this is not possible in this case because of the large amount of drawings I have to handle.
Does anybody know of any dependable way to create a laser-cuttable, smooth and uninterrupted path using the ECMAScript interface of QCAD (by concatenating a small set of blocks/entities into a larger block/drawing)?
Thanks in advance.
I have to programmatically create a large amount of 2D drawings for a laser cutting project and I'm trying to use QCAD and its ECMAScript interface for this task (no code yet, just few drawings). Each drawing will be different from any other so no manual tweaking or optimization "at the source" is possible. Each operation must be performed by code.
In particular, each drawing must be generated by concatenating a small number of sub-drawings (that is: QCAD Blocks) and, of course, the resulting block or drawing must be composed by continuous (uninterrupted) lines/curves/paths that a laser cutter could follow without problems.
How can I be sure that the result of my assembly operation is a continuous path? Is there any programmatic way to perform a check 'n fix?
I do not see any "automagically connect all selected entities" command in QCAD's menu so I understand I should perform my checks/fixes by hand. Unfortunately, this is not possible in this case because of the large amount of drawings I have to handle.
Does anybody know of any dependable way to create a laser-cuttable, smooth and uninterrupted path using the ECMAScript interface of QCAD (by concatenating a small set of blocks/entities into a larger block/drawing)?
Thanks in advance.
Re: How can I ensure that a path is uninterrupted?
Hi alexbottoni and welcome
When you say 'continuous' I presume you mean lines,arcs etc.. without the control points or nodes? All laser cutters will quite easily follow any single or continuous lines - please explain more about this.
The easiest way to link your sub drawings/blocks is to place them on their own independent layer, most modern laser cutters will be able to 'map' the layers and carry out the cut or etch requirements in sequence.Blocks will have to be exploded in order to set the correct line weight needed as per the laser cutters specific needs, all entities within a block need to be able to be selected!alexbottoni wrote:In particular, each drawing must be generated by concatenating a small number of sub-drawings (that is: QCAD Blocks) and, of course, the resulting block or drawing must be composed by continuous (uninterrupted) lines/curves/paths that a laser cutter could follow without problems.
When you say 'continuous' I presume you mean lines,arcs etc.. without the control points or nodes? All laser cutters will quite easily follow any single or continuous lines - please explain more about this.
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
Re: How can I ensure that a path is uninterrupted?
Hi Clive,
thanks for your attention.
>>The easiest way to link your sub drawings/blocks is to place them on their own independent layer, most modern laser cutters will be able to 'map' the layers and carry out the cut or etch requirements in sequence.<<
OK, nice. I apologize for my ignorance but I'm quite new to laser cutting.
>>Blocks will have to be exploded in order to set the correct line weight needed as per the laser cutters specific needs, all entities within a block need to be able to be selected!<<
OK. This should not be a problem. I need blocks only to store them in a manageable way in an external file and to position them into the host drawing with a single operation. After that, I should be able to select and explode them before saving/outputting the resulting dxf file. The line width should always be the same (we will cut throught the metal all of the drawing lines. No etching altogether).
>>When you say 'continuous' I presume you mean lines,arcs etc.. without the control points or nodes? All laser cutters will quite easily follow any single or continuous lines - please explain more about this.<<
At the moment, I'm dealing mainly with straight lines and arcs (no control points and no nodes). Unfortunately, I cannot be sure I will not stumble upon any spline in the future. Could splines be a problem? Have I to approximate them with sequences of lines and arcs?
My main doubt is related to the fact that I have to insert a block between two other elements in a chain (the first and last elements of the chain are fixed. I just insert a set of other elements in the middle). It looks like I can link my block to the previous element of the chain (using a snap, while positioning it) but I'm still not able to see any easy way to link my block to the next (final and fixed) element of the sequence. I would need some "intelligent" way to join them without human supervision. Something like a "smart trim" or a "smart join" that I could use from code in a dependable way.
Thanks again for you help.
thanks for your attention.
>>The easiest way to link your sub drawings/blocks is to place them on their own independent layer, most modern laser cutters will be able to 'map' the layers and carry out the cut or etch requirements in sequence.<<
OK, nice. I apologize for my ignorance but I'm quite new to laser cutting.
>>Blocks will have to be exploded in order to set the correct line weight needed as per the laser cutters specific needs, all entities within a block need to be able to be selected!<<
OK. This should not be a problem. I need blocks only to store them in a manageable way in an external file and to position them into the host drawing with a single operation. After that, I should be able to select and explode them before saving/outputting the resulting dxf file. The line width should always be the same (we will cut throught the metal all of the drawing lines. No etching altogether).
>>When you say 'continuous' I presume you mean lines,arcs etc.. without the control points or nodes? All laser cutters will quite easily follow any single or continuous lines - please explain more about this.<<
At the moment, I'm dealing mainly with straight lines and arcs (no control points and no nodes). Unfortunately, I cannot be sure I will not stumble upon any spline in the future. Could splines be a problem? Have I to approximate them with sequences of lines and arcs?
My main doubt is related to the fact that I have to insert a block between two other elements in a chain (the first and last elements of the chain are fixed. I just insert a set of other elements in the middle). It looks like I can link my block to the previous element of the chain (using a snap, while positioning it) but I'm still not able to see any easy way to link my block to the next (final and fixed) element of the sequence. I would need some "intelligent" way to join them without human supervision. Something like a "smart trim" or a "smart join" that I could use from code in a dependable way.
Thanks again for you help.
Re: How can I ensure that a path is uninterrupted?
Hi Alex.
Can you maybe attach a screenshot or drawing file that illustrates the problem?
As far as combining different drawings into one goes: Are you aware of the QCAD command line tool 'merge'?
This command line tool merges different drawing files into one, based on an XML input file.
For more information about merge, please refer to:
http://www.qcad.org/en/qcad-documentati ... line-tools
If I understand your task at hand correctly, this might be a good starting point. The merge tool is entirely implemented in ECMAScript under scripts/Tools/MergeDrawings/MergeDrawings.js
Can you maybe attach a screenshot or drawing file that illustrates the problem?
As far as combining different drawings into one goes: Are you aware of the QCAD command line tool 'merge'?
This command line tool merges different drawing files into one, based on an XML input file.
For more information about merge, please refer to:
http://www.qcad.org/en/qcad-documentati ... line-tools
If I understand your task at hand correctly, this might be a good starting point. The merge tool is entirely implemented in ECMAScript under scripts/Tools/MergeDrawings/MergeDrawings.js
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
Re: How can I ensure that a path is uninterrupted?
Hi Andrew,
thanks for your attention.
>> Can you maybe attach a screenshot or drawing file that illustrates the problem?<<
Yep, I'll try to post an example tomorrow (now it's ten past midnight here...).
>> As far as combining different drawings into one goes: Are you aware of the QCAD command line tool 'merge'?
This command line tool merges different drawing files into one, based on an XML input file.<<
No, I did not noticed it. Thanks for the info. Merge seems to be an interesting tool and I will try it.
>> If I understand your task at hand correctly, this might be a good starting point. The merge tool is entirely implemented in ECMAScript under scripts/Tools/MergeDrawings/MergeDrawings.js<<
This is even more interesting. Code examples are often the best way to learn a programming technique.
Thanks again for your help.
thanks for your attention.
>> Can you maybe attach a screenshot or drawing file that illustrates the problem?<<
Yep, I'll try to post an example tomorrow (now it's ten past midnight here...).
>> As far as combining different drawings into one goes: Are you aware of the QCAD command line tool 'merge'?
This command line tool merges different drawing files into one, based on an XML input file.<<
No, I did not noticed it. Thanks for the info. Merge seems to be an interesting tool and I will try it.
>> If I understand your task at hand correctly, this might be a good starting point. The merge tool is entirely implemented in ECMAScript under scripts/Tools/MergeDrawings/MergeDrawings.js<<
This is even more interesting. Code examples are often the best way to learn a programming technique.
Thanks again for your help.
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
Re: How can I ensure that a path is uninterrupted?
I'm back with an example. Please refer to the attached image.
As you can see, I have a base drawing and a couple of modular blocks. I have to assemble (concatenate) them as pictured. The final drawing will be sent to a laser cutter. The entire drawing will be cut off from a sheet of metal. Ne etching involved.
The problem is: how can I perform such an assembly/concatenation operation from code in a dependable way? No manual tweaking or optimization can be performed here (because of the large amount of drawings we have to generate) and, of course, we must send a "safe" and manageable drawing to the laser cutter (no manual check and fix is possible, either).
As long as I understand, I cannot have gaps between the elements of the chain. I must have a continuous, uninterrupted path (a closed one, moreover). This creates some problem of dependability during the assembly operation.
I can link the base and the two other elements together in the points 1 and 2 using a snap (to the end of a line) but I cannot use this same technique with point 3 (because both ends of this link are already fixed/constrained). I would need a "smart join" tool for this.
Any suggestion?
As you can see, I have a base drawing and a couple of modular blocks. I have to assemble (concatenate) them as pictured. The final drawing will be sent to a laser cutter. The entire drawing will be cut off from a sheet of metal. Ne etching involved.
The problem is: how can I perform such an assembly/concatenation operation from code in a dependable way? No manual tweaking or optimization can be performed here (because of the large amount of drawings we have to generate) and, of course, we must send a "safe" and manageable drawing to the laser cutter (no manual check and fix is possible, either).
As long as I understand, I cannot have gaps between the elements of the chain. I must have a continuous, uninterrupted path (a closed one, moreover). This creates some problem of dependability during the assembly operation.
I can link the base and the two other elements together in the points 1 and 2 using a snap (to the end of a line) but I cannot use this same technique with point 3 (because both ends of this link are already fixed/constrained). I would need a "smart join" tool for this.
Any suggestion?
Re: How can I ensure that a path is uninterrupted?
After snapping points 1 and 2 point 3 presumably would be aligned correctly also - if so you could finalise by using the create polyline from segments command - Draw > Polyline > Create from Segments (O,G), this would create a continuous polyline.alexbottoni wrote: but I cannot use this same technique with point 3 (because both ends of this link are already fixed/constrained). I would need a "smart join" tool for this.
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
Re: How can I ensure that a path is uninterrupted?
Well, I cannot be sure that the two ends on point 3 will be correctly aligned. As a matter of fact, they will rarely be (because of a long sequence of small dimensional errors in the modular blocks that sum up to a not-irrelevant alignement error in the final drawing). Actually, this is the main source of my problems.Clive wrote:After snapping points 1 and 2 point 3 presumably would be aligned correctly also - if so you could finalise by using the create polyline from segments command - Draw > Polyline > Create from Segments (O,G), this would create a continuous polyline.
"Create from segments" do creates a polyline from a uninterrupted sequence (chain) of arcs and lines but it just stops when it finds the first gap (even a small one). It does not recognise the gap as an unwanted gap, does not inform you of its existence and does not try to fill it (with ad additional line/arc or by extending/trimming one of the existent elements).
I'm almost sure I can guarantee an uninterrupted path to point 3 (using a snap) but I still cannot see a programmatic way to detect the gap that could exist on point 3 (or in any other point of the chain) and fill it.
Anyway, I will try to use this procedure:
That is:
- 1) Create your chain, leaving a large, fixed and predictable gap at the end of the chain
2) Always fill the gap with a custom-tailored line/arc (using the snaps)
3) Create a polyline from the segments
Thanks for your help.
Re: How can I ensure that a path is uninterrupted?
That's the key to this , we need additional options for the 'Create Polyline from Segments' tool - to:alexbottoni wrote:"Create from segments" do creates a polyline from a uninterrupted sequence (chain) of arcs and lines but it just stops when it finds the first gap (even a small one). It does not recognise the gap as an unwanted gap, does not inform you of its existence and does not try to fill it (with ad additional line/arc or by extending/trimming one of the existent elements).
1.Detect and show gaps in whole of selection.
2.Offer to fill with an optional entity - line,arc etc...
Hey Andrew, is this doable, certainly would be useful for a whole range of jobs?
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...
Re: How can I ensure that a path is uninterrupted?
or actually ... just a brand new tool as you have already suggested - a 'Smart Join tool'
1. Make selction.
2.use 'smart join' tool and tool offers to find and fill all gaps .
1. Make selction.
2.use 'smart join' tool and tool offers to find and fill all gaps .
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...
Re: How can I ensure that a path is uninterrupted?
Did you try adjusting the tolerance value? Create from segments does not stop at any 'small' gap. It stops at a gap that is greater than the entered tolerance value.alexbottoni wrote:"Create from segments" do creates a polyline from a uninterrupted sequence (chain) of arcs and lines but it just stops when it finds the first gap (even a small one). It does not recognise the gap as an unwanted gap, does not inform you of its existence and does not try to fill it (with ad additional line/arc or by extending/trimming one of the existent elements).
If your blocks are reasonably precise, you can concatenate thousands of them and still end up with only a marginal error. A tolerance value of 0.001 should be plenty to account for that.
I wouldn't generally worry too much about precision. There's always an error (computers cannot represent all numbers precisely). But these errors are usually marginal enough to be ignored (<0.000001 drawing units).
Having said that, it is generally better to code algorithms in such a way that errors do not accumulate. I.e. calculating the absolute theoretical position of your blocks and inserting them at that position instead of basing the position on an existing end point might be a better option.
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
Re: How can I ensure that a path is uninterrupted?
I do not think to be good enough at graphics programming for such a task. The main problem is: how could I detect the gap (in code)?Clive wrote:or actually ... just a brand new tool as you have already suggested - a 'Smart Join tool'
1. Make selction.
2.use 'smart join' tool and tool offers to find and fill all gaps .
I will try anyway...
BTW: A tool like that actually existed in a 3D CAD system I had the opportunity to use 10 or 15 years ago (more info available on request). Maybe some other high-end system have it as well.
Re: How can I ensure that a path is uninterrupted?
Please refer to Andrews last post, it may be an option for you.
For the best support please state your operating system, QCAD version and add any supporting DXF/DWG files, screenshots etc...
-
- Newbie Member
- Posts: 9
- Joined: Wed Nov 26, 2014 5:21 pm
Re: How can I ensure that a path is uninterrupted?
Ah, wonderful! I will try this way. It can even be a way to implement a (semi)automatic "smart join" in ECMAScript (as Clive suggested).andrew wrote: Did you try adjusting the tolerance value?
Thanks for your help, Andrew.