Winter has just begun. At least for me, on the Northen Hemisphere. With the winter came the first snow and with the first snow came my idea to intoduce to you a random-value-parameter.
I will present it to you using an example of a snow flake. As you probably know, each snow flake is unique, I will use parameters with random values to automaticlly create some random snow flakes in Catia.
Let's start with the main attraction - function Rand().
Create new parameter - Length.1 (Type - Length) and add following formula (Fig.1):
Rand()*10mm
With this formula value of the Length.1 will be a random number between 0mm and 10mm (Rand() generates random numer between 0 and 1).
Fig.1 |
Fig.2 |
Point.2 is created in a similar way, but the reference point is Point.1.
Line.1 connects Point.1 and Point.2, it is a reference direction.
Parameter N is an Integer, it is defined by Formula.13 ((round(Rand()*3))+5) which generates random number between 5 and 8. The N will be number of the arms.
Paramter R is a Length, it will be the radius of the snowflake, it is driven by Formula.16 which generates random values between 3mm and 5mm.
Line.2 is an Axis, it starts on the Point.1 and it is normal to the yz plane.
Line.3 is the main arm, it starts on the Point.1, reference direction is Line.1 and length is connected to the R.
Rotate.1 is a bisector of the arms, it is driven by the Formula.21 (360deg/(`Geometrical Set.1\N` *2))
Point.3 and Point.4 are Ratio of the curve length points, reference curve is Line.3, value of the ratio is random (Formula.22 and Formula.24).
Point.5 is the endpoint of the Line.3 (Ratio of the curve length=1, reference point is Point.1).
Line.4 is a short line at the end of the arm - Fig.3. Length and angle are constant.
Fig.3 |
Line.4, RectPattern.1, Line.3, Point.4, Point.3 are mirrored, reference is Rotate.1. Result should be similar to the Fig.4 (depends on the values of the random parameters).
Fig.4 |
Polyline.1 connects Point.4, Point.6 and symmetry of Point.4.
Line.5 connects Point.3 and symmetry of Point.3.
Join.1 is shown on the Fig.5.
Fig.5 |
All the reference elements and points can be hidden now, the snow flake is ready. It can be duplicated with the Duplicate Geometrical Features Set tool (Insert > Advanced Replication Tools). In the window Insert Object (Fig.6) make sure that the Reference is Geometrical Set.1, the Destination is After, the input is yz plane (can be diffrent) and Repeat mode is on. A new, random snowflake will be created everytime you click OK button.
Fig.6 |