Itoo Software Forum

Author Topic: Complex Windows  (Read 4334 times)

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Complex Windows
« on: July 09, 2018, 01:50:27 PM »
Hi,

I thought I would start a new thread so I can keep my window questions together.

I am attempting to build some window frames which have multiple pieces on the left as well as the right, centre, and separate bottom pieces. Hopefully I can get to the bottom of this as it seems to be quite difficult so far however I think Im just missing some important parts of the expressions which should tie this together and keep it parametric as a template.

To start with I am trying to get the centre piece to work on X evenly which has 5 different pieces as below:



My expression does not work correctly and wondering how else to achieve this without an else section:

return if(YSplinePosition==0,5,
if(YSplinePosition==1,1,
if(YSplinePosition>0.75 <1,4,
if(YSplinePosition>0.5 <.0.75,3,
if(YSplinePosition>0.25 <0.5,2)))));


Parse error. Expected expression at line 4:
if(YSplinePosition>0.5 <.0.75,3,
                                        ^


Many thanks,
James
« Last Edit: July 09, 2018, 01:55:37 PM by James Vella »

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Complex Windows
« Reply #1 on: July 09, 2018, 03:05:29 PM »
well if You want to have 2 conditions for one if You can use & operator
return if(XSplinePosition>0.5 & XSplinePosition<0.75,1,2);

Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #2 on: July 10, 2018, 09:08:33 AM »
Thanks Rokus, this works for 2 variables however when I add a third it seems to break on if:

return if(YSplinePosition>0.5 & YSplinePosition<0.75 & YSplinePosition<0.25 ,1,2,3);

Compile error. Wrong number of arguments in function: "if" at line 1:
return if(YSplinePosition>0.5 & YSplinePosition<0.75 & YSplinePosition<0.25 ,1,2,3);


Is there a syntax reference somewhere, it seems like I cannot get a good reference as to what write as a custom expression?


Cheers!

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Complex Windows
« Reply #3 on: July 10, 2018, 09:50:59 AM »
Hi,

You misunderstand how & works.
It checks if all conditions match then it is true. You then need to define else which can have anther if with multiple and

Your condition with 3 arguments are not good. Let say yellow line is whole Yspline.
Then first range defined by green and 2nd range defined by blue rectangles. their both AND is what intersects. If You add 3rd condition it should intersect with that also. In other case there is no sense to write it.



That is one problem.

Other problem which makes compiler to error is not the number of & but if misuse:
if(condition,true,false);
what You have is if(condition,true,false,EXCESS PARAMETER); which makes it to error.

Syntax reference can be found here

Every function has little help in the Expression editor too:
« Last Edit: July 10, 2018, 09:52:32 AM by Rokas »
Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #4 on: July 10, 2018, 12:55:15 PM »
Thank you Rokus, that makes somewhat sense. So I guess Im looking at the wrong kind of formula here for my expression.

If I understand you correctly - what I want to do is just define each separately if possible, so in this case I still get an error when trying to define just one of these.

return YSplinePosition == 0,1;


Parse error. expected ';' at line 1:
return YSplinePosition == 0,1;
                                      ^


I have 5 Inputs, the start,end,middle need to remain constant size and the two others need to scale. What Im thinking is:

return YSplinePosition == 0 ,1;
return YSplinePosition >0 <0.5 ,2;
return YSplinePosition ==0.5 ,3;
return YSplinePosition <0.5 <1, 4;
return YSplinePosition ==1 ,5;



Thanks for the help mate

Edit: From reading the Operators page I see I can only use 1 return function within the expression, not sure how I would add 5 items to this (I cant even get 1 to work so far! lol)

Edit2: I can get it to accept this without an error (although not working still) using this syntax but i would rather not use an if statement if possible, just statements - if that makes sense?

return if(YSplinePosition == 0, 5,
if(YSplinePosition >0 <0.5, 4,
if(YSplinePosition == 0.5, 3,
if(YSplinePosition >0.5 <1, 2,
if(YSplinePosition == 1, 1,2)))));
« Last Edit: July 10, 2018, 04:51:42 PM by James Vella »

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #5 on: July 10, 2018, 02:46:14 PM »
Im starting to think I am going about this entirely the wrong way - the node network seems super complicated at this stage for something that appears so simple and requires multiple expressions - when I would expect a sequence node to act accordingly such as on the X Evenly - 5 segments in order of how I have selected them.

Is there a better way to achieve this (Blue Areas Highlighted are Constant)?



- Have ability to change width/length of Spline rectangle Clipping Area
- Keep all mullions 50mm
- Only scale Top 1&2, Btm 1&2 along the X axis
- Only scale Left 1&2, Right 1&2 along the Y axis
- Remaining segments to remain consistent x/y length
- The bottom window stays in the bottom third of the Clipping Area
- I dont want the window to tile, I want it to keep all proportions so that when the Clipping Area increases or decreases it adjusts all the scaleable areas to match the consistent areas.

So far I have used a Selector with your expression from the other thread Rokus for the left and right sides - which place it in the centre:

Expression:

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

I then also converted this to be parametric using the nodes for the arithmetic to calculate the length of those variables listed above (117.9, 140.7 etc)
This puts the item in the centre, which is a good start however I want to move this to the bottom third and have had no luck so far.

Now I am attempting to use an expression for the X evenly to place the 5 centre pieces along the Y. When it seems to me shouldnt a Sequence Node work for this (not sure as to why its not)?

Which leads me to think maybe there is a better way...

I like the idea of the nested railclones which I followed in the tutorial Creating Panelling and Wainscoting. I can see how this concept is a simpler way of doing things but having issues translating this across to my model or if this is indeed a better way.

Any tips on powering through this is much appreciated, I didn't expect so much of an up hill battle for a window this basic lol.

« Last Edit: July 10, 2018, 04:20:12 PM by James Vella »

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Complex Windows
« Reply #6 on: July 11, 2018, 11:57:43 AM »
I would suggest creating a nested style. It should be easier in this case.
I wouldn't say it is a simple window setup. It has all different segments, not according to default scheme:
Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #7 on: July 12, 2018, 10:36:41 AM »
Ok ill give it a shot thanks Rokus!

I am doing the kitchen cabinets tutorial which has lots of nested setups, I think this is going to be applicable to this situation. Ill post back my findings!

One thing I am curious about, is there a way to have the Y Evenly overlap the X Evenly? It looks like X Evenly always takes precedence.

Cheers
« Last Edit: July 12, 2018, 10:57:55 AM by James Vella »

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #8 on: July 17, 2018, 09:05:30 AM »
Is there a bug with the XSplinePosition in the latest version Railclone (320)?

I have the Selector working correctly on the YSplinePosition however when I try to do a similar function on the XSplinePosition it does not seem to work - specifically the last ID3 on Position 1 of X?

return
if ( XSplinePosition == 0, 1,
if ( XSplinePosition == 1, 3, 2 ))
;


Im using A2 Generators and tested this just on its own with a fresh setup and I cannot get the selector to just place the end pieces at Position 1 for the XSpline as shown:




« Last Edit: July 17, 2018, 09:14:58 AM by James Vella »

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #9 on: July 17, 2018, 01:35:14 PM »
Ok, I have changed my approach on this and getting closer to the result Im after, however I am having trouble with 1 thing which should solve a few other things. So we can ignore my previous question for now (Although still curious as to why it does not work on the X as well as the Y for the Sequence Expression)

Ill post up the entire resolution when this is complete for anyone else building Complex windows.

On to my next issue lol...

How do I reference the Y Position of the "Bottom" piece from another Array?

Essentially I want to use this as a base point for my Centre Mullion to then Offset the Y.

Example:


This is what I have tried so far...

The Centre Piece (in the red box) > Export Y Fixed Translation > Wire to Arithmetic >

return
YSplinePosition == 0
;


I also tried

return
YSplineCoords.y == 0
;


return
min (YSplinePosition, 0) + (-Input1)
;


I also tried to Wire the Bottom Piece Y Translation to an arithmatic to wire its Translation into the Translation of the Top Piece of my other Array but it seems like the green dots are on the wrong side (more likely my brain is on the wrong side).

Really appreciate any advice as to how to wire this information across for translation purposes. Thanks!

Edit:
I have looked through the manual pages and still cannot find reference to good examples using the Expressions - I would like to know how to use it like this:

If Y Fixed Translation = 0 then Place Object2 at 0

or Reference other objects in the node system such as:

If Object1 is located at Y Fixed Translation 0 then Place Object1 at Object 2 then Add Input1 (the Offset I have entered in a numeric/constant)

I know what I need but I cannot find reference to examples to do specific things as such. At this point I feel like im just completely guessing based on the Autodesk reference guide and information provided in the help docs which dont show many examples. I type in what I think should happen and most of the time, and it doesnt happen. For Example, I would think that adjusting an object's (Top Piece) YPadding based on the 0 Position of YSpline I would do something like this:

return
(YSplineCoords.y == 0)
;


However this does nothing? It says OK in the box but does not move the Top Piece to the Bottom of the YSpline? But when I move it manually using the padding units it does but I need this to be linked to the size of the Spline.  I have read all the links you have provided so far Rokus and Im still having lots of trouble finding any examples on how to use the Operators.


Edit2:


I have attached a new version which I think is almost there, Im just missing 1 component which will set the Initial Y Offset of the Generator Btm Mullion to the Bottom Piece of Generator Outside Frame, before I add the Offset I require Numerical Node Y Offset

Im not sure how but any advice is helpful thank you!
« Last Edit: July 17, 2018, 04:22:12 PM by James Vella »

Rokas

  • Hero Member
  • *****
  • Posts: 3324
Re: Complex Windows
« Reply #10 on: July 17, 2018, 04:26:29 PM »
Hi James.

Regarding Your first issue:
Expression works fine. The point is that vertical is calculated differently. Top Input always has a whole segment aligned to Top. That is not the case with Horizontal Right Input.
Workaround use included A2S with intersections macro:


2nd issue:
I moved Your Top segment in Y direction, -YSplineLength distance:
Rokas

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #11 on: July 17, 2018, 07:32:54 PM »
Thank you Rokus, that looks like what I am trying to do in the second example. Can you please upload a 2017 version for inspection?

I have had a look at the intersections macro... I think this may take awhile to dissect lol.

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #12 on: July 18, 2018, 05:39:07 AM »
Ok I understand now what you have done (I think), however this flips the Top piece upside down (Puts the glass that goes in that bottom panel into the top panel).

Is there a way to achieve the same however keeping the Top piece so that when its translated to 400mm on the Y the glass stays beneath it?





Edit:


Ok! I got it working by doing: return -YSplineLength -Input1 -Input2 ; for the Y Translation of the Default piece aswell - not sure if this is exactly correct but it seems like its doing what I need for now.

Input1 = The inverse of the Y Offset parameter
Input2 = Top Mullion Size Y

Thank you so much Rokus for the helpful advice!!
« Last Edit: July 18, 2018, 06:05:29 AM by James Vella »

James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #13 on: July 23, 2018, 10:26:51 AM »
Thank you for the help Rokus! I have it fully working now and animatable (mullion widths remain consistent as the spline changes length/width). Ill post up a tutorial of this soon as I think Im seeing more people interested in windows for railclone and I have a few more I want to do with different types of layouts and parameters - all parametric so you can swap out the window pieces with your own or chanege lenghts/widths for your own (or to match CAD) :D


James Vella

  • Jr. Member
  • **
  • Posts: 58
  • https://www.jamesvella.net/
    • James Vella - 3D Visualizations
Re: Complex Windows
« Reply #14 on: July 24, 2018, 09:03:13 AM »
Small Update:

Window Mullion width can now be adjusted