Netherlands
Joined: Apr 8, 2022
Post Count: 1382
Status:
Offline
Generate an Object: a panel with a hole
Several times we have seen questions in this forum about how to create a hole in a object. In most cases for a kitchen counter where a hole is needed for a sink. Look no further because now you can generate a panel with a hole according to your own specifications using the Object Generator on dodecagon.nl. You fill in the dimensions you want and after clicking "Generate" you can download a zip with your panel-with-a-hole. You can even select if you want the material to be Color, Glass, or Mirror(Chrome). (Texture is not one of the options but the generated object is perfectly prepared to set a texture after import in Sweet Home 3D.) Disclaimer: This is a beta version and simply a proof-of-concept. The idea is that maybe some day the original C# code is converted to a plugin that can generate multiple basic furniture parts. You can find it under Projects on Dodecagon.nl.
So far I can generate seven different objects for a wall system: supports, shelves, triangle shelves, toekicks, backsides, doors, and drawers. All with the selectable material types Color, Texture, Glass, or Mirror. And they can be smoothed, something Sweet Home 3D can't do. These objects have a small (or big) bevel that with smoothing creates a very natural looking rounding of the edges. Especially the handles for the doors and drawers look a lot better when smoothed. With these seven elements I can create thousands of different cabinets. And all I have to do is enter the dimension parameters to generate a part. The functions I set up are capable of extra options like setting an elevation for the drawer and door handles, a choice between one or two handles on a drawer (and turn them up or down). For the doors I can choose the hinges at the front or at the back. The front hinges are for doors that fall between the cabinet sides and the back hinges are for a door outside the cabinet. And of course the doors and drawers open in Sweet Home 3D. One parameter sets the hinge or rail number to generate for that object so a combination of generated objects can be exported/imported as a single object. The backside object can be with a color or texture and optionally with a mirror front.
Next to these seven parts I already have functions to generate a beveled door border, a beveled window border, a beveled panel, and a panel-with-a-hole (surprisingly the simplest of all objects).
For those who are interested a bit of historyA while ago I needed to create the same furniture part but with different dimensions for my Shopping Mall project. The problem was that some parts had to remain the same. Simply resizing one object was no option. Now I'm a software developer and as such I am basically lazy . I don't like to create the same object in 10+ different dimensions, there's no fun in that. I like to create once and let the computer repeat it whenever and however I want. The problem definition was how to create a furniture part with different dimensions but with some other parts remaining as they are. Think about a door that you resize but with the handle remaining the same size.
It took many hours, heavy analyzing of obj files, and many tries to see how I could replace the static vertice coordinates with variables that I can set with parameters, but I succeeded. Looking back it was not that difficult after I used Blender export instead of the Sweet Home 3D export as a template obj file. I found that it was important to meticulously prepare a template file with no double occurrences of a dimension to help recognize what is what in the resulting obj file. That was the key to succes: a well prepared obj template. It helped a lot that I discovered the need to merge vertices that were not correctly aligned in the Sweet Home 3D export. If you export two boxes aligned side-by-side the touching corners should share a single vertice point. Unfortunately this was not the case in a lot of situations with other parts. Thus the need to use Blender to merge those points. The extra advantage is one v line less for each merge. This makes the file much more 'readable' but of course it's a lot of work that fortunately only has to be do done once.
Then trouble started: texturing. Texturing is described in the obj with the vt lines ("vertice texture"). And depending on the object there can be as many vt lines as v lines but the values are in no way as recognizable as the v lines. It took a lot of time for each template to figure out the conversion algorithms for each vt line so that a texture remains correct for each size of the generated object. That is the most difficult and time consuming part of preparing a template for generation. I still have a bug in the window border template where the conversion algorithm for one or more vt lines is incorrect. So far I haven't found it.
Experimenting with different exports from Sweet Home 3D and Blender resulted in keeping the Blender export as a template for conversion. Two important reasons for this: First Blender doesn't create loads of vn lines that would also have to be converted. Second, instead of the vn lines Blender sets a single s line: 's off' flat, 's 1' smoothed and a different set of f lines. Yes, that means you can simply change flat to smoothed by setting 'off' to '1'! No need to create TWO templates, one for flat and one for smoothed, simply change between 'off' and '1'. Fortunately the f lines don't need a conversion, they remain the same for each size.
That's how far I am today. This is all code in C# which must be converted to Java if and when I find the time for a plugin. Since C# and Java are 95% the same conversion should be simple. The plugin itself and user interfaces is probably more work. The proof-of-concept on the dodecagon site was too much trouble. Converting C# to PHP is no fun at all. I will not do that for the other objects.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
Netherlands
Joined: Sep 26, 2009
Post Count: 4003
Status:
Offline
Re: Generate an Object: a panel with a hole
Looks great, works great.
What is the unit of measuremenet? MM or CM or UNITS??
(When using it came out as CM, but the model doesn't mention anything)
----------------------------------------
Hans
new website - under constuction hansdirkse.info
----------------------------------------
[Edit 1 times,
last edit by hansmex at May 2, 2025, 8:38:47 AM]
Netherlands
Joined: Apr 8, 2022
Post Count: 1382
Status:
Offline
Re: Generate an Object: a panel with a hole
Good question. It's in cm. I have added it to the user interface to make it clear.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
France
Joined: Oct 20, 2017
Post Count: 312
Status:
Offline
Re: Generate an Object: a panel with a hole
Bonjour Keet. Votre application permettant de créer un trou dans un objet est effectivement très intéressante. J’avais déjà été confronté à ce problème mais il y a plusieurs mois de ça, j’avais trouvé par hasard un fichier nommé « éléments de coupe.sh3f » créé par Nauthiz dans SourceForge. Il contient deux objets appelés Cutting cube et Cutting Cylinder qui permettent de créer de trous carrés (ou rectangulaires) et ronds (ou ovales) dans un plancher. Cela m’avait bien aidé pour créer un plan de travail avec un évier dessus. J’ai d’abord dessiné au niveau 0 une surface (en bleu) aux dimensions du plan de travail et posé dessus deux cylindres (en rouge) et un cube (en jaune) afin de créer un groupe de ces 3 objets avec des dimensions légèrement inférieures à celle de mon évier.
J’ai ensuite ouvert un niveau 1 avec une élévation égale (ou légèrement inférieure) au groupe d’objets et copié la surface du niveau 0 sur le niveau 1 (et lui mettre la texture). On voit que le groupe d’objets a créé le trou souhaité dans le futur plan de travail.
Ne restait plus qu’à convertir la surface ainsi réalisée en .obj avant d’y installer l’évier.
Dommage qu’il n’y a qu’un cube et un cylindre dans le fichier créé par Nauthiz. Un triangle rectangle aurait pu aussi être très utile.
Netherlands
Joined: Apr 8, 2022
Post Count: 1382
Status:
Offline
Re: Generate an Object: a panel with a hole
I didn't know about the objects from Nauthiz. They are probably shapes marked as a staircase. There are two 'staircase' cylinders in my Shapes library. A "staircase triangle" is easy, export a triangle and import it again as a staircase. That's it. For your double rounded sink I would have created a room in the size of the hole I need and export it, then import as a staircase to create the hole.
The problem with using a staircase object to create a hole is that it requires a room. Nothing wrong with a room but the sides don't texture correctly. My generator does a little better at this. For your kitchen top is doesn't matter, you probably add a border that covers those sides.
More interesting is the concept of not only generating objects but also creating a library file with them. I have to think about that. Probably a function to add a generated object to a new or existing library with the option to add a few of the additional properties that a library allows. Creating a library with code is easy, I already have done it but that was before all the extra properties were introduced. I also read the library properties file when I add or update a library on my site. That's where the version number and model count comes from that is displayed next to a download button. I should probably hurry with converting my C# code to Java because there's no doubt that I have functions programmed that are already available from Sweet Home 3D.
[French] Je ne connaissais pas les objets de Nauthiz. Il s'agit probablement de formes marquées comme un escalier. Il y a deux cylindres en forme d'escalier dans ma bibliothèque de formes. Un "triangle escalier", c'est facile, il suffit d'exporter un triangle et de le réimporter en tant qu'escalier. C'est tout. Pour votre double évier arrondi, j'aurais créé une pièce de la taille du trou dont j'ai besoin et je l'aurais exportée, puis importée en tant qu'escalier pour créer le trou.
Le problème de l'utilisation d'un objet escalier pour créer un trou est qu'il nécessite une pièce. Il n'y a rien de mal à avoir une pièce, mais les côtés ne sont pas texturés correctement. Mon générateur est un peu plus performant. Pour votre plan de cuisine, cela n'a pas d'importance, vous ajoutez probablement une bordure qui couvre ces côtés.
Plus intéressant est le concept de ne pas seulement générer des objets mais aussi de créer un fichier de bibliothèque avec eux. Je dois y réfléchir. Probablement une fonction pour ajouter un objet généré à une bibliothèque nouvelle ou existante avec l'option d'ajouter quelques-unes des propriétés supplémentaires qu'une bibliothèque permet. Créer une bibliothèque avec du code est facile, je l'ai déjà fait mais c'était avant que toutes les propriétés supplémentaires ne soient introduites. Je lis également le fichier des propriétés de la bibliothèque lorsque j'ajoute ou mets à jour une bibliothèque sur mon site. C'est de là que proviennent le numéro de version et le nombre de modèles qui sont affichés à côté du bouton de téléchargement. Je devrais probablement me dépêcher de convertir mon code C# en Java car il ne fait aucun doute que j'ai programmé des fonctions qui sont déjà disponibles chez Sweet Home 3D.
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
France
Joined: Oct 20, 2017
Post Count: 312
Status:
Offline
Re: Generate an Object: a panel with a hole
J'ai testé comme vous me l'avez conseillé de ré importer un triangle en tant qu'escalier. Mais curieusement à un escalier courbe par exemple qui crée un trou reproduisant sa forme, le trou crée par mon triangle (en jaune) n'est pas triangulaire mais rectangulaire.
Netherlands
Joined: Apr 8, 2022
Post Count: 1382
Status:
Offline
Re: Generate an Object: a panel with a hole
I didn't think of it but it is because a custom SVG cutout string must be set. That means the triangle must be in a library where a such a cutout can be set. I have added a "triangle staircase" to the DodecagonShapes library with the correct SVG cutout. The custom cutout is really simple: "M0,0 v1 L1,0 z ".
!!! UPDATE I re-uploaded the DodecagonShapes library. I forgot to add the License and Category
[French] Je n'y avais pas pensé, mais c'est parce qu'une chaîne de découpe SVG personnalisée doit être définie. Cela signifie que le triangle doit se trouver dans une bibliothèque où une telle découpe peut être définie. J'ai ajouté un "escalier triangulaire" à la bibliothèque DodecagonShapes avec la découpe SVG correcte. La découpe personnalisée est très simple : "M0,0 v1 L1,0 z ".
---------------------------------------- Dodecagon.nl 1000+ 3D models, manuals, and projects
----------------------------------------
[Edit 1 times,
last edit by Keet at May 2, 2025, 7:05:50 PM]
France
Joined: Oct 20, 2017
Post Count: 312
Status:
Offline
Re: Generate an Object: a panel with a hole
J'ai donc téléchargé et installé votre mise à jour du fichier de formes et effectivement j'ai trouvé un nouvel objet appelé "Triangle Staircase". Et ça marche une fois qu'on le rend invisible.
Encore merci à vous, Keet.
----------------------------------------
[Edit 2 times,
last edit by captaincook at May 2, 2025, 7:19:34 PM]