by thomthom » Tue May 12, 2009 7:06 pm
Warning! Will cause Bugsplat!This is made available for the sole purpose of tracking down bugsplats and working out general code structure!It's intention is for other ruby developers to have a look at the code. If any curious minds want to play with the concept script, do so with the knowledge that it will crash SU at some point. The ConceptThis is a script which allows cutout components to cut out the opposite face of a parallel connected face. Doublecut.png Double Cut - Example.skp ttdc-howto.png Once you've done this, you can right click the component and enable the Double Cut. The Inner WorkingsThe script works out which edges intersect the opposite connected face and generates a second cut-out component (double-cut) and places it in the model. The double-cut component is locked and it's content is hidden in order to keep it out of the way from the users. The script then keeps track of all cut-out components which are set as double cutting. Double-cut functionality works on a Definition basis, not individual Instances. If the original cut-out is modified the double-cut is regenerated. The ProblemsKeeping track of all the changes are not easy. A number of potentially useful observers has proven themself to be broken. Quite a few work around has been done to make this work. What I'm tracking: - Placement of new double-cutting components
- Copy+Paste
- Paste in Place
- Paste from another file / Import
- Move+Copy / Rotate+Copy
- Modification to the cutting geometry
- Scaling - Does the component still intersect both faces to cut out etc.
At the moment I have these specific problems: - Bugsplat upon SU close (some times)
- Bugsplat after creating a double-cut component. Then create a new model. (File->New). Then once again File->New; this causes a bugsplat.)
- When a component is made unique I need to get hold of the instance of the new component definition and create a new double-cut for them. But the onEntityChange event and onComponentAdded event both triggers before the .instances of the new definition is populated.
- When moving a component, a transformation to the matching double-cut is applied in the onEntityChange event which cancels all other observer events. Causing problems such as only one double-cut component being moved if multiple cut-outs are moved. Or interfering with Move+Copy leading to extra components placed in the model.)
From this thread, viewtopic.php?f=180&t=18964&p=155868, it seems that many of my problems are due to the fact that I modify the model from within observer events. So I wonder if I can instead of modifying within the events, push the modifications into a stack for later manipulation. But the question is; when is it safe to do so? And when/what will execute the changes? I want to avoid timers as I'm afraid something might slip past. I'll be revising the whole working of my script. But I hope that some of the ruby scripters would have some time to have a look at my concept code and see if you get some ideas to tackle this challenge. (It's a long script, I know. Not necessarily the best to suddenly jump straight into. I have tried to make as many comments in my code as possible. But I'm sure there'll be lots of WTF when you read it. Still, I hope someone could have a look.)
Last edited by thomthom on Tue May 12, 2009 7:50 pm, edited 1 time in total.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Gaieus » Tue May 12, 2009 7:17 pm
Hi Thom,
I understand that it's still kind of "alpha" now and mainly for developers to look into the code itself. Would there be any help - beside telling you that "yeah, indeed I get the bugsplat" if totally "lay" people jumped into testing?
You know I'm very curious and interested in this although I have always managed to "solve" the double cutting issue for myself (with the exact same, "opposite" component). So if I could be any help beside reporting bugsplats, let me know.
-

Gaieus
-
- Posts: 26832
- Joined: Sat Oct 20, 2007 8:24 am
- Location: Pécs, Hungary
- Name: Csaba Pozsárkó
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: historical reconstruction
- Level of SketchUp: Advanced
-
by Chris Fullmer » Tue May 12, 2009 7:24 pm
I'm in! I'll run it through the ringer when I get a chance. Unfortunately, I have never used observers. I sort of understand what they do, just not how they do it. But I'll give it a go!
Chris
-

Chris Fullmer
- SketchUp Team

-
- Posts: 6916
- Joined: Wed Nov 21, 2007 3:21 am
- Location: Boulder, CO
- Name: Chris Fullmer
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: landscape architecture
- Level of SketchUp: Advanced
-
by thomthom » Tue May 12, 2009 7:27 pm
At the moment, I won't have any need for bug reports as I might need to drastically change my code to avoid the bugsplat. So working on smaller bugs/quirks might not be worth the effort.
However, do feel free to test it out as a concept. See how it fits into your workflow in the large picture. See if it cuts when you expect it to cut etc. Just beware that it does crash. I recommend anyone testing it to disable it when they're not actively testing it.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by thomthom » Tue May 12, 2009 7:28 pm
Chris Fullmer wrote:I'm in! I'll run it through the ringer when I get a chance. Unfortunately, I have never used observers. I sort of understand what they do, just not how they do it. But I'll give it a go!
Chris
Thanks! 
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by scottlininger » Tue May 12, 2009 8:38 pm
Thom,
Fantastic idea!
One thing that *might* make your script simpler would be use a flattened copy of the window component to cut the 2nd hole instead of creating a new definition or group. (One less thing to keep track of and would keep the file size small.) However, I do like the idea of hiding all of the geometry inside the new hole to keep it out of the way... which wouldn't work with this approach.
- Scott Lininger SketchUp Software Engineer Have you visited the Ruby API Docs?
-

scottlininger
-
- Posts: 173
- Joined: Tue Oct 21, 2008 11:17 pm
- Name: Scott Stelzer
- Operating system: Windows
- License type: Pro
- SketchUp use: urban planning
- Level of SketchUp: Beginner
by thomthom » Tue May 12, 2009 8:44 pm
ScottLininger wrote:Fantastic idea!
Thanks. ScottLininger wrote:One thing that *might* make your script simpler would be use a flattened copy of the window component to cut the 2nd hole instead of creating a new definition or group. (One less thing to keep track of and would keep the file size small.) However, I do like the idea of hiding all of the geometry inside the new hole to keep it out of the way... which wouldn't work with this approach.
That assumes the cut-out to be symmetrical. I trace the intersections specifically since the opposite cut-out could very well be completely different.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by thomthom » Tue May 12, 2009 9:15 pm
Been thinkning of what Scott suggested in another thread; see if I can use use onTransactionCommit. I'll make a command stack, where I take all actions I currently perform in events and push them into the command stack array. Then I use the onTransactionCommit to execute them. Will see how that works out.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Chris Fullmer » Tue May 12, 2009 9:57 pm
BTW, I'm really happy to see this script finally up and working. Even if it is a little buggy at this point. I know you've put a TON of time into it, so I'm glad you haven't hit any show stopper problems with the API or anything. Good work, keep it up!
Chris
-

Chris Fullmer
- SketchUp Team

-
- Posts: 6916
- Joined: Wed Nov 21, 2007 3:21 am
- Location: Boulder, CO
- Name: Chris Fullmer
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: landscape architecture
- Level of SketchUp: Advanced
-
by thomthom » Tue May 12, 2009 10:03 pm
I'd say the bugsplat is a show-stopper... 
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by BillW » Wed May 13, 2009 9:31 am
Thom I have had a component hole cutting tool for a while - it doesnt use observers as the original code is ancient. Perhaps you might want to reuse. A component placed on a face must have a set of linked edges which define the shape of the cutout which reside on the cutting plane of the component. This means that the geometry of say a window doesn't have to span the component cutting plane inorder to perform cut. Try it in the example file. Select all components and run "Component punch". Notice the circular window which shows the edges of the window outline seperate from the geometry. If there is no back face (in the same mesh) parallel to the front face containing the component then the front face is cut only which allows the user to reuse for say running an intersection. componentpunch.rb hole cutout.skp Regards BillW
-
BillW
-
- Posts: 33
- Joined: Thu Jan 10, 2008 6:53 pm
by thomthom » Wed May 13, 2009 9:57 am
Thanks Bill for looking at this. I had a look at your plugin. The thing is that I want to make the holes editable, avoiding having to edit the holes separately. It's that process that takes time when I need to do revisions to model which I want to avoid.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by plot-paris » Wed May 13, 2009 10:36 am
great plugin, Thom! this is one of the things that should have been a part of SketchUp all along. and now you did it! of course its still alpha, but its such an important script. I felt like crying with joy when I first hit the double-cut command and all the component copies cut through the walls... after playing a bit I found something interesting: the double-cut component only cuts through the second face of the wall, if it contains an edge in this second plane (example on the right). so if the component goes right through the wall and doesn't provide the edge in the second wall-face's plane, it doesn't work as a double-cut. that means that you can only use a component for a wall with exactly the right thickness... (did this last paragraph make any sense? quite difficult to describe... )double_cut01.jpg
-

plot-paris
-
- Posts: 1564
- Joined: Tue Apr 01, 2008 10:15 am
- Location: Konstanz, Germany
- Name: plot-paris
- Operating system: Windows
- SketchUp version: 2016
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by thomthom » Wed May 13, 2009 10:40 am
Try making sure you have edges where it intersects with the wall, then extrude further out once more. It doesn't detect faces intersecting the opposite face, but only edges.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by thomthom » Wed May 13, 2009 10:46 am
Here's an example file. 
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Gjenio » Wed May 13, 2009 10:52 am
I´m not a ruby expert therefore I cannot give you any suggestions, unfortunately. But let me express my congratulation for your effort to develope such a plugin that will become one of the most useful sketchup plugins. Thanx! Go ahead, please!
-
Gjenio
-
- Posts: 138
- Joined: Sat Dec 01, 2007 12:10 pm
- Name: Eugenio
- Operating system: Windows
- SketchUp version: pre-2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Sir » Wed May 13, 2009 11:09 am
this will indeed be an incredibly useful plugin! when doublecutting, will it make a permenant cut, or will it just make the intersecting faces hidden? because this would then allow you to move the windows about, and as you moved them the wall would hide before them and then heal behind... this will be so useful fo old skool windows where they didnt know what symmetry was 
-
Sir
-
- Posts: 192
- Joined: Mon Jan 12, 2009 3:42 pm
- Name: Mat B
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by plot-paris » Wed May 13, 2009 11:21 am
thomthom wrote:Try making sure you have edges where it intersects with the wall, then extrude further out once more.
thats what I did with the example on the right hand side. so that means you always have to design Double-Cut-Components (DCCs as opposed to DCs (Dynamic Components)  ) for a specific wall thickness. now that I come to think of it, this may even be a positive thing - thus you will always see, if a wall is not exactly the right thickness 
-

plot-paris
-
- Posts: 1564
- Joined: Tue Apr 01, 2008 10:15 am
- Location: Konstanz, Germany
- Name: plot-paris
- Operating system: Windows
- SketchUp version: 2016
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by thomthom » Wed May 13, 2009 11:25 am
Mind you, if you make a DCC for a wall 200mm thick, and then try to place it on a wall 400mm thick; it won't cut initially. But if you scale the instance 2x in the components Z-axis so that it intersects it will make the cut.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by thomthom » Sat May 23, 2009 12:39 pm
I changed the script so all observers events where I added/removed/edited anything to the model where qued up in an command array. That array where then read by the onTransactionCommit. At first it appeared to work, but then I got the bugsplats again. (I might not have done the actions to trigger it initially.) I've been trying to find the cause of the bugsplat, but all I've found so far is that it happens if I add/remove DDC after they have been made into DCC components. If I just move, rotate or scale them there is no bugsplat. What I find very odd is that the bugsplat occurs when I open the second scene. - Code: Select all
Make DCC Add/Remove DCC (this will trigger the splat later) File->New (New model opens, no bug splat.) File->New (Blugsplat! Why so late?)
I'm wondering if it might be due to some entity references, but I reset all arrays/hashes containing references when a new model is opened. The only thing I haven't tried is keep track of all observers and removing them. But I'm not sure if I'm able to remove them all...
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by plot-paris » Thu Jun 11, 2009 10:37 am
hi Thom, I had a lot of problems with SketchUp the past week; lots of 'bug splats' when using the drape tool. and I got an error message every time I closed the program (and in fact, when I opened the task manager, I discovered that SU hadn't closed at all, but was still running in the background. so after opening and closing several models I had five SU versions running in the background at full speed, bringing down my computer entirely). after checking, which plugin was responsible for these errors, I found that it is the DCC-plugin. no idea, why that is. but I thought you might be interested in that. 
-

plot-paris
-
- Posts: 1564
- Joined: Tue Apr 01, 2008 10:15 am
- Location: Konstanz, Germany
- Name: plot-paris
- Operating system: Windows
- SketchUp version: 2016
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by Chris Fullmer » Thu Jun 11, 2009 10:58 am
You might check the first post again Jakob, I think Thom's aware of the splatters  If I remember correctly this plugin release was more of a developer preview than a full featured stable release. Chris
-

Chris Fullmer
- SketchUp Team

-
- Posts: 6916
- Joined: Wed Nov 21, 2007 3:21 am
- Location: Boulder, CO
- Name: Chris Fullmer
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: landscape architecture
- Level of SketchUp: Advanced
-
by thomthom » Thu Jun 11, 2009 11:03 am
Yes, it's written in large bold red letters at the very top of the original thread...  And in the comment to the download link.
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by plot-paris » Fri Jun 12, 2009 10:35 am
I know. but I just thought it was interesting to know that the plugin disturbs all the workings of SketchUp - even when not being used. so the crashes appear when you use completely different tools... (that does make sense of course, because the plugin has to monitor the model at all times).
-

plot-paris
-
- Posts: 1564
- Joined: Tue Apr 01, 2008 10:15 am
- Location: Konstanz, Germany
- Name: plot-paris
- Operating system: Windows
- SketchUp version: 2016
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by thomthom » Fri Jun 12, 2009 10:45 am
Yea - I've had to disable it. Only have it enabled when I try to debug it. This plugin has really been bugging me. I just wish there was any data to get from SU when it crashed...  I have thought of an alternative method to do this. One that doesn't keep direct references to entities. Hopefully that'll sort it out. But it require a heavy re-write. So it's set aside for later when I have better time
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Jim » Fri Jun 12, 2009 2:49 pm
I had a look earlier this week, but I was getting an error indicating you were calling .entities on an Instance. Will look again today.
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by thomthom » Fri Jun 12, 2009 2:57 pm
Jim wrote:I had a look earlier this week, but I was getting an error indicating you were calling .entities on an Instance. Will look again today.
hm.. that's an error I haven't gotten... care to paste it here next time you get it?
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Jim » Fri Jun 12, 2009 3:53 pm
This happened after I downloaded your hole example, turned-off double cutting, then tried to turn it back on. - Code: Select all
Error: #<NoMethodError: undefined method `entities' for #<Sketchup::ComponentInstance:0x6113c84>> C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:356:in `intersect_edges' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:349:in `each' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:349:in `intersect_edges' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:174:in `place_cutout' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:149:in `make_cutouts' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:139:in `each' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:139:in `make_cutouts' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:138:in `each' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:138:in `make_cutouts' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:1068 C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:356:in `call' C:/Program Files/Google/Google SketchUp 7/Plugins/other/tt_double_cut.rb:356
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by thomthom » Fri Jun 12, 2009 10:25 pm
Was that with the original 0.1.0 or with the 0.2.0 which I posted later in the thread?
-

thomthom
- PluginStore Author

-
- Posts: 19457
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2019
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Jim » Fri Jun 12, 2009 10:38 pm
0.2.0a
Hi
-
Jim
- Global Moderator
-
- Posts: 4678
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: ohio
- Name: Jim
- Operating system: Windows
- SketchUp version: 2017
- License type: Pro
- SketchUp use: hobby
- Level of SketchUp: Intermediate
-
by Ad Machine » 5 minutes ago
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Developers' Forum
|