Page 1 of 1

DXF tiling II

Posted: Tue Jul 27, 2021 9:14 pm
by chrispedersen
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 14591 times
The first step is to explode it into components (816a).
816a.png
816a.png (5.59 KiB) Viewed 14591 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 14591 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 14591 times
So that creates A'. Need to create the complement A" Thanks in advance for thoughts.

Re: DXF tiling II

Posted: Tue Jul 27, 2021 9:45 pm
by andrew
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.

Re: DXF tiling II

Posted: Tue Jul 27, 2021 10:32 pm
by chrispedersen
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''.

Re: DXF tiling II

Posted: Tue Jul 27, 2021 10:56 pm
by chrispedersen
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.

Re: DXF tiling II

Posted: Wed Jul 28, 2021 6:19 am
by CVH
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

Re: DXF tiling II

Posted: Wed Jul 28, 2021 6:39 am
by CVH
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

Re: DXF tiling II

Posted: Wed Jul 28, 2021 3:16 pm
by chrispedersen
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.