[Plugin] Descaler v1.1 20121218

[Plugin] Descaler v1.1 20121218

Postby TIG » Sun Dec 16, 2012 4:13 pm

Copyright 2012-2013 (c) TIG
All Rights Reserved.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES,INCLUDING,WITHOUT LIMITATION,THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
###
TIG-Descaler.rb
###
If a selected group or component-instance has been scaled this tool 'descales'
it; that is, it makes it the same size but no longer scaled; and it also
'descales' any textured materials on faces within it.
If there is more than one instance of a 'container' it is first made_unique.
It iterates into nested groups/instances to 'descale' them too.
Usage:
Select the 'container[s]' and from the context-menu run 'TIG.Descaler'.
This menu-item only shows if there's a suitable selection - i.e.
a group or component-instance which has a scale other than 1.0 in x or y or z.
It is one step undo-able.
Note that it does not work on scaled DCs, these need built-in 'tricks'...
###
Donations:
Via Paypal.com to info @ revitrev.org
###
###
TIG-Descaler.rb
###
###
Version:
1.0 20121216 First issue.
1.1 20121218 Doesn't change DCs. Code more robust and faster.
0.PNG
1.PNG
2.PNG
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.0 20121216

Postby JClements » Sun Dec 16, 2012 5:57 pm

Thanks, TIG. Great idea. Very practical.

:?: I did notice that when descaled the group is not restored to its original position in the model. Is there a way to prevent that?




Happy holidays!

Cheers, John
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Descaler v1.0 20121216

Postby TIG » Sun Dec 16, 2012 9:00 pm

JClements wrote:Thanks, TIG. Great idea. Very practical.
:?: I did notice that when descaled the group is not restored to its original position in the model. Is there a way to prevent that?
It ought to be in the exact same location... :? I tested it on many permutations... BUT you have obviously got one where it fails... If you PM me an example SKP I'll look at it... It should be a straightforward fix to ensure it does not change an object's location EVER... It does involve a lot of scaling,rescaling. transformations etc... BUT it should always end up where it started... :roll:
It can be fixed if if needs be ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.0 20121216

Postby Pixero » Mon Dec 17, 2012 8:55 am

Thanks! Another great one from you.
Might come in handy when working with scenes with cad files imported in the wrong scale and then rescaled inside SU.
0
User avatar
Pixero 
 

Re: [Plugin] Descaler v1.1 20121218

Postby TIG » Tue Dec 18, 2012 10:50 am

Here's v1.1 viewtopic.php?p=445744#p445744
It's now trapped to NOT process DCs as these can cause issues; there are other tricks to scale textures back to be 'right' within scaled DCs code/functions...
It is also made more robust and faster [by processing 'edges' rather than 'vertices'].
Reports of 'jumping' Descaled objects should now be a thing of the past...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby Edson » Wed Dec 19, 2012 11:37 am

TIG,

I am speechless once more! a great part of sketchup's ease of use is owed to you, my friend (and to all the other plugin authors, to be sure). a huge THANKS to you. :thumb: :sketchstatic:
0
edson mahfuz, architect | porto alegre • brasil
http://www.mahfuz.arq.br
User avatar
Edson 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby erikB » Wed Dec 19, 2012 5:15 pm

Thanks TIG, very handy ruby !!! :thumb:
erikB
0
User avatar
erikB 
 

Re: [Plugin] Descaler v1.1 20121218

Postby andybot » Wed Dec 19, 2012 7:07 pm

Edson wrote:TIG,

I am speechless once more! a great part of sketchup's ease of use is owed to you, my friend (and to all the other plugin authors, to be sure). a huge THANKS to you. :thumb: :sketchstatic:


YES! Thank you TIG. I have been wanting this capability, so glad you made this happen.
0
my blog featuring recent projects
User avatar
andybot 
Premium Member
Premium Member
 

Re: [Plugin] Descaler v1.1 20121218

Postby EscapeArtist » Wed Dec 19, 2012 8:52 pm

Thank you! This is incredibly useful. :thumb: :thumb:
0
User avatar
EscapeArtist 
Top SketchUcator
 

Re: [Plugin] Descaler v1.1 20121218

Postby tulacong » Thu Dec 20, 2012 3:30 pm

thank Tig very good
0

tulacong 
 

Re: [Plugin] Descaler v1.1 20121218

Postby matt.gordon320 » Sun Dec 23, 2012 9:13 pm

Thanks TIG!
0

matt.gordon320 
Premium Member
Premium Member
 

Re: [Plugin] Descaler v1.1 20121218

Postby danielfagerberg » Mon Sep 09, 2013 11:29 am

Dear TIG, super thank you for this.
I have a question though... i have several hundred component instances but where i have 6 different components...
problem is that i now get several hundred different components...
any possibility to select instances with a certain scale and make them in to only one new component?
i have understood that if i "change Axes" the instance looses its 'reset scale' option in the context menu, but they still have the same definition name, wich in turn leads to that the report comes out as only one volume...
Thank you for all your work!!!
/Daniel
0

danielfagerberg 
 

Re: [Plugin] Descaler v1.1 20121218

Postby matt.gordon320 » Tue May 13, 2014 12:41 am

TIG wrote:there are other tricks to scale textures back to be 'right' within scaled DCs code/functions...


Hi TIG, would you by chance be willing to elaborate on descaling functions you alluded to relative to DC's? That's pretty much the only thing holding me back from getting clearance to build my firm a DC library.

Thanks!
0

matt.gordon320 
Premium Member
Premium Member
 

Re: [Plugin] Descaler v1.1 20121218

Postby TIG » Tue May 13, 2014 11:25 am

This is a well known issue: viewtopic.php?f=289&t=44979

Textures in DCs behave as Textures in any other SketchUp Component: if you Scale the Object you Scale its Texture.

BUT there is a DC "trick" that will avoid this.

If your DC contains at least one sub-component/group that is also a DC and that positions itself with a formula [even if the move=0], then when you use the Scale tool on the parent DC any "raw geometry" inside that parent DC will be "resized" instead of just "stretched" - so there is no "scaling" of the texture.

The context-menu "Scale-Definition" used on a unique DC will also reset the Texture's scale back as it was, BUT then that will loose the DC scaling ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby matt.gordon320 » Tue May 13, 2014 6:57 pm

TIG wrote:If your DC contains at least one sub-component/group that is also a DC and that positions itself with a formula [even if the move=0], then when you use the Scale tool on the parent DC any "raw geometry" inside that parent DC will be "resized" instead of just "stretched" - so there is no "scaling" of the texture.


TIG, that's just brilliant! I have one more that came to mind in that case.

I'm creating a series of DCs that cut into a single plane wall, with adjustable recess and window parameters (width, height, mullions,etc). For this "trick" you mentioned to apply, do any materials need to be embedded as options or swatches within the DC, or can it inherit materials by painting a DC instance (where the "default" painted faces would inherit the new material).

I'd like to be able to sample the wall texture and paint the component, so that the recess will inherit the correct texture from the wall material.

Recess Texture DC Brick.png


I know there's a good chance the UV orientation might not be perfect, but it'd be nice to have it work that way. Can't always get everything perfect. I'm currently building on as a test, but I'm still fairly new to DCs as a whole, so it might take me quite a few tries to test it out and uncover the answer solo.

Thanks for all the help so far!
0

matt.gordon320 
Premium Member
Premium Member
 

Re: [Plugin] Descaler v1.1 20121218

Postby TIG » Wed May 14, 2014 6:04 pm

If you have a series of materials you do need to embed small swatches inside the DC, so purging won't remove them.
Then you can specify the material by 'name' in the DC Material= function.
BUT you can only apply materials to groups/instances inside the DC.

There are several advice pages on the swatch workaround...
I posted my fix because it's less well documented and fixes materials on faces inside scaled DCs, rather that applies different materials to objects in the DC...

My method assumes the loose faces inside the DC have materials... and the ScalerDC 'change' jolts the contents into recreation, with corrected scaling.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby matt.gordon320 » Wed May 14, 2014 7:27 pm

TIG wrote:... and the ScalerDC 'change' jolts the contents into recreation, with corrected scaling.


Thanks TIG, I appreciate the help. I think I'm going to have to do some thorough testing to get first hand experience with it.

Dependent on the axis orientation (say a window that utilizes glue to), does the ScalerDC have to be in the X axis or will others work? Just trying to get a better and more thorough understanding of exactly what it's doing.
0

matt.gordon320 
Premium Member
Premium Member
 

Re: [Plugin] Descaler v1.1 20121218

Postby unearthed » Wed May 14, 2014 10:32 pm

Hi TIG, When I ran Descaler it successfully descaled all components but gave all my components unique names. Components are all either circles or simple 2D blob shapes, lying flat. Is this a bug? Or is there a way 'round it?
0
Growplan - People ∩ Plants ∩ Place

windows 7 64b, 4GB RAM, SU 8.0.16846
Gimp, QGIS, Vectorworks 12, Bricscad 11

unearthed 
 

Re: [Plugin] Descaler v1.1 20121218

Postby TIG » Thu May 15, 2014 10:12 am

matt.gordon320 wrote:
TIG wrote:... and the ScalerDC 'change' jolts the contents into recreation, with corrected scaling.


Thanks TIG, I appreciate the help. I think I'm going to have to do some thorough testing to get first hand experience with it.

Dependent on the axis orientation (say a window that utilizes glue to), does the ScalerDC have to be in the X axis or will others work? Just trying to get a better and more thorough understanding of exactly what it's doing.
ANY change in the 'position' of ScalerDC jolts textured faces into being 'rescaled' back to normal if the 'parent' DC is Scaled.
If you look at its formula: X =parent!X-parent!X - it effectively sets X=0 which is where it is initially placed: any change to its X, Y or Z should have the same effect.
I not sure 'why' it works... but it does :shock:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby TIG » Thu May 15, 2014 10:21 am

unearthed wrote:Hi TIG, When I ran Descaler it successfully descaled all components but gave all my components unique names. Components are all either circles or simple 2D blob shapes, lying flat. Is this a bug? Or is there a way 'round it?
It always makes the 'descaled' instance unique.
BUT you can edit the script TIG-Descaler.rb using a plain text editor like Notepad.
If the lines starting at line#71
Code: Select all
if c.is_a?(Sketchup::Group)
  defn=c.entities.parent
  c.make_unique if defn.instances[1]
  defn=c.entities.parent
else ### it's a ComponentInstance
  defn=c.definition
  c.make_unique if defn.instances[1]
  defn=c.definition
end
Change it to read thus:
Code: Select all
if c.is_a?(Sketchup::Group)
  defn=c.entities.parent
  #c.make_unique if defn.instances[1]
  #defn=c.entities.parent
else ### it's a ComponentInstance
  defn=c.definition
  #c.make_unique if defn.instances[1]
  #defn=c.definition
end
That way the lines starting with # are ignored and the objects are not made unique ! :geek:
BUT note that if you have several instances with different scaling then the end results might be unexpected... :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby unearthed » Fri May 16, 2014 2:35 am

Thanks very much TIG - I'll go off and test it on some components with diff. scaling and see what comes up.

These are for plants as my numbers are climbing into the 1000's (and soon into the 10,000s) so I export to Excel/Vectorworks for counting etc.
0
Growplan - People ∩ Plants ∩ Place

windows 7 64b, 4GB RAM, SU 8.0.16846
Gimp, QGIS, Vectorworks 12, Bricscad 11

unearthed 
 

Re: [Plugin] Descaler v1.1 20121218

Postby Penelope » Sun Aug 23, 2015 11:42 pm

Hi TIG
I'm running SketchUp Pro 2015 (Version 15.3.331 64-bit). I installed this plugin and tried right-clicking on one of the scaled Dynamic Components I have with messed-up textures. But I don't see your plugin.
Might it be buried somewhere else not obvious?
Has something changed recently with Sketchup which keeps it from working?
Thanks.
Penelope
0

Penelope 
 

Re: [Plugin] Descaler v1.1 20121218

Postby TIG » Mon Aug 24, 2015 6:29 pm

Penelope wrote:Hi TIG
I'm running SketchUp Pro 2015 (Version 15.3.331 64-bit). I installed this plugin and tried right-clicking on one of the scaled Dynamic Components I have with messed-up textures. But I don't see your plugin.
Might it be buried somewhere else not obvious?
Has something changed recently with Sketchup which keeps it from working?
Thanks.
Penelope
If you read through the thread... unfortunately it does NOT process Dynamic Components.
Any subsequent change to the DC would immediately mess up the [re]textured material.
You can try exploding the DC, and then regrouping/re-component-ing - without DC attributes...
Then it will work...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Descaler v1.1 20121218

Postby 3dita » Wed Aug 26, 2015 10:32 am

I'm only finding about this plugin now. So it's basically a reset xform for Sketchup?
0
User avatar
3dita 
 

Re: [Plugin] Descaler v1.1 20121218

Postby bsfranza » Thu Aug 22, 2019 8:28 am

hi there,

im currently struggeling with 3d warehouse models.. some of them scaled wrong and consist of groups components, scaling them down is no problem to have the right size, but to avoid rendering issues wirth third party apps etc i want all groups and components to be 1:1 and not scaled.. so i come to use your plugin which processes nested entities, however, there are 2 problems...

first: if the mothercontainer is not scaled, but its children, the plugin does not show in the context menue :) ...

second: in contrary to fredos "scale definition" descaler kind of breaks uv mapping:) .. (most likely due to processing entities like faces and lines too?)...


would be cool if these issues could be adressed in a future release :)

best, franz
0

bsfranza 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 5 guests

Visit our sponsors: