Script to cut windows and doors into walls
 1-2  3-22  23-29

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.3 In reply to 10907.2 
Hi Brian,

> Do the windows and doors need headers and cripples and jack or trimmer studs?

No I don't think so. On the other hand, as I was pondering how to approach the script it seemed logical that additional construction or trim details could be future modifications to the script. For now though, the simple openings I illustrated would be sufficient to my needs.

That there is an intersect factory mentioned in the new API documentation makes me wonder if this might be part of what I'm seeking to find the layers of the wall to be cut.

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10907.4 In reply to 10907.1 
Hi Larry, it might be simpler if you could work just with solids. Then a boolean difference should automatically do some of the things you're trying to do manually like determine extrusion distance.

If you want to limit the cut to one wall then you could use subset booleans. That's when you have faces selected on the object to be cut in boolean difference. It will only intersect with those faces.

So for example if you have a face sub-selection on a solid like this:



Then when you do a boolean difference you'll get a result like this:


- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  pressure (PEER)
10907.5 In reply to 10907.1 
Hi Larry,

Here’s how I’d try to attack the problems of determining wall thickness and selecting the wall components for boolean:

1. Generate line along normal that’s longer than wall is thick
2. Run intersection factory on line and all wall components. See http://moi3d.com/forum/index.php?webtag=MOI&msg=10807.1
3. Use distance function on all pairs of points generated by intersection. Largest value is wall thickness
4. For each point and each wall component do dropPoint and then find distance between original point and dropped point. The pair that is separated by approx 0 distance is associated with the wall component that the original point is on
5. Get face object from dropPoint output
6. Add parent BRep of face object to list of stuff that needs to get booleaned

This might not work for the 2 surfaces case unless the surfaces are joined. It won’t work for the solids cases unless they are separated by a little empty space.

Another route might be the labeling technique that Michael used in selectIntersected http://moi3d.com/forum/index.php?webtag=MOI&msg=8088.5

- Peer
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.6 In reply to 10907.5 
Thanks Michael and Peer,

I wasn't aware of the subset capability in booleans, that does simplify the job indeed. Simply selecting the two surfaces (in the first example case), or the layers of the walls (case 2 & 3), then doing boolean difference with only the curve as the cutting object does produce the cutouts nicely. I was hoping to also get the rudimentary frame (simple surfaces) but maybe I don't really need that.

I am going to continue pondering this script idea though and appreciate Peer’s ideas and pointers…will need some time to digest and experiment though!! The subset boolean has met the initial need on the model I’m currently working on.

—Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10907.7 
You don't try the Elephant nodes system ?
---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.8 In reply to 10907.7 
Hi Pilou,

I haven't used the Elephant, probably because I've never been much interested in visual programming tools--I prefer to work with more traditional code... ;-}

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.9 
Problem solved & I updated the first message in this thread with the solution and description.

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10907.10 In reply to 10907.9 
Cool you recreate a SketchUp Like prog! ;)

Maybe name _CutWalls for separate from native commands...

I Just use it by instinct without read text! :)

But maybe seems Glass is not at the good place ? (Must be at the middle of the thickness' frame ?


And cool works with any curves, Circles etc...
In no time the French version! ;) Done! ;)
https://moiscript.weebly.com/uploads/3/9/3/8/3938813/_cutwalls_fr.zip

EDITED: 1 Jan 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.11 In reply to 10907.10 
Hi Pilou,

I thought that you might enjoy making curvy windows!

Thanks for the feedback on the location of the glass. I added the option to create the “glass” so that when you look at one of the side views of the building you wouldn’t be looking through the windows and be distracted by interior features—more like a piece of plywood than glass… I will set the glass just inside of the wall, like a modern window normally is, but probably not right in the middle of the wall.

It is odd to see that your images do not show the units on the two distance fields. Maybe that got turned off in one of your settings? The “probe depth” is set by default to 15 inches, but is then translated to whatever unit system the model uses.

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10907.12 In reply to 10907.11 
Yes was just "Without Unity System" Options! ;)

So...


Not the middle of the "wall" but middle of the "Frame" thickness! ;)

EDITED: 2 Jan 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.13 In reply to 10907.12 
Hi Pilou,

> Yes was just "Without Unity System" Options! ;)

Ah, something that I had not tested!

Thank you for the suggestion to move the glass, I think it looks much better now.

I also added the option to keep or remove the window curves, consistent with the Boolean Difference command.

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  pressure (PEER)
10907.14 In reply to 10907.13 
Hi Larry,

It's nice to see your project come to fruition. Happy New Year!

- Peer
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.15 In reply to 10907.14 
Thanks Peer & thanks again for your suggestions earlier. Still need to get a better handle on using the various dropPoint methods though. Happy New Year to you as well!

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.16 In reply to 10907.12 
Hi Pilou,

With 0.7 I've improved the .htm along with the .js, so although I can only mumble a little bit of French, I also updated your French version.

--Larry
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10907.17 In reply to 10907.16 
I will see that tomorrow! :)

EDITED: 2 Jan 2023 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10907.18 In reply to 10907.16 
Thx for the Fr Version! Absolutely perfect!
And the very cool thing is that you can make any number of different "Windows" in the same time!!!
I must add it to my repository! :)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10907.19 
Done! ;) https://moiscript.weebly.com/portes-et-fenecirctres.html

Your last challenge put a frames & Glass in each piercing...


---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.20 In reply to 10907.19 
Hi Pilou,

> And the very cool thing is that you can make any number of different "Windows" in the same time!!!

Indeed, that was my original goal, but I think our models are a little different. Think about a model of a building where you have many windows of differing sizes and locations as well as interior partition walls for rooms. My intent was to put a 2D curve on the outside of the walls wherever a window was to be located. Using the two phase selection model (like Boolean Difference), the script allows selecting all the walls to be cut followed by selecting all the window curves. Then the script examines the wall behind each window’s curve to determine that wall’s thickness and finally the script cuts and frames each window into its wall. Since a door is similar to a window, the script can also work for cutting and framing doors, but doesn’t go so far as to make the doors themselves.

> Your last challenge put a frames & Glass in each piercing…

Well…it already does that for my intended use… ;-}

Originally the “probe depth” was fixed at 15 inches which I thought would be sufficient for models of buildings. I like to avoid hidden constants if I can, and so to allow for other use cases, I exposed it as an option. The purpose of this probe depth is so that the script can figure out how thick each wall is while allowing for the selected walls to be of differing thickness. Ideally probe depth should only be a little deeper than the wall is thick. This probing business is kind of a hack because I couldn’t figure out another way to have the script discover the adjacent objects…something that I was asking Michael about on the V5 wish list thread.

When you make the probe depth super deep like you are showing, that causes the script to make a mistake in determining the adjacent wall’s thickness: it blasts through multiple walls. With a 200cm probe depth, you’re telling the script that a single wall may be up to 200cm thick, but that’s not what your model shows.

You’re also putting the window curve well outside of the wall rather than on the wall like I was originally thinking.

Both of these things suggest that maybe I can improve the logic a bit to avoid the errors of one window and frame poking through multiple walls, and the pane of glass not being inside of the wall. The challenge is to work on many different types of walls, some of which can have multiple layers with spaces in between the layers.

Thanks for providing a different use case to think about!

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10907.21 
Hi Michael,

Sorry, questions like this may cause you some frustration or irritation… I'll understand if you say "go away kid, you bother me!"

I've run into an interesting bug that I haven’t been able to figure out. After a fresh start of MoI, if I use my CutWalls script to cut a single window into one or more solids, the solids' names are preserved as one would expect. However if I then either Undo or reload the saved model and use the script in the exact same way the solids' names are deleted. Making it stranger still, if I point the script at a surface or joined surface and do the same operations, the surface names are never deleted. So basically the script only works correctly once after a fresh start of MoI, any subsequent use and the names of solids being cut are deleted.

I have narrowed the loss of object name down to the boolean difference operation, and of course a normal Construct > Boolean Difference behaves normally—object names are not deleted. Same issue with MoI v4 and v5 May beta.

With v5 the puzzle is more interesting in that solids which are part of a group do not have their names deleted.

Prior to the boolean difference, the script seeks to determine the thickness of the wall by creating a probe line normal to the curve and doing an intersect on the wall and the curve. It then moves the curve slightly outside of the wall and extrudes a solid which extends slightly through the wall on the other side (to be able to cut surfaces as well as solids). That solid is then used by the boolean difference to cut the wall objects.

The script is designed to be able to cut multiple windows and walls, and allows the walls to be of varying thickness. To accomplish this, the script loops through the set of window curves probing the wall behind each, making solid cutters, frames and glass as necessary. There is a single boolean difference at the end of the script to do all the cutting at once. (if I put the boolean difference into the loop, then the objects being cut replicate…)

If there are multiple windows being cut, then even with a fresh start of MoI, the names of the solids are being deleted.

All of this leaves me thinking that there is some state information that’s somehow not getting cleaned up, and that the various operations that the script performs are causing something to leak into the boolean difference, triggering the behavior. Beyond that hunch, I’m a bit clueless. Doesn't matter if input #2 (keep objects) is true or false.

To reproduce, create a box about 6” thick to represent a wall object, then draw a closed planar curve on one side to represent a window opening to be cut. Name the two objects then execute CutWalls. Select the box as the base object and the curve as the object to subtract. Don’t need to tick any of the option checkboxes. The window will be cut and the box’s name will be removed. Or, the other case, put two window curves on the box & the names are always removed.

--Larry

EDITED: 6 Jan 2023 by FAHNOE

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10907.22 In reply to 10907.21 
Hi Larry, I'll try to take a look later but this is a great example of why I don't try to advertise that scripting in Moi is a thing that you can do, because it can be very difficult to come up to speed with complex scripts and try to support them.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-2  3-22  23-29