Itoo Software Forum

Author Topic: Linear 1S Clipping Similar to Array 2S  (Read 3390 times)

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Linear 1S Clipping Similar to Array 2S
« on: June 28, 2018, 03:10:03 PM »
I am trying to build a simple interface for building walls with clipping holes (for windows). I would like to have it all in 1 railclone rather than copy, paste and rotate from X axis to Y for a Linear 1S node. I was hoping I could find a transform of some kind and expose these parameters so the user only has to click on each spline of the wall. Is there a way to do this similar to the Array 2S function (or am I beating my head against a wall here)?

Written in Manual here:
https://www.itoosoft.com/tutorials/parameterise-windows?back=page%3D3%26tag%3Drc



Array 2S Clipping (Works on either X/Y axis which is what I want to achieve with Linear 1S)



I have found it works correctly on the Z axis, which means I can make clipping holes for all windows when its facing the Z, but when the walls are rotated up it will only work on 1 axis. This means the walls facing X and Y need to have a duplicate of the railclone and then rotated to that axis. For the purpose of simplicity I would like to have it work on both X/Y. Similar to this:




Thanks in advance


Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Linear 1S Clipping Similar to Array 2S
« Reply #1 on: June 28, 2018, 04:16:53 PM »
Hi James,

I created a concept style for You. not exactly how You wanted but result is similar, I guess:
Hope You find it at least a bit useful.


Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #2 on: June 28, 2018, 04:41:50 PM »
Thank you Rokas, this looks like what I am trying to achieve. Can you upload a 2017 file please?



Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Linear 1S Clipping Similar to Array 2S
« Reply #3 on: June 28, 2018, 04:46:44 PM »
Sure.
attached 2015 version.
Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #4 on: June 28, 2018, 04:56:47 PM »
Great thanks Rokus! I see what you have done here. The concept works, now I have to work it into my mess :D

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #5 on: July 02, 2018, 03:58:21 PM »
Great thanks this works well.

I have another question similar to the parametric windows thread, please move this if it doesnt belong here - I thought id keep my questions together.

I am trying to create a window that has separate bottom, left, right and x/y evenly. Im having trouble understanding the best way to approach this. I have tried adjusting the expression for a Selector node, also Composite and Conditional, none seem to give me the effect I am looking for. I would like to keep the ratio's the same (bottom window in bottom third of the area), as well as keep the mullions the exact same dimensions.

Here is a screenshot of what I am trying to achieve and how I have sliced it. I would like a basic approach if possible using 1 spline outline, which is why I originally chose a Conditional for the window above in the max file, you can see basically a similar effect without the bottom window piece. I liked the fact you can use the Conditional as a less than more than 50% of spline length, however I am having trouble transferring this concept to my new window.



Cheers!

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #6 on: July 03, 2018, 07:23:59 AM »
I am going through the expressions section of the manual and having an issue with my code, am I missing some important part of the expression here?

return
if(YSplinePosition>0,3,
if(YSplinePosition<1,1,
if(YSplinePosition==0.5,2)));

Compile error. Wrong number of arguments in function: "if" at line 4:
if(YSplinePosition==0.5,2)));
^

What I am trying to achieve is:
Always have the bottom piece (Input 3) from 0 to 0.5
Always have the top piece from (Input 1) 1 to 0.5
Always use the mid piece (Input 2) at exactly 0.5

I modified it to include r (which I think was the missing variable: "r is the value that is output if the test returns false") However it still doesnt behave as I expect.

return
if(YSplinePosition>0,3,
if(YSplinePosition==0.5,2,1));

Evaluation: Ok

Edit:
This is the closest that comes to working however I want the middle piece (Input 2) to stay and the others to tile/scale vertically, if I adjust the height of Y the centre piece can dissapear:

return
if(YSplinePosition<0.49,3,
if(YSplinePosition>0.51,1,2));

Any help would be greatly appreciated thanks!
« Last Edit: July 03, 2018, 07:39:38 AM by James Vella »

Dragan

  • Hero Member
  • *****
  • Posts: 1419
Re: Linear 1S Clipping Similar to Array 2S
« Reply #7 on: July 03, 2018, 09:46:06 AM »
I think you are missing third attribute in If function
Compile error. Wrong number of arguments in function: "if" at line 4:
if(YSplinePosition==0.5,2,  ?  )));
« Last Edit: July 03, 2018, 09:47:38 AM by Dragan »

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Linear 1S Clipping Similar to Array 2S
« Reply #8 on: July 03, 2018, 09:56:31 AM »
Hi James,
It would have been better to separate the topics for different issues.

As You figured out Yourself, Your first expression had missing else value.

Regarding Your final expression and middle peace disappearing. It is gone sometimes as it does not get into defined thin interval  [.49 and .51] percent of y spline.
You can decrease size of segments used thus increasing sampling interval:


Or better way calculate exact size to be used for both Left Bottom and Left Top:


Scene attached to see how I did it.
Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #9 on: July 03, 2018, 10:55:37 AM »
I think you are missing third attribute in If function
Compile error. Wrong number of arguments in function: "if" at line 4:
if(YSplinePosition==0.5,2,  ?  )));

Correct, it was missing an else value.

Hi James,
It would have been better to separate the topics for different issues.

As You figured out Yourself, Your first expression had missing else value.

Thanks I will post separately in future.

Or better way calculate exact size to be used for both Left Bottom and Left Top:


Yes this is exactly what I am trying to achieve thank you! I had a look and would love to use this method for other items similar. Can I ask why you put in the specific values:

Fixed Size Arithmetic:
return (YSplineLength-117.9-140.7)/2-294.3/2;

Where does these numbers come from and how does it relate to the length changing?

Selector Arithmetic:
print 1900-117.9-140.7;
return if(YSplinePosition<0.2,3, if(YSplinePosition>0.5,1,2));

I think I understand the YSplinePosition - if less than 0.2 than use Input 3, if more than 0.5 use Input 1 else Input 2. Why print 1900-117.9-140.7;

Sorry for my newbie questions - I would love to further understand how to create more complicated setups. Is there any detailed documentation on how to use the expressions or format on how to expand on this?

Thanks Again!

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Linear 1S Clipping Similar to Array 2S
« Reply #10 on: July 03, 2018, 11:25:04 AM »
print was just for style debugging. it is not necessary. ;)

regarding numbers:

return (YSplineLength-117.9-140.7)/2-294.3/2;

It is Y size of elements used in the scene which are constant


Same for bottom element it has value 117.9.
We divide by 2 to get middle point.
Subtract half the size of our middle segment, and we know the position it should start.

I would exported Y atributes of the segments to avoid these manually entered values, but style editor would become more cluttered so I avoided that for this reason.


If less than 0.2 only means lets jump over our start bottom element and if the value is bigger that that element- we are good because our calculated Y size will do the job.
0.5 means we should be OK with this value as middle segment started a little below .05 (calculated above) and ends definitely a little above .05.

No trouble at all. Happy to help!
You can find a little more info about expressions a little bit down in this page
« Last Edit: July 03, 2018, 11:26:37 AM by Rokas »
Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #11 on: July 04, 2018, 07:59:35 AM »
print was just for style debugging. it is not necessary. ;)

regarding numbers:

return (YSplineLength-117.9-140.7)/2-294.3/2;

It is Y size of elements used in the scene which are constant


Same for bottom element it has value 117.9.
We divide by 2 to get middle point.
Subtract half the size of our middle segment, and we know the position it should start.

I would exported Y atributes of the segments to avoid these manually entered values, but style editor would become more cluttered so I avoided that for this reason.


If less than 0.2 only means lets jump over our start bottom element and if the value is bigger that that element- we are good because our calculated Y size will do the job.
0.5 means we should be OK with this value as middle segment started a little below .05 (calculated above) and ends definitely a little above .05.

No trouble at all. Happy to help!
You can find a little more info about expressions a little bit down in this page

Excellent thank you for the information! I understand now how those numbers work into the system.

I will try to work out how to put the centre piece in the bottom third (centre was for testing) before I come back and hassle you for more questions.

Regarding the expressions information I have done the tutorial on 3 - Parameters and Attributes & 9 - Creating Conditional Relationships still having trouble making my own expressions as the format is not exactly as what is shown in the autodesk documentation on expressions - unless I am mistaken. Essentially I am looking for something that could show many different examples and how to use them - my background is not really in coding so its very new to me, however I will keep chipping away at it until the penny drops.

Thanks mate, really appreciate your help!


James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Linear 1S Clipping Similar to Array 2S
« Reply #12 on: July 04, 2018, 01:19:45 PM »
I really like the idea of having the nodes automatically calculate based on the length of the top and bottom corner pieces as you mentioned - even if this adds more nodes this way I can keep it parametric and swap out the pieces when the corners change size. I have been racking my brain all day trying to work out how to export the YSplineLength as a node to wire it into the rest of the nodes into it.

I have attached the max file Im wondering how far off I am, I feel I almost have it I just cannot work out how to wire in the YSplineLength so I can minus the other nodes from this?



This seems super complicated to make windows Im not sure if I am tackling this in the right way (not just this method, all of it so far). There must be a reason you cannot use a compose node on the Y direction? Im sure this would make the whole thing a lot more simple?


Edit:

OK I managed to do it by putting an Expression as YSplineLength - not sure if there is a node for this but It should work regardless. Now to work out how to change it to the bottom third... :D



Today is a good day! lol
« Last Edit: July 04, 2018, 01:59:00 PM by James Vella »