### Modelling Rovings on the Basis of Support Points

· 4 · 1968

#### Marvin Wolf

• Posts: 4
##### Modelling Rovings on the Basis of Support Points
« on: August 02, 2021, 03:29:06 PM »
Hello,

my aim is to modell a roving based on support points. I already found the object type "Curved Elliptical Fiber" in the "Create/Add GAD Object"-Dialog, where I can input the 3d-Coordinates of support points. As I have around 700 support points, it would be interesting to know if there is a way to input them with a macro or maybe by using an excel-sheet.

My support points are currently saved as triples (touple with 3 elements) within a python array. Is there an easy way to use these triples as an input for modelling?

Thanks for helping.
Marvin

#### Aaron Widera

• Math2Market Employee
• Posts: 23
• Position: Sales Engineer Digital Material R&D
##### Re: Modelling Rovings on the Basis of Support Points
« Reply #1 on: August 10, 2021, 05:04:00 PM »
Hi Marvin,

yes it is possible to create elliptical rovings with the support points automated by using the "Add GAD Object" option. You can use a python macro for that, the tricky question would be how to access the data form the excel sheet.

Can you tell me a bit more how the support points in the sheet are formatted?
Then I can explain you how you on that expample how to create a macro for that. So can you show a table here to show me how the data looks like? For example:
 Rovings Roving 1 Coordinates Roving 1 Diameters Roving 2 Coordinates Roving 2 Diameters Support Point 1 X, Y, Z Diameter1, Diameter2, Diameter3 X, Y, Z Diameter1, Diameter2, Diameter3 Support Point 2 X, Y, Z Diameter1, Diameter2, Diameter3 X, Y, Z Diameter1, Diameter2, Diameter3
 further support points

When I understand the table structure I can explain how to make the macro.

#### Marvin Wolf

• Posts: 4
##### Re: Modelling Rovings on the Basis of Support Points
« Reply #2 on: August 16, 2021, 10:56:20 AM »
Hello Aaron,

For a first try, I only want to model one roving in x-direction and one in y-direction. The support points are created by a python script on the basis of two polynomials. These polynomials describe the routes of the rovings I want to modell (x- and y- direction). The result of my python script is currently one array for each roving-direction, containing the triples which describe the support points.
Do we need to create a excel sheet, or is it possible to integrate my python script (or at least the resulting data) into the GeoDict-Macro which I am using to create the model?

If I need to create a excel sheet, I could stick to your example. Roving 1 would be the x-Roving and Roving 2 the y-Roving.

#### Aaron Widera

• Math2Market Employee
• Posts: 23
• Position: Sales Engineer Digital Material R&D
##### Re: Modelling Rovings on the Basis of Support Points
« Reply #3 on: August 18, 2021, 02:33:18 PM »
Hi Marvin,

I prepared you an example, I assume, that youzr python script to create the roving support points is named PolyNomial.py.
It should look like that:
Code: [Select]
def test_func(parameter1, parameter2):
x = [[2e-05, 2e-05, 2e-05],[4.5e-05, 2e-05, 2e-05],[7e-05, 3e-05, 2e-05],[9.5e-05, 4e-05, 3e-05]]
y = [[2e-05, 2e-05, 2e-05],[2e-05, 4.5e-05, 2e-05],[3e-05, 7e-05, 2e-05]]
return [x, y]
So it is just a function "test_func" that gets two parameters. Then it calculates and get two list (x and y) with the support points. In this case the list is set, but you just need to enter you polynomial function.
Then the script returns the two lists combined as [x, y]

Now for the important part, you can copy and paste this code block into a blank python script and use it, I will use comments marked by # to comment in the script what is happening:
Code: [Select]
'Release'      : '2021',
}

Description = '''
'''

Variables = {
'NumberOfVariables' : 0,
}
# until here it is just header and initialization which is not important

import PolyNomial    #here we import the python script

Roving_list = PolyNomial.test_func(123, 456) # by using .test_func(para1,para2) we are using the function from the script PolyNomial with the parameters para1 and para2. And save the returned values in the Roving_list

diam_1 = 2e-05      #Here you can set the Diameter of the Rovings. Here both Rovings in x and y directio have the same size. You could adapt it like below.
diam_2 = 1e-05

number_of_rovings = len(Roving_list)

#now we define a dictionary that is filled with all information GeoDict needs to create the GAD-Objects
#You might need to adjust the voxellenght and Domainsize (NX, NY, NZ) below by calculating the domainsize
'KeepStructure'   : 0,
'NumberOfObjects' : number_of_rovings,
'Domain' : {
'PeriodicX'         : False,
'PeriodicY'         : False,
'PeriodicZ'         : False,
'OriginX'           : (0, 'm'),
'OriginY'           : (0, 'm'),
'OriginZ'           : (0, 'm'),
'VoxelLength'       : (1e-06, 'm'),
'DomainMode'        : 'VoxelNumber',   # Possible values: VoxelNumber, Length, VoxelNumberAndLength
'NX'                : 100,
'NY'                : 100,
'NZ'                : 100,
'Material' : {
'Type'        : 'Fluid',     # Possible values: Fluid, Solid, Porous
'Name'        : 'Undefined',
'Information' : '',
},
'OverlapMode'       : 'GivenMaterial', # Possible values: OverlapMaterial, NewMaterial, OldMaterial, GivenMaterial
'OverlapMaterialID' : 3,
'NumOverlapRules'   : 0,
'HollowMaterialID'  : 0,
'PostProcessing' : {
'ResolveOverlap'    : False,
'MarkContactVoxels' : False,
'ContactMaterialID' : 15,
},
},
}
#This is the basic dictionary and now we fill it with the two Rovings. I Have it variable so when the polynomial script later returns more support lists, it should also work.

for i in range(number_of_rovings):
#we iterate over the Roving number i and fill the Dictionary with Object1, Object2.