How to Scale Dynamic Components Material?

materials
scale
dynamiccomponents

#1

SketchUp is a God send to the majority of designers in this world! Freedom, Simplicity, Creative, Cost Effective and Fast!

Dynamic components are the most progressive part of sketchup… simple formula’s allow for massive productivity increases for repetitive tasks and as far as I know, no other 3D software has this implementation.

There is however one very large problem! ‘Scale’ - Scaling things is great… sometimes! As scaling is quick you can create a very accurate image (sketch) for visualisation purposes! However, most have us who have used most of the major CAD platforms moved to SketchUp because we realised we can use it ‘accurately’ just as with most other ‘high end’ programs.

Most of us now use Sketchup to create Realistic visuals… So where’s the problem I hear you ask? MATERIALS!!!

Dynamic Components use the scale function even when you enter in a hard and fast formula; they are still stretching the DC from its original shape. which I understand because 9 out of 10 times you will have a group of shapes in a Sub Component! However, unlike a normal sketchup model where you will probably want the material to scale… 9 out of 10 times you will never want a DC to scale its Material.

Somehow we need a way of preserving the scale from the developers material bar directly into the DC for all users/downloaders.

My current problem is that I have 10 different Door Styles with up to 12 different elements in each and with 8 different materials applied to each door style all Dynamic X and Y axis inputs! I really need a simple formula/workaround???

The best option I have found that seems to make sense is this formula below written by TIG… but i’m banging my head to get it to work!

class DCFunctionsV1

def resize_material(vars)
### Usage as DC function: “Material”
### =resize_material(oriMaterial,oriX,oriY,LenX,LenY)
### the 1st 3 arguments passed are custom - ‘material-name’ of small nested
### group’s material, and then that material’s x/y size AND
### the main DC’s x/y size, in cm - e.g 100,100.

If anyone could put this into Layman’s terms (or a couple of screenshots) for me I would be very appreciative! Also when it’s best to use a function like this? or if someone could write a magic ‘do not scale material’ formula… I would be for ever grateful :slight_smile:

As more of us have to render out our designs… this truly becomes a massive problem! Thank you for reading and sharing any input on this matter!

Best wishes


Dynamic Component Area
#2

There is no code there to read.
How about a link to the original forum thread, at the least ?

That said, modifying a base class is usually a big no-no, especially when it is a class that is used by everyone else. So this could only be used for your own use.


#3

How to prevent texture from scaling

is at topic discussed on
http://sketchucation.com/forums/viewtopic.php?f=289&t=66642\

will give some solutions


#4

Hi Dan,

I would say there’s a much bigger argument for materials to default to being non-scaled, as it’s very easy to manipulate a Materials scale in the SU viewport or even just by right clicking. Not the case with DC’s! If Trimble recognise the importance of DC’s and Warehouse to their overall dominantion to the interior design/architecture market then this is a big must and quickly!

Please see link below as asked for:

Thanks


#5

Many thanks for your help pcmoor!

The link is great… but like the other guy posting, i’m still struggling to see how and where I can use it in my DC! ultimately still becomes very complex in a DC with a large amount of options!?

Did you use this at all? Would love to have your thoughts!


#6

I use and believe DCs should be swap-able, simplify-able with minimum use of hidden elements, or none at all. So a door DC would be only one style, that can be right-clicked swapped with another where it auto updates to its current size (possible through double wrap and embedded length attributes) .
The material elements that required tonot to strech with scale are governed by a hidden fixed swatch of the same texture as shown by goga63 in the scaler example of Tigs solution
Without an example of your DC I can’t be clear about any solutions, so can PM me if sensitive about intellectual rights. But most likely you have some swatches embedded in your DC, so just set their sizes to a fixed length


#7

Okay, read that. It is not code really that TIG posted.
It was a comment cut out of some code, describing the use of a method.
The post implies, (apparently) that this method is exposed as an undocumented DC function.

There is the danger that any undocumented functionality could change at anytime, and break any DC using it.


#8

Thanks for the advice Dan! I will avoid then as I wouldn’t want it to fall apart at a later stage. 2 Weeks of work has gone into this!


#9

To go back over what I said, rather than in snippets…

You can add various materials as small swatch faces within a volume within the DC.
You can then access these materials by name using the DC builtin in Material methods.
By adding the materials as swatches you get to import those materials with the DC, although perhaps only one of them is in use at that moment. Because they are built-in to the DC the user will not purge them when doing ‘house-keeping’…

The second part was about scaling DC materials.
The cut down code extract was from some ruby code which adds an extra function to the DC code.
You need to check that the DC function is present and add a new function is it’s not already defined:
...def resize_material(oriMaterial,oriX,oriY,LenX,LenY)...
This is then used in the DC formulas as:
=resize_material(oriMaterial,oriX,oriY,LenX,LenY)
The material swatch material name, original XY and new XY etc…

If the RB file defining the new function loads the DC should work with the material rescaling as desired.
However, if it does not load then the DC will fail with an error.
So it’s only useful ‘in-house’ where you can guarantee the RB will load.
You could distribute the custom function RB [in an RBZ] separately from the DC’s SKP, but that then requires actions by the users you cannot guarantee…
It cannot be done using the basic DC formulas, you must add additional methods…

@autoartgraphic I’ll PM you a set of custom function RB methods so you can see what’s involved.
The RB file can be read to see the usage etc…


#10

I really wish that the adding of extra custom formulae was formalized into a accepted procedure (via the EW,) much like how the install of codecs are handled for media use.


#11

Thanks all for participating in this thread!

I have finally managed to make a fully dynamic door that has horizontal and vertical grains by TIG’s descaler tool in the link given by pcmoor.

If anyone gets stuck on trying to change material direction… Just open up the component you want to change the direction in and ‘select all’ create a new component within it… then you can independently change the axis which inturn controls the material direction! NOTE: You may have to link the LenX,Y,Z to constrain everything.

TIG a special thanks as it’s the sharing of your knowledge and understanding that has helped me achieve this!


Scaled/Nonscaled Textures in Components