[Plugin] Gradient Tools

[Plugin] Gradient Tools

Postby TIG » Fri Aug 13, 2010 1:23 pm

This set of tools adds text-tages to lines/faces giving the gradient as 1:nnn
There are also 'relink' options to update them after changing geometry - unfortunately the EntityObserver onEntityChange doesn't pick up any edge/vertex changes automatically! Aaaargh! :roll:
    (c) TIG 2010

    gradienttools.rb goes into Plugins folder.

    Usage:



    Tag Lines:

    Select some stuff including the desired Edges.
    Pick Plugins Menu Item 'Gradient Tools...' > 'Lines'
    ot type 'gradientline' into the Ruby Console.
    Text is added at center of the Edges says something like
    '1:60' or '1:25.125' or 'HORIZONTAL' or 'VERTICAL'
    [if no more than 1mm difference between end levels].
    Text is put on layer 'GRAD-LINE'.
    See below on how to adjust the default text offset 'vec='...
    You can move the text-tag using the Text tool - this location remembered on
    Relinking although the arrow will relocate to the Edge's midpoint if appropriate.

    Tag Faces:

    Select some stuff including the desired Faces.
    Pick Plugins Menu Item 'Gradient Tools...' > 'Faces'
    ot type 'gradientface' into the Ruby Console.
    Text is added at center of the Face says something like
    '1:60' or '1:25.125' or 'HORIZONTAL' or 'VERTICAL'
    [if no more than 1mm difference between end levels].
    Text is put on layer 'GRAD-FACE'.
    See below on how to adjust the default text offset 'vec='...
    You can move the text-tag using the Text tool - this location remembered on
    Relinking although the arrow will relocate to the Face's center if appropriate.

    Relink Line Tags:

    This relinks any tagged Edges - using the current gradient for the updated Text
    and the current Edge's midpoint for the arrow [relocated text is not moved].
    EntityObservers fail on edges/vertices if they are just moved so they can't be used.

    Relink Face Tags:

    This relinks any tagged Faces - using the current gradient for the updated Text
    and the current Face's center for the arrow [relocated text is not moved].

    Relink ALL Tags:

    This runs 'Relink Line Tags' and 'Relink Face Tags' at the same time.

    Donations:
    by PayPal.com to info@revitrev.org

    Version:
    1.0 20100812 First Issue as linegradient.rb
    1.1 20100813 Renamed 'gradienttools.rb'. 'Gradient Tools...' submenu added.
    Split into tools for 'Lines' and 'Faces'.
    Layer GRAD-LINE/GRAD-FACE used. Text-tag now 'tied' to Edge/Face
    and changes to match the Edge/Face if 'Relink' option used.
    1.2 20100813 Downward pointing faces will now report the correct slope.
    1.3 20100814 'Relink ALL Tags' menu option added.
gradienttools.rb
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby mitcorb » Fri Aug 13, 2010 3:31 pm

Let me be one of the first to offer salutations to a prolific Ruby Titan on yet another great achievement!!!

And, if I lived in your neighborhood, I would be there to help you complete your remodeling tasks, TIG.
0
I take the slow, deliberate approach in my aimless wandering.
User avatar
mitcorb 
Top SketchUcator
 

Re: [Plugin] Gradient Tools

Postby Ben Ritter » Fri Aug 13, 2010 4:32 pm

TIG, Thank you very much, for this and all that you do and share.
0

Ben Ritter 
 

Re: [Plugin] Gradient Tools

Postby hebeijianke » Fri Aug 13, 2010 6:17 pm

TIG
THX
I have a Question
When I use "Tag Faces"
It tags always "VERTICAL" or "HORIZONTAL"
Is it right?
0

hebeijianke 
 

Re: [Plugin] Gradient Tools

Postby TIG » Fri Aug 13, 2010 6:42 pm

hebeijianke wrote:...When I use "Tag Faces"
It tags always "VERTICAL" or "HORIZONTAL"
Is it right?
Should be the same with LINES [edges] AND FACES
A vertical/near-vertical Face/Line = VERTICAL
A horizontal/near-horizontal Face/Line = HORIZONTAL
ALL other slopes return 1:NNN values ?
You need to 'Relink' if you change a Face or Line's vertex...
Capture.PNG

Could you post an example SKP showing us where this happens?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby hebeijianke » Fri Aug 13, 2010 7:23 pm

Look this
0

hebeijianke 
 

Re: [Plugin] Gradient Tools

Postby TIG » Fri Aug 13, 2010 7:37 pm

I understand! Any face that is facing 'down' returns 'VERTICAL'... :?
It was intended for roof/land-form slopes which are not usually upside down... :roll:
BUT it's an easy fix... I'll post an update asap... ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby hebeijianke » Fri Aug 13, 2010 7:40 pm

TIG wrote:I understand! Any face that is facing 'down' returns VERTICAL too...
It was intended for roof/land-form slopes which are not usually upside down...
BUT it's an easy fix... I'll post an update asap...

THX
Your are so Warm-hearted
0

hebeijianke 
 

Re: [Plugin] Gradient Tools

Postby TIG » Fri Aug 13, 2010 7:51 pm

Here's v1.2 20100813 Downward pointing faces will now report the correct slope.
viewtopic.php?p=264130#p264130
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby chloesdad » Fri Aug 13, 2010 9:45 pm

Thank you TIG for your continuing wonderful contributions.
0

chloesdad 
 

Re: [Plugin] Gradient Tools

Postby Pixero » Sat Aug 14, 2010 8:54 am

For a moment I thought you had found a way of making gradient materials...
1
User avatar
Pixero 
 

Re: [Plugin] Gradient Tools

Postby TIG » Sat Aug 14, 2010 9:48 am

Pixero wrote:For a moment I thought you had found a way of making gradient materials...

It simply reports the gradients of edges and faces and tags them - all edge/facetags can be relinked to an edge/face ob a menu click. They are put on their own layers for ease of management.
The use it's intended for is reporting and controlling the gradients of landforms and paths - as you make adjustments you can relink and see if the falls are still acceptable - i.e. not too flat or too steep.
You can also use it on roofs - checking that 'flat' roofs have adequate falls, tiled/slated/shingle roofs have suitable slopes and valleys etc are steep enough.
The tool tags edges or faces as I found that sometimes you need edges like valley centerlines but it's possible to have a face with no edges directly up/down the gradient, then you need to tag the face gradient... :geek:

[You can make Gradient Materials using a suitably graded Texture Image - see viewtopic.php?p=149747#p149747 ]
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby TIG » Sat Aug 14, 2010 9:57 am

Here's v1.3 20100814 A 'Relink ALL Tags' menu option has been added.
viewtopic.php?p=264130#p264130
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby TIG » Sun Aug 15, 2010 8:30 pm

SUC wrote:
Pixero wrote:For a moment I thought you had found a way of making gradient materials...

Would it be possible to make this, TIG?

See the link - it's already been done ? Or am I missing something ??
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby Pixero » Mon Aug 16, 2010 7:10 am

Sorry if I used the wrong word, but I was thinking of a procedural ramp texture.
Something like this: http://www.pixero.com/tutorials_ramp.html
0
User avatar
Pixero 
 

Re: [Plugin] Gradient Tools

Postby frekky12 » Sun Sep 08, 2013 5:32 pm

Hello Tig,

I'm new to this plugin and have just downloaded it and am trying to understand how the ratio is representing the gradient.

Is there a way to represent this ratio in degrees?
0

frekky12 
 

Re: [Plugin] Gradient Tools

Postby Dave R » Sun Sep 08, 2013 8:21 pm

frekky12 wrote:Hello Tig,

I'm new to this plugin and have just downloaded it and am trying to understand how the ratio is representing the gradient.

Is there a way to represent this ratio in degrees?



It's a rise over run thing. 1:1 would be one unit of rise and one unit of run or 45°.

You can get the angle using the yellow Protractor tool.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby TIG » Wed Sep 11, 2013 11:19 am

My Roof tool also has a function to report the angle of a picked roof slope in degrees, A:12 and A:B format...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby rv1974 » Wed Sep 11, 2013 12:13 pm

TIG, many thanks for your efforts!
Could there be support for slopes in percent?
0

rv1974 
 

Re: [Plugin] Gradient Tools

Postby gullfo » Wed Sep 11, 2013 1:35 pm

0
User avatar
gullfo 
 

Re: [Plugin] Gradient Tools

Postby huajiet » Mon Feb 17, 2020 6:24 am

Thanks TIG for this very handy plugin!

I'm barely Ruby-conversant but I'm trying to apply some modifications to your plugin. I have a few questions. Do refer to the attached image.

TIG_.png


1. I've been able to make the tags report the angle in degrees. How do I limit the tag to 1 decimal point?

2. As you might be able to tell from the image, the plugin is reporting the complementary angle (39.6.. degrees) instead of the actual angle of the pitch (50.3 deg, shown in the measurement box at the lower right). how do we rectify this in the script?

Thanks and regards,
HJ
0

huajiet 
 

Re: [Plugin] Gradient Tools

Postby TIG » Mon Feb 17, 2020 1:17 pm

1. You can fix the number of decimal points in any float [into a string] thus:
num = 1.23456
dum = sprintf("%.1f", num)
# >> "1.2"

Here the .1f says 1dp and .3f would do 3dp...
To convert that string back into a float:
dum = sprintf("%.1f", num).to_f
There are many options to this Ruby method...

2. You seem to have it reporting the angle of the face's normal, you could just subtract it from 90 degrees ?
angle = 90.degrees - angle
then convert the angle from radians to degrees before fixing its dp's...
angle = angle.radians
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Gradient Tools

Postby huajiet » Mon Feb 24, 2020 5:11 am

1. it works!

2. the problem seems to have righted itself. will keep your solution for reference in case it acts up again.
#EDIT: it seems the problems crops up when the slope's material is in back face.

Thanks TIG. You're a legend!
0

huajiet 
 

Re: [Plugin] Gradient Tools

Postby TIG » Mon Feb 24, 2020 12:26 pm

The fix for that is to model properly !
Alternatively check norm=face.normal, then norm.z if it's <0 then norm.reverse!
1
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: Alexa Bot, Bpras, guzitom and 12 guests

Visit our sponsors: