[Plugin] Solids Penetration Check

[Plugin] Solids Penetration Check

Postby voljanko » Mon Jun 27, 2011 9:49 am

Here it is,my first public plugin :)

In some cases the intersections between solids can be considered as mistakes.
So this plugin is made to find this mistakes.
Just select some solids and click the Solids Penetration Check from the Tools menu.
The intersections between solids will be highlighted (selected) and colored red.
The version 8 of Sketchup is needed because of SOLIDS.

Now the plugin is a tool and much more useful ,because you can zoom the penetration area.
When you activate the tool,the x-ray option is selected automatically.
Please note that if you check more solids,the time to check will increase significantly.It is because of many boolean
operations between the solids.If you want to see that plugin is doing something (not freezed),you can select the Outliner (Window menu) as the activity display.It can be some kind of progress bar.

What do you think about it?


EDIT:
This project is stoped, the penetration check function is debugged and a part of http://www.susolid.com plugin.
0
Last edited by voljanko on Sun Nov 20, 2011 5:42 pm, edited 9 times in total.
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Intersection Inspector

Postby pilou » Mon Jun 27, 2011 10:12 am

Hello
What is suposed to do?
Post an image will be a great help! ;) (or a video)

As a selection is "blue" enlightting, in what color is the Interception?

you must click on each face message dialog before can exit from the plug!
That is some painful ;)

I have nothing special visual! :o
(I am in V6)
Interception.jpg


(that is the same with 2 cubes grouped nammed!
Interception1.jpg
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Intersection Inspector

Postby voljanko » Mon Jun 27, 2011 10:24 am

Hello,
this plugin is only useful for checking SOLID groups and components,if they are penetrating itch other.
I have remove the message boxes (and updated the file for download) that show you the "ungrupped" entities.So no more painful clicking.
And also it is only for versions 8 and more,because the SOLIDS exists only from version 8 (i think).
0
Last edited by voljanko on Mon Jun 27, 2011 10:28 am, edited 1 time in total.
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Intersection Inspector

Postby pilou » Mon Jun 27, 2011 10:26 am

So information must be done in the first post ;)
But give an image! ;)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Intersection Inspector

Postby thomthom » Mon Jun 27, 2011 10:29 am

Congratulations on your first plugin.

I got a couple of tips:

1. Wrap your code into a module with a unique name that relates to you. This way to isolate your code from the other plugins running.

Example


Code: Select all
module VJO_Intersection_Inspector
 
  def self.check_intersections
    # ...
  end
 
end

( VJO was just a shortening of voljanko that I made just for this purpose of creating an initial for the module name.)


2. Entity.typename is extremely slow! There's rare any need it use this method and it should be avoided.
Instead, use Entity.is_? or Entity.kind_of? to check for types.

Examples:
if entity.is_a?( Sketchup::Face )

if entity.is_a?( Sketchup::Group)

if entity.is_a?( Sketchup::ComponentInstance )


It is many time faster. Check this thread for more info and other performance tips: viewtopic.php?f=180&t=25305

There is another sticky thread that is worth checking out: viewtopic.php?f=180&t=10142
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Intersection Inspector

Postby voljanko » Mon Jun 27, 2011 10:40 am

Thank you thomthom for your suggestions.
I have test the plugin on a model with 31 solids organised in many subgroups and it takes 40 seconds to
find 10 "penetrations".So it is slow and need some speed-up like you suggest.
0
Last edited by voljanko on Wed Jun 29, 2011 6:35 pm, edited 1 time in total.
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Intersection Inspector

Postby voljanko » Mon Jun 27, 2011 10:45 am

I would also like to change the colour of the result to make it more visible,but I don't know how.
Any suggestions?
0
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Intersection Inspector

Postby thomthom » Mon Jun 27, 2011 11:13 am

voljanko wrote:I would also like to change the colour of the result to make it more visible,but I don't know how.
Any suggestions?

Create a material and apply it to the entities.
http://code.google.com/apis/sketchup/do ... erial.html

my_material = model.materials.add( 'IntersectionMaterial' )
my_material.color = 'orange'

face.material = my_material
group.material = my_material
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Intersection Inspector

Postby thomthom » Mon Jun 27, 2011 11:22 am

Trying to read your code - but I struggle to follow the code flow. Seems that your indentation isn't properly aligned throughout your code...
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Solids Penetration Check

Postby voljanko » Mon Jun 27, 2011 11:13 pm

Updated version:
-now is a tool (you can zoom to check the penetration area)
-automatic x_ray view
-red colored penetration area
-new name :)
0
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Solids Penetration Check

Postby pilou » Mon Jun 27, 2011 11:33 pm

Now seems very cool :)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Intersection Inspector

Postby kyyu » Tue Jun 28, 2011 2:30 am

thomthom wrote:
voljanko wrote:I would also like to change the colour of the result to make it more visible,but I don't know how.
Any suggestions?

Create a material and apply it to the entities.
http://code.google.com/apis/sketchup/do ... erial.html

my_material = model.materials.add( 'IntersectionMaterial' )
my_material.color = 'orange'

face.material = my_material
group.material = my_material

voljanko, I see this is how you did it in your plugin. But the way you have it set up, you add a new identical material every single time your plugin is run. You can open up "Window > Model Info > Statistics" to check the number of materials.

You don't need to define a new material. Instead use the following, which will only ever add one pre-defined material to your drawing, no matter how many times you use it:
group.material = 'red'
0

kyyu 
 

Re: [Plugin] Solids Penetration Check

Postby voljanko » Tue Jun 28, 2011 7:16 am

Ok,thanks.
Updated.
Please note,if you have a big model (more than 20 solids),the plugin will need more time to compute all the intersections.
If you want to see that plugin is doing something (not freezed),you can select the Outliner (Window menu) as the activity display.It can be some kind of progress bar.
0
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Solids Penetration Check

Postby voljanko » Tue Jun 28, 2011 2:06 pm

Please help me find the solution for this bug:
-when one solid is a subcomponent and a subgroup in a component, the plugin can't find the penetration.
I know the problem is in line 132 def1=solid1.entities.parent ,but don't know what to do about it.
Thanks

EDIT:SOLVED
0
Last edited by voljanko on Wed Jun 29, 2011 1:47 pm, edited 1 time in total.
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Solids Penetration Check

Postby kyyu » Wed Jun 29, 2011 7:00 am

voljanko wrote:Please help me find the solution for this bug:
-when one solid is a subcomponent and a subgroup in a component, the plugin can't find the penetration.
I know the problem is in line 132 def1=solid1.entities.parent ,but don't know what to do about it.
Thanks

You probably have more experience playing with components, than me. :P But what I can see is, there is no need to blame sub(groups or components), yet. Your plugin doesn't even work for two simple intersecting components. "def1=solid1.entities.parent" finds the definition of groups, not components. Component instances don't have the method for "entities". It's the component definition that has that method. That's why the error message saids undefine method. It should be something like "def1 = componentInstance.definition" for components.

Also, another strange thing(bug?) I see is when you have (group or component) inside a (group or component), I get a volume of "-1.0"
0

kyyu 
 

Re: [Plugin] Solids Penetration Check

Postby voljanko » Wed Jun 29, 2011 11:47 am

Ups,I was sure that tested with components.Now it is ok and updated for download.
Now the code indentation is properly aligned so perhaps readable :)

You wrote :"Also, another strange thing(bug?) I see is when you have (group or component) inside a (group or component), I get a volume of "-1.0"

Sketchup assign the volume to -1 when the item is not a solid.If you mean something related to my plugin,please explain more.

You wrote:"That's why the error message saids undefined method."

How do you get this message?Hod do you debug? Im only using message boxes to debug.
0
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Solids Penetration Check

Postby kyyu » Wed Jun 29, 2011 3:56 pm

voljanko wrote:Sketchup assign the volume to -1 when the item is not a solid.If you mean something related to my plugin,please explain more.

No, I just mention it just in case you didn't know about it. Components are hard for me to follow, so I just briefly looked through your code to learn more. At 1st, I was thinking this was causing your bug. But then figured out the error message.

voljanko wrote:You wrote:"That's why the error message saids undefined method."

How do you get this message?Hod do you debug? Im only using message boxes to debug.

Error messages are printed out in the Ruby Console. See picture of one way I debug, by running small snippets of code with Jim Foltz's "Web Console" plugin. Jim also has a "Ruby Toolbar" plugin, that lets you reload your plugin. But I think you need to add a check for if the plugin has been installed previously, or you will get multiple menu items.

Code: Select all
require 'sketchup.rb'

if( not file_loaded?('solids_penetration_check.rb') )
   plugins_menu = UI.menu("Tools")
   plugins_menu.add_item("Solids Penetration Check") { penetrationcheck }
end
file_loaded 'solids_penetration_check.rb'

Where to find SU error messages.png
0

kyyu 
 

Re: [Plugin] Solids Penetration Check

Postby richhaas » Thu Jun 30, 2011 12:56 pm

Any way to get this to Intersect With Model to make bright orange(selectable color) lines to check all the other geometry that is NOT solids?

Richard
0

richhaas 
 

Re: [Plugin] Solids Penetration Check

Postby voljanko » Thu Jun 30, 2011 4:09 pm

Yes,there is a way,why are you asking :)
Anyway,if you want to find the mistakes,that makes your group a non-solid,there is another plugin - Solid Inspector from thomthom.
0
SuSolid.com - solid check - solid repair- solid intersection check - weight plugin
User avatar
voljanko 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Solids Penetration Check

Postby glro » Thu Jun 30, 2011 6:44 pm

is the plugin able to check intersections between solids when they are part of components?
i checked, and it doesn't seem so

the connections are solids, intersection is detected when they are outside the component, and not when theyare inside

is there a way to solve the problem?
0

glro 
 

Re: [Plugin] Solids Penetration Check

Postby richhaas » Fri Jul 01, 2011 6:16 pm

voljanko wrote:Yes,there is a way,why are you asking :)
Anyway,if you want to find the mistakes,that makes your group a non-solid,there is another plugin - Solid Inspector from thomthom.


I don't draw with solids. Need a tool to check all the other things I draw to look for possible overlap conflicts between components, groups etc. 'Tile components' "intersecting" 'cabinet components' for instance...

Richard
0

richhaas 
 

Re: [Plugin] Solids Penetration Check

Postby glro » Wed Aug 10, 2011 10:36 pm

voljanko wrote:Please help me find the solution for this bug:
-when one solid is a subcomponent and a subgroup in a component, the plugin can't find the penetration.
I know the problem is in line 132 def1=solid1.entities.parent ,but don't know what to do about it.
Thanks

EDIT:SOLVED


i cannot help you concerning the ruby programming, but i tried your plugin on the model included in your post, and it worked perfectly; event when i made a component from the component and the group

i tried it also on the file included; components with solids inside, it worked, but in a strange way; i would like to know which are the components that interfere, but the information vanishes when the program stops...
0

glro 
 

Re: [Plugin] Solids Penetration Check

Postby Matt666 » Thu Sep 01, 2011 4:18 pm

Aaaar it does not work with free versions... Can you do something?
Error: #<ArgumentError: 'intersect' is a Pro only feature.>
C:/Program Files/Google/Google SketchUp 8/Plugins/solids_penetration_check.rb:141:in `intersect'
C:/Program Files/Google/Google SketchUp 8/Plugins/solids_penetration_check.rb:141:in `check_penetrations'
C:/Program Files/Google/Google SketchUp 8/Plugins/solids_penetration_check.rb:32:in `activate'
C:/Program Files/Google/Google SketchUp 8/Plugins/solids_penetration_check.rb:159:in `select_tool'
C:/Program Files/Google/Google SketchUp 8/Plugins/solids_penetration_check.rb:159:in `penetrationcheck'
C:/Program Files/Google/Google SketchUp 8/Plugins/solids_penetration_check.rb:13
0
Frenglish at its best !
My scripts

Matt666 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: Bing [Bot], chavinskee, lamdang and 8 guests

Visit our sponsors: