DXF tiling II

Do you have a question you want to ask an existing QCAD user about QCAD and what you can do with it? Do you want to know if a particular feature exists? This is the place to ask.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
chrispedersen
Junior Member
Posts: 19
Joined: Fri May 21, 2021 11:42 pm

DXF tiling II

Post by chrispedersen » Tue Jul 27, 2021 9:14 pm

Hi Andrew and Husky.

So, I can make the clip by rectangle work, manually. But am completely lost trying to script this.

Suppose I start with a sectioned circle 816-test-1-9.dxf
816.png
816.png (2.02 KiB) Viewed 13036 times
The first step is to explode it into components (816a).
816a.png
816a.png (5.59 KiB) Viewed 13036 times
I then trim it, creating something like this: 816b (First snag: the idea of trimming it is to trim it into two parts A = A' + A''
How do you make the trim occur in exactly the same point?)
816b.png
816b.png (6.05 KiB) Viewed 13036 times
I tried to automatically close the poly line, but couldn't figure out how to make that work. So I ended up snapping to the end of the line and drawing a line.
816c.png
816c.png (7.75 KiB) Viewed 13036 times
So that creates A'. Need to create the complement A" Thanks in advance for thoughts.
Attachments
816c.dxf
(101.44 KiB) Downloaded 389 times
816b.dxf
(100.9 KiB) Downloaded 375 times
816a.dxf
(101.45 KiB) Downloaded 392 times
816-test-1-9.dxf
(4.08 KiB) Downloaded 409 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: DXF tiling II

Post by andrew » Tue Jul 27, 2021 9:45 pm

It's not entirely clear to me if you are trying to create a script (i.e. a program in JavaScript) that does that or if your question is something else. Thanks for your clarification.

chrispedersen
Junior Member
Posts: 19
Joined: Fri May 21, 2021 11:42 pm

Re: DXF tiling II

Post by chrispedersen » Tue Jul 27, 2021 10:32 pm

Yes, the primary question is:
a) how to accomplish this programatically so the same process could occur on different dxf's.

In the process, I have several sub problems that I have identified.
1. DXFS do not seem to import with a consistent coordinate system. I'm sure this is an artifact of how they are created,but I'm not sure how to deal with it.
2. How to trim A into two parts A' and A''.
3. How to close the segments and save A' & A''.

chrispedersen
Junior Member
Posts: 19
Joined: Fri May 21, 2021 11:42 pm

Re: DXF tiling II

Post by chrispedersen » Tue Jul 27, 2021 10:56 pm

Conceptually the intent is to have a script

Slicedxf Name Xslice, Yslice

For i = 0 to {NameXExtentents/Xslice}
for j = 0 to {NameYExtents/Yslice}
Clip to Rectangle {(0,0),(i*Xslice,j*Yslice)}
Close Open Segments
Save Nameij
Next j
Next I

IE: If you have a table of size X,Y, and a dwg that exceeds the size of the table, you could slice the dwg into tiles.

CVH
Premier Member
Posts: 3364
Joined: Wed Sep 27, 2017 4:17 pm

Re: DXF tiling II

Post by CVH » Wed Jul 28, 2021 6:19 am

Hi,

I have the same problem as Andrew to grasp what the goal is.
What is the reason that the vertical lines in 816a-b-c are doubled up?
chrispedersen wrote:
Tue Jul 27, 2021 9:14 pm
The first step is to explode it into components (816a).
816-test-1-9.dxf were already 3 separate 'shapes'.
Did you mean shifted up?
chrispedersen wrote:
Tue Jul 27, 2021 9:14 pm
I then trim it, creating something like this: 816b (First snag: the idea of trimming it is to trim it into two parts A = A' + A''
How do you make the trim occur in exactly the same point?)
That is the difference between trimming and cutting.
'Clip to Rectangle' has also a 'Cut at Area Boundary' mode.
Cutting would cut crossing entities in two at exactly the same spot given Floating Point uncertainties.
The coordinate numbers will be correct up to about 15.95 significant digits disregarding the exponent.
Floating Point uncertainties for arcs may be somewhat larger, still very minute.

The major problem with 816c will be:
What to consider as a shape that needs closing?
Humans are good at recognizing where to draw those closing segments. :wink:
The three 'shapes' as we see them were not closed entities to start with.

Regards,
CVH
Last edited by CVH on Wed Jul 28, 2021 8:30 am, edited 4 times in total.

CVH
Premier Member
Posts: 3364
Joined: Wed Sep 27, 2017 4:17 pm

Re: DXF tiling II

Post by CVH » Wed Jul 28, 2021 6:39 am

chrispedersen wrote:
Tue Jul 27, 2021 10:32 pm
1. DXFS do not seem to import with a consistent coordinate system.
Could you explain that phrase in more detail ...?
Got me curious :!: :wink:

Regards,
CVH

chrispedersen
Junior Member
Posts: 19
Joined: Fri May 21, 2021 11:42 pm

Re: DXF tiling II

Post by chrispedersen » Wed Jul 28, 2021 3:16 pm

CVH wrote:
Wed Jul 28, 2021 6:39 am
chrispedersen wrote:
Tue Jul 27, 2021 10:32 pm
1. DXFS do not seem to import with a consistent coordinate system.
Could you explain that phrase in more detail ...?
Got me curious :!: :wink:

Regards,
CVH

I'm generating DXFs programmatically, and there seems to be some inconsistency. All the programs are intended to have a small offset from (0,0) And then generate +x,+y.

"Why the double lines" - Mostly so the sections can be easily grabbed and moved.

Logically, before the trim, if a the trim is "inside" the shape I want to create an edge.

Post Reply

Return to “Pre-sales Questions”