Itoo Software Forum

Author Topic: Another Railing Style...  (Read 662 times)

Adam86

  • Newbie
  • *
  • Posts: 36
Another Railing Style...
« on: March 08, 2018, 01:33:42 PM »
I'm building a few different types of railing style, I'm close with teh following however I can't see how to get the railing spikes evenly distribute and stop near the posts - can someone suggest the best way around this?

Adam86

  • Newbie
  • *
  • Posts: 36
Re: Another Railing Style...
« Reply #1 on: March 09, 2018, 09:39:56 AM »
Anyone? :)

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 890
    • iToo
Re: Another Railing Style...
« Reply #2 on: March 09, 2018, 11:41:55 AM »
Hi.
Please attach Your simplified scene. You will get help way faster. We wont have to redo scenes, and better see what works and what not in Your personal case.

General advice- use posts as "corner segment" and spikes as "evenly segments" :
« Last Edit: March 09, 2018, 11:51:13 AM by Rokas »
Rokas
iToo Software

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 890
    • iToo
Re: Another Railing Style...
« Reply #3 on: March 09, 2018, 12:21:02 PM »
another suggestion to use conditional operator
Segment  X Counter  set "multiple of" value:
Rokas
iToo Software

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1599
Re: Another Railing Style...
« Reply #4 on: March 09, 2018, 01:39:26 PM »
Hi,

Thanks for the answers Rokas. They're all great solutions. Here's another option which uses a custom macro to create a sub-evenly input.

Basically, it is dividing the space in a spline section by a set evenly distance and then scaling an empty (null) segment to create the gaps. In effect creating a second level of evenly segments between the current evenlys. If you prefer you can even add some geometry to scale between the sub-evenly segments instead!



There are a couple of restrictions with this macro as it stands.

- The posts must be the same size for the start, end and evenly segments.
- The posts must have their pivot set to X > Center.

That's about it. If this is useful we'll add it to the built-in macros.

Cheers,

Paul
« Last Edit: March 09, 2018, 01:45:37 PM by Paul Roberts »
Paul Roberts
iToo Software

Adam86

  • Newbie
  • *
  • Posts: 36
Re: Another Railing Style...
« Reply #5 on: March 09, 2018, 03:35:49 PM »
Thank you both for sharing on how I can get this to work. I'm still struggling if I'm honest, I dont see how I can still get the spacing in the horizontal bars when it approaches the posts, there needs to be this detail where it stops, attaches to bracket, and then to post. I need the spikes to equally share between the posts and not create past the bracket areas. post to post should be approx 1.8mm spacing.

I have attached this time the Max file with the rail style - apologies for not sharing it earlier.

Paul I love the idea of having secondary equals in the way you have put it together in a Macro but the macro text in some of the functions are just beyond me!

I thought I could get the second Array to use a NULL object, but I don't see how it affects anything as even after i adjust the padding nothing happens - am I doing this wrong? I figured If I could pretend in the second Array that this NULL was the posts using same settings as first array it would space the Spikes the same.

« Last Edit: March 09, 2018, 04:02:30 PM by Adam86 »

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1599
Re: Another Railing Style...
« Reply #6 on: March 09, 2018, 04:58:08 PM »
Hi,

I understand - that macro can get a little complex if you're not used to expressions. However that's the joy of macros - you don't need to understand them :)

They allow us to add features as though there were built-in nodes and you can just use them as they are. Attached is a version of your railing that uses the macro, I didn't need to change it, I just reorganised the style a little so that the spike and the posts are in one generator and everything else is in another. This gets around the requirement that the posts need to all be the same size.

I hope it helps.

Cheers,

Paul
Paul Roberts
iToo Software

Adam86

  • Newbie
  • *
  • Posts: 36
Re: Another Railing Style...
« Reply #7 on: March 09, 2018, 05:14:18 PM »
Paul this is exactly what I needed thank you! Can I ask was I close to getting it the way I wanted or was my approach fundamentally floored since I would have needed this Macro in order to get the last step?

Could you explain to me what is happening with this Macro, and how it is making everything work So I have a little more understanding please?

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1599
Re: Another Railing Style...
« Reply #8 on: March 09, 2018, 06:45:48 PM »
Hi.

Basically what the macro is doing is finding the length of the spline section using the XSectionLength variable and then dividing that by the spike's desired spacing distance to find out how many times the spike can be repeated between the existing evenly segments. The result is rounded down to the nearest whole number using the Floor command and assigned to a variable called NumReps. Input1 is a numeric node with the size of the spacing.


real numReps = floor(xSectionLength/Input1);

Now that we know how many division roughly fit into a section we can work out the spacing that needs to go between each spike. To do this we first need to deduct the size of the posts and the spike so that we're left with only the combined size of all the spaced needed. In the expression below Input2 is the X size of 1 post and Input3 is the X size of the spike.

As you can see below we use the overall spline section size, minus the size of a post, minus the size of all the spikes. We already know the number of spikes we'll be using from the previous variable: numReps. To find the size of each gap we can then divide the size of the section length minus the geometry by NumReps.

real PaddingSize = (XSectionLength-Input2-((numReps-1)*Input3))/numReps;
return PaddingSize;

This value can now be used to set the X Size of a null segment and alternate it with the spike to create the correct pattern. (it's easier than it sounds when you get the hang of it :) )


Quote
Can I ask was I close to getting it the way I wanted or was my approach fundamentally floored since I would have needed this Macro in order to get the last step?



There are a lot of ways to create anything in RailClone, and there's nothing wrong with the approach you were taking. Using your techniques Rokas' suggestions would probably have put you more on the right track.


You could make it even easier by combining the Rail and the Spike and using it in the default input with Adaptive segments. You might get some slight scaling deformation, but it's the easiest solution using RailClone's core features. I've attached a sample file with this approach.


I hope that helps,


All the best,


Paul
Paul Roberts
iToo Software