Hello,
I have several hundred dxf files. They are mostly rectangles with holes however some drawings have curved contours.
The holes in the parts have been developed as two arcs that touch.
Is there a command that could be scripted to bulk convert the two arcs into a single circle?
Further to this problem once the arcs are converted to holes, I need to increase the diameter of the circle by 1mm.
It could be possible to not convert the arcs and just increase the radius by 0.5mm as long as I am able to determine if the arc is inside the contour and not part of the contour.
Any suggestions as to where to start (or if this is something that can be achieved) would be appreciated.
Thank you.
Daniel.
Bulk conversion of arcs to circles then alter diameter
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.
Re: Bulk conversion of arcs to circles then alter diameter
Hi Daniel - welcome to the forum.
Not that I know of.2CV375 wrote:Is there a command that could be scripted to bulk convert the two arcs into a single circle?
Regarding to your screenshot: Select the arcs and use the Property Editor to increase the radius or diameter with "+0.5" etc.2CV375 wrote:It could be possible to not convert the arcs and just increase the radius by 0.5mm as long as I am able to determine if the arc is inside the contour and not part of the contour.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: Bulk conversion of arcs to circles then alter diameter
Thank you for your welcome and detailed reply Husky. It is appreciated.
What you propose is a solution when I have only a few drawings. I appreciate the suggestion as I was unaware of this functionality. Manually selecting the internal holes is possible. The problem I have is the number of drawings. The largest number of parts, thus far, has been 750 and typically 150 to 300. I have been lucky in the last job in that I was able to develop a gawk script to modify the radius in the DXF file as all the holes are proper circles that only appear inside the part.
Would anyone know if your technique can be scripted within QCAD? Is it possible in the QCAD scripting language to detect entities inside a boundary? The boundary could be LINES and ARCS or it could be a LWPOLYLINE.
While writing this reply I had an idea:
A sample part is below. The only problem is when the "holes" are two arcs and not a full circle. The AutoCAD overkill command has this so I may be able to ask the supplier to run their parts through overkill (if they use AutoCAD).
Kind regards,
Daniel.
What you propose is a solution when I have only a few drawings. I appreciate the suggestion as I was unaware of this functionality. Manually selecting the internal holes is possible. The problem I have is the number of drawings. The largest number of parts, thus far, has been 750 and typically 150 to 300. I have been lucky in the last job in that I was able to develop a gawk script to modify the radius in the DXF file as all the holes are proper circles that only appear inside the part.
Would anyone know if your technique can be scripted within QCAD? Is it possible in the QCAD scripting language to detect entities inside a boundary? The boundary could be LINES and ARCS or it could be a LWPOLYLINE.
While writing this reply I had an idea:
- Use QCAD to export to SVG,
- GAWK to change the radius,
- and QCAD to convert back to DXF.
A sample part is below. The only problem is when the "holes" are two arcs and not a full circle. The AutoCAD overkill command has this so I may be able to ask the supplier to run their parts through overkill (if they use AutoCAD).
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!-- 2017-09-06 11:36:20 Generated by QCAD SVG Exporter -->
<svg width="126" height="180" viewBox="-63 -90 126 180" version="1.1" xmlns="http://www.w3.org/2000/svg" style="stroke-linecap:round;stroke-linejoin:round;fill:none">
<g transform="scale(1,-1)">
<!-- Polyline -->
<path d="M-63,-90 L63,-90 L63,90 L-63,90 Z" style="stroke:#000000;stroke-width:0.25;"/>
<!-- Circle -->
<circle cx="28" cy="55" r="9.5" style="stroke:#000000;stroke-width:0;"/>
<!-- Circle -->
<circle cx="28" cy="-55" r="9.5" style="stroke:#000000;stroke-width:0;"/>
</g>
</svg>
Daniel.
Re: Bulk conversion of arcs to circles then alter diameter
Sorry, one thing I failed to mention was that in some cases, the internal holes are different diameters . I am not sure how this changes the problem.
Re: Bulk conversion of arcs to circles then alter diameter
You can program pretty much anything with QCAD scripts. The only limits are your time and willingness to learn script programming.2CV375 wrote:Would anyone know if your technique can be scripted within QCAD?
Yes. If you have an algorithm for deducing that boundary, you should be able to do it.2CV375 wrote:Is it possible in the QCAD scripting language to detect entities inside a boundary? The boundary could be LINES and ARCS or it could be a LWPOLYLINE.
Note that you will very likely lose at least some information in that round-trip (layer information, dimensions, hatches, etc.).2CV375 wrote:
- Use QCAD to export to SVG,
- GAWK to change the radius,
- and QCAD to convert back to DXF.
This situation would be relatively easy to detect:2CV375 wrote:A sample part is below. The only problem is when the "holes" are two arcs and not a full circle. The AutoCAD overkill command has this so I may be able to ask the supplier to run their parts through overkill (if they use AutoCAD).
- Find an arc
- Query all arcs within the boundary of the full circle pertaining to the arc
- If radius is the same and angles complement each other, replace both entities with full circle
Re: Bulk conversion of arcs to circles then alter diameter
A workaround could be:
Select all those semicircles regardless there radius with the Selection Filter.
Isolate (copy) them on a separate working layer, freeze the rest.
Set start at 0°, end at 360°, all reversed or not.
-> Now you have duplicates
Detect Duplicates (MD) and delete those.
Select the full Arcs of a certain radius.
Menu..Misc..Information..Store Positions.
Menu..Draw..Center/Radius (CR); set radius.
Menu..Misc..Information..Use Positions.
Repeat for other radii and delete the full Arcs.
It works good for some radii or some files but not for hundred of files.
And not in a snap-of-a-finger.
Regards,
CVH
Re: Bulk conversion of arcs to circles then alter diameter
Regarding this and your other post:
viewtopic.php?f=33&t=7093
Circular Shape Replacement Tool
The tool would take a user selection of circular forms.
The selection is filtered on Arcs and Circles.
Arcs are considered as being full 360°Arcs.
Filtered for every unique combination of centerpoint and radius a new circular form or new shape is constructed.
Comparison is done with a certain angular and linear tolerance.
The new Props are set to rounded values related to the used tolerances.
(this can avoid things as ...99997 and ...0002)
The new circular form can be formulated as:
- 2 semicircle Arcs; @ Cut angle
- 1 full Arc; @ Cut angle; End Angle = Start Angle OR Start Angle + 360°
- 1 circle
- The radius is set regarding the source OR fixed OR scaled OR summed.
- Arcs are CW OR CCW
A new shape could be: A point; A sqaure (& size) ; A cross (& size) ...
Optionally only the centerpoints are stored to be reused with Menu..Misc..Information...
Optionally casting on a sub-Layer.
Optionally deleting the replaced forms & duplicates.
Does that narrow it down to your needs?
Regards,
CVH
viewtopic.php?f=33&t=7093
Circular Shape Replacement Tool
The tool would take a user selection of circular forms.
The selection is filtered on Arcs and Circles.
Arcs are considered as being full 360°Arcs.
Filtered for every unique combination of centerpoint and radius a new circular form or new shape is constructed.
Comparison is done with a certain angular and linear tolerance.
The new Props are set to rounded values related to the used tolerances.
(this can avoid things as ...99997 and ...0002)
The new circular form can be formulated as:
- 2 semicircle Arcs; @ Cut angle
- 1 full Arc; @ Cut angle; End Angle = Start Angle OR Start Angle + 360°
- 1 circle
- The radius is set regarding the source OR fixed OR scaled OR summed.
- Arcs are CW OR CCW
A new shape could be: A point; A sqaure (& size) ; A cross (& size) ...
Optionally only the centerpoints are stored to be reused with Menu..Misc..Information...
Optionally casting on a sub-Layer.
Optionally deleting the replaced forms & duplicates.
Does that narrow it down to your needs?
Regards,
CVH