SketchUcation Premium Membership

 

 

[Plugin] #SelectionHideShow.rb v1.1

[Plugin] #SelectionHideShow.rb v1.1

Postby TIG » Wed Jun 03, 2009 10:25 am

#SelectionHideShow.rb adds a context-menu sub-menu with various Selection, Hide and UnHide tools, such as 'Invert Selection', 'Hide/UnHide Selection', 'UnHide All Active' etc...
#SelectionHideShow.rb

Edit:
v1.1 Now tests with ".is_a?" to speed-up and avoids testing already unique groups[after AlexM's advice].
Please, register (free) to access all the attachments on the forums.
Last edited by TIG on Thu Jun 04, 2009 11:10 am, edited 2 times in total.
TIG
User avatar
TIG
Global Moderator
 
Posts: 14026
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb

Postby Pilou » Wed Jun 03, 2009 10:34 am

Very practical! :fro:
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
Pilou
Top SketchUcator
 
Posts: 10089
Joined: Wed Jan 23, 2008 10:33 pm
Operating system: Windows
SketchUp version: 6
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb

Postby Mr S » Wed Jun 03, 2009 11:49 am

Great!
I asked for this a while ago.
I suggested it was something that should be a standard feature in SketchUp
Now it is. Thanks for another great contribution.

Regards
Mr S
=======
Mr S
 
Posts: 264
Joined: Fri Nov 16, 2007 3:44 pm
Location: Liverpool, England

Re: [Plugin] #SelectionHideShow.rb

Postby boofredlay » Wed Jun 03, 2009 1:28 pm

Thanks TIG. However I expected to see Reverse Faces in there too.
User avatar
boofredlay
Global Moderator
 
Posts: 9009
Joined: Mon Oct 22, 2007 1:50 pm
Location: Huntsville/Madison Alabama
Name: Eric Lay
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb

Postby erikB » Wed Jun 03, 2009 2:06 pm

Thanks TIG, and I second the request made by Boofredlay.
erikB
User avatar
erikB
 
Posts: 84
Joined: Mon Dec 03, 2007 5:22 pm
Location: Belgium
Name: Erik Bosquet

Re: [Plugin] #SelectionHideShow.rb

Postby TIG » Wed Jun 03, 2009 4:00 pm

Reverse and Orient faces is already built-in on the context-menu - near the top [as are some other 'select tools']... adding them would only duplicate stuff...
TIG
User avatar
TIG
Global Moderator
 
Posts: 14026
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb

Postby AlexMozg » Thu Jun 04, 2009 7:01 am

TIG
:?: Why constantly to use the method of group_miner, when in him practically is not there a necessity?
:?: Why to apply properties to entity, when are new properties of entity equal to the applied properties?
These questions are linked at a speed of implementation of script on the large scenes.

:!: Example of considerable increase of speed of implementation of script:
Code: Select all
class Sketchup::Group
    def definition
        self.entities.parent
    end
end
def SelectionTool::group_miner(ents)
    ents.each do |e|
        if e.is_a? Sketchup::Group
            e.make_unique if e.definition.instances.length > 1
            SelectionTool::group_miner(e.entities)
        end
    end
end

:!: At the use of method of typename speed of implementation of script goes down in once or twice!
It would be desirable to correct these shortages...
AlexMozg
 
Posts: 65
Joined: Sun Feb 24, 2008 8:33 am
Name: AlexMozg

Re: [Plugin] #SelectionHideShow.rb

Postby Chris Fullmer » Thu Jun 04, 2009 7:42 am

Alex, I have not run any tests on typename, but I use it regularly. Are you saying that it is much slower than .is_a?

I'd rather use the faster method too, I just never knew there was a faster one. I'm sure TIG isn't using a slow method on purpose either...

Chris
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer
SketchUp Team
 
Posts: 6710
Joined: Wed Nov 21, 2007 3:21 am
Location: Davis, CA
Name: Chris Fullmer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb

Postby AlexMozg » Thu Jun 04, 2009 9:37 am

Chris Fullmer wrote:Alex, I have not run any tests on typename, but I use it regularly. Are you saying that it is much slower than .is_a?
Chris

Easily to check...
The more elements in the model - the better results script.

SpeedTest
is_a? - 0.36c
kind_of? - 0.39c
class - 0.422c
typename - 1.313c

Model Statistics:
edges = 48981
faces = 8009
groups = 729
components = 365
construction_lines = 1
construction_points = 4
images = 3
section_planes = 4
texts = 4
others = 2
Please, register (free) to access all the attachments on the forums.
AlexMozg
 
Posts: 65
Joined: Sun Feb 24, 2008 8:33 am
Name: AlexMozg

Re: [Plugin] #SelectionHideShow.rb

Postby thomthom » Thu Jun 04, 2009 9:45 am

That's some interesting numbers. I've always used kind_of? - wasn't aware of the is_a?. then again, I've never tested the speed of methods either.

Thanks for posting this test.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17706
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby TIG » Thu Jun 04, 2009 11:08 am

Thanks Alex - you've probably noticed I used the .is_a? test everywhere else in the script - however, I didn't realise it was so much slower to use typename=="". :oops:
I've also incorporated my own version of your group_miner speed-up suggestion that now avoids testing groups that area already unique... :geek:

I just need to edit ALL of my other scripts to change e.typename=="" to e.is_a?() !!! :cry:

Here's v1.1 viewtopic.php?p=161963#p161963
Last edited by TIG on Thu Jun 04, 2009 11:58 am, edited 1 time in total.
TIG
User avatar
TIG
Global Moderator
 
Posts: 14026
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby thomthom » Thu Jun 04, 2009 11:16 am

Maybe we could add this info to a new stickcy where we collect such useful tips and info?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17706
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby AlexMozg » Fri Jun 05, 2009 10:34 pm

TIG wrote:...I didn't realise it was so much slower to use typename=="". :oops:
.....

For a model ot a few kilobytes to 10 megabyte of substantial difference it is not, but my models ot 40 to 75 megabyte!
_________________________
My model statistics:
Model 68.4 Mb:
Edges 485016
Faces 128906
Component Instances 6055
Groups 3078
Section Planes 4


P.S.
It was even necessary to write the analogue of SketchUp Text tool, because a standard tool begins to work very long.
:roll:
AlexMozg
 
Posts: 65
Joined: Sun Feb 24, 2008 8:33 am
Name: AlexMozg

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby bianhai » Mon Jun 08, 2009 4:25 am

Very good :fro: !
bianhai
Banned
 
Posts: 191
Joined: Fri Nov 30, 2007 3:05 pm
Location: Shanghai China
Name: Brian

Re: [Plugin] #SelectionHideShow.rb

Postby thomthom » Sat Jun 20, 2009 2:20 pm

AlexMozg wrote:
Chris Fullmer wrote:Alex, I have not run any tests on typename, but I use it regularly. Are you saying that it is much slower than .is_a?
Chris

Easily to check...
The more elements in the model - the better results script.

SpeedTest
is_a? - 0.36c
kind_of? - 0.39c
class - 0.422c
typename - 1.313c

Model Statistics:
edges = 48981
faces = 8009
groups = 729
components = 365
construction_lines = 1
construction_points = 4
images = 3
section_planes = 4
texts = 4
others = 2


Hmm... .kind_of? is an alias for .is_a? - Is that fraction of a differences just some other random outside co-incidence?
http://www.ruby-doc.org/core/classes/Ob ... ml#M000370
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17706
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby thomthom » Mon Jun 22, 2009 12:11 pm

I did a somewhat larger test. By the looks of it .is_a?, .kind_of? and .class are pretty much the same. I take the differences due to other system factors at the time of execution.

AT - SpeedTest:
is_a? - 0.89c
kind_of? - 0.782c
class - 0.875c
typename - 2.297c

Model Statistics:
edges = 159630
faces = 61300
groups = 0
components = 1000
construction_lines = 0
construction_points = 0
images = 0
section_planes = 0
texts = 0
others = 0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17706
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby thomthom » Mon Jun 22, 2009 12:51 pm

Much larger test. (did have a few programs open while I did the tests.)

AT - SpeedTest:
is_a? - 16.297c
kind_of? - 16.141c
class - 18.703c
typename - 88.703c

Model Statistics:
edges = 8396595
faces = 1026520
groups = 52643
components = 526428
construction_lines = 2
construction_points = 4
images = 0
section_planes = 0
texts = 0
others = 0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17706
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby 3dsmax9 » Thu Jul 28, 2011 5:19 pm

a tool bar will be very great with this script
3dsmax9
 
Posts: 19
Joined: Sat Apr 04, 2009 4:23 pm
Name: azerty

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby irwanwr » Sat Dec 24, 2011 11:36 am

i think i need this plugin
thank you in advance, sir.
User avatar
irwanwr
 
Posts: 571
Joined: Fri May 21, 2010 2:21 am
Location: Medan, Indonesia.
Name: irwanwr
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Beginner

Re: [Plugin] #SelectionHideShow.rb v1.1

Postby Ivancho » Fri Mar 15, 2013 12:06 pm

NICE!! :ecstatic:
Ivancho
 
Posts: 2
Joined: Wed Aug 01, 2012 7:44 pm
Name: Ivan

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Are you a Premium Member? Get your freebies here. Are you not a Premium Member yet? Upgrade your account to grab these freebies instantly.

Ad Machine
Robot
 
Posts: 2012


Return to Plugins

Who is online

Users browsing this forum: Flippie123, menmsis, renderiza, zoodogink and 7 guests