Netherlands
Joined: Apr 8, 2022
Post Count: 1487
Status:
Offline
Is there a max lenght for a SVG cutout string?
After this post I got an itch to solve the problem of 'difficult' cutouts.
I created an algorithm to generate a SVG cutout string from a room object. A room is perfect to create a shape with random curves. Of course the number of points such a room has can quickly run into the hundreds. Limited to 4 decimals every point adds 15 characters to a SVG string. I tested it with 386 points resulting in a string of 5699 characters. There was no problem setting such a cutout for the exported room object and the 'staircase shape' created a perfect hole in the floor.
But where is the limit? Is there a limit? Where does processing become a problem? My tests had no problems and worked very fast. But what happens with a million points? If there is a limit caused by some process in Sweet Home 3D I would like to know it so I can add a check for a maximum number of points.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects
France
Joined: Nov 7, 2005
Post Count: 9432
Status:
Offline
Re: Is there a max lenght for a SVG cutout string?
There's no programmed limit, but as curved lines are converted to line segments, there's a default limit to avoid too many points (try adding a spiral staircase and you'll see that the cutout of the room it intersects is actually made of segments).
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Netherlands
Joined: Apr 8, 2022
Post Count: 1487
Status:
Offline
Re: Is there a max lenght for a SVG cutout string?
I already know curves are actually segments. Zooming in you can see that as well. Same for a curved wall.
But it looks like I have to set an artificial limit like 1000 or 5000 to avoid processing of too many points and generating a huge SVG cutout string. The generating itself works amazingly well and is very fast in both C# and PHP. It even works with other objects like a wall. The Sweet Home 3D exports are perfectly formatted for this.
---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects
Netherlands
Joined: Apr 8, 2022
Post Count: 1487
Status:
Offline
Re: Is there a max lenght for a SVG cutout string?
I already solved the SVG cutout problem. I can now generate any cutout string from a room or wall. The only limitation is that it has to be a single room or a single wall. But a room can have the weirdest shape you can think of with many points and a wall can be curved. Basically any set of v-lines that represents a single surface can be used to generate a string. This means I can create an object (like the holes in your example) and create a SVG cutout string for it. Then import the objects in a library, check 'staircase' and set the generated cutouts. Now the objects can be used to create holes in a floor and export the floor with the holes. Of course your method also worked but if you had multiple holes with the same shape that you needed in different parts my method would be a lot less work.
Netherlands
Joined: Apr 8, 2022
Post Count: 1487
Status:
Offline
Re: Is there a max lenght for a SVG cutout string?
I think in your unusual case either method would work. With my method you would have the advantage that you can create holes without the thin walls to connect the outside walls to the walls for the holes. But that's just a minor advantage. In both cases you need to draw all the walls and rooms. With your method you don't need a library to set the SVG cutouts. It's good to have different choices in ways to solve problems!