Skip to content

Commit d8ccd3f

Browse files
authored
Merge branch 'main' into DPF-Framework-transfer-changes-on-26r1-to-25r2
2 parents 1d05447 + 0485d28 commit d8ccd3f

File tree

6,394 files changed

+131433
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,394 files changed

+131433
-210
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import os
2+
import sys
3+
import argparse
4+
5+
6+
def remove_column_table(input_table):
7+
# Split input table into rows
8+
rows = input_table.strip().split('\n')
9+
10+
# Create a new array for modified table
11+
modified_rows = []
12+
13+
# Add the new header row
14+
modified_rows.append("| Name |")
15+
16+
# invert row[0] and row[1]
17+
temp = rows[0]
18+
rows[0] = rows[1]
19+
rows[1] = temp
20+
21+
22+
# Skip the second row of the original table
23+
# We don't include it in the modified table
24+
25+
# Add remaining rows from the original table, starting from index 2
26+
for i in range(0, len(rows)):
27+
# Split the current row by the '|' character
28+
columns = rows[i].strip().split('|')
29+
30+
# Extract the content of the first column
31+
name_column = columns[1].strip()
32+
33+
# Add the content of the first column to the modified row
34+
modified_rows.append("| " + name_column + " |")
35+
36+
# Construct the modified table string
37+
modified_table = '\n'.join(modified_rows)
38+
39+
return modified_table
40+
41+
def process_md_table(input_table):
42+
# Split input table into rows
43+
rows = input_table.strip().split('\n')
44+
45+
# Create a new array for modified table
46+
modified_rows = ["| Name | Description |"]
47+
48+
# Add the second row of the original table
49+
modified_rows.append(rows[1])
50+
51+
# Add the first row of the original table
52+
modified_rows.append(rows[0])
53+
54+
# Add remaining rows from the original table, starting from index 2
55+
for i in range(2, len(rows)):
56+
modified_rows.append(rows[i])
57+
58+
# Construct the modified table string
59+
modified_table = '\n'.join(modified_rows)
60+
61+
return modified_table
62+
63+
def process_md_files(folder_path):
64+
# Traverse the directory structure recursively
65+
for root, dirs, files in os.walk(folder_path):
66+
for file in files:
67+
# Check if the file is a Markdown file
68+
if file.endswith(".md"):
69+
file_path = os.path.join(root, file)
70+
print("Processing:", file_path)
71+
# Read the input file
72+
with open(file_path, 'r', encoding='utf-8') as file:
73+
file_content = file.read()
74+
75+
# Split the file content by at least one newline character
76+
tables = file_content.split('\n\n')
77+
78+
# Process each potential Markdown table found in the file
79+
modified_tables = []
80+
81+
# Check if all items of column 2 are empty
82+
for table in tables:
83+
# Check if the potential table is actually a Markdown table
84+
if table.strip().startswith('|'):
85+
# Check if the table has two columns with an empty column (first row only)
86+
rows = table.strip().split('\n')
87+
is2ColumnTable = False
88+
for i in range(0, len(rows)):
89+
if i==1:
90+
continue
91+
if rows[i].count('|') == 3:
92+
s = rows[i].split('|')[2]
93+
if all(char.isspace() or char == '\t' for char in s):
94+
print("Found 1 column table")
95+
else:
96+
print("Found 2 column table")
97+
is2ColumnTable = True
98+
99+
if rows[0].count('|') > 3:
100+
print("Found >2 column table")
101+
elif is2ColumnTable == True:
102+
# Process the MD table
103+
modified_table = process_md_table(table)
104+
elif is2ColumnTable == False:
105+
# Remove the empty column from the table
106+
modified_table = remove_column_table(table)
107+
else:
108+
modified_table = table
109+
110+
modified_tables.append(modified_table)
111+
112+
# Join the modified tables back into the file content
113+
modified_content = '\n\n'.join(modified_tables)
114+
115+
# Write the modified content back to the input file
116+
with open(file_path, 'w', encoding='utf-8') as file:
117+
file.write(modified_content)
118+
119+
print("File '{}' has been updated with corrected tables.".format(file_path))
120+
121+
if __name__ == "__main__":
122+
# Check if the folder path is provided
123+
124+
125+
# Get the folder path from command line argument
126+
#folder_path = sys.argv[1]
127+
128+
parser = argparse.ArgumentParser(description="Add headers to tables in Markdown files.")
129+
parser.add_argument("--input_folder", help="Path to the folder of Markdown files")
130+
args = parser.parse_args()
131+
132+
folder_path = args.input_folder
133+
134+
# Process all Markdown files in the folder and its subfolders
135+
process_md_files(folder_path)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ansys.meshing.prime.AddLabelResults.error_code
2+
3+
<a id="ansys.meshing.prime.AddLabelResults.error_code"></a>
4+
5+
#### *property* AddLabelResults.error_code *: [ErrorCode](ansys.meshing.prime.ErrorCode.md#ansys.meshing.prime.ErrorCode)*
6+
7+
Error code associated with the add label operation.
8+
9+
<!-- !! processed by numpydoc !! -->
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!-- vale off -->
2+
3+
<a id="addlabelresults"></a>
4+
5+
# AddLabelResults
6+
7+
<a id="ansys.meshing.prime.AddLabelResults"></a>
8+
9+
### *class* ansys.meshing.prime.AddLabelResults(model=None, error_code=None, json_data=None, \*\*kwargs)
10+
11+
Results associated with the add label operation.
12+
13+
* **Parameters:**
14+
15+
**model: Model**
16+
: Model to create a `AddLabelResults` object with default parameters.
17+
18+
**error_code: ErrorCode, optional**
19+
: Error code associated with the add label operation.
20+
21+
**json_data: dict, optional**
22+
: JSON dictionary to create a `AddLabelResults` object with provided parameters.
23+
24+
### Examples
25+
26+
```pycon
27+
>>> add_label_results = prime.AddLabelResults(model = model)
28+
```
29+
30+
<!-- !! processed by numpydoc !! -->
31+
32+
### Methods
33+
34+
| Name | Description |
35+
|---------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
36+
| [`AddLabelResults.print_default`](ansys.meshing.prime.AddLabelResults.print_default.md#ansys.meshing.prime.AddLabelResults.print_default)() | Print the default values of `AddLabelResults` object. |
37+
| [`AddLabelResults.set_default`](ansys.meshing.prime.AddLabelResults.set_default.md#ansys.meshing.prime.AddLabelResults.set_default)([error_code]) | Set the default values of the `AddLabelResults` object. |
38+
39+
### Attributes
40+
41+
| Name | Description |
42+
|------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
43+
| [`AddLabelResults.error_code`](ansys.meshing.prime.AddLabelResults.error_code.md#ansys.meshing.prime.AddLabelResults.error_code) | Error code associated with the add label operation. |
44+
<!-- vale on -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# print_default
2+
3+
<a id="ansys.meshing.prime.AddLabelResults.print_default"></a>
4+
5+
#### *static* AddLabelResults.print_default()
6+
7+
Print the default values of `AddLabelResults` object.
8+
9+
### Examples
10+
11+
```pycon
12+
>>> AddLabelResults.print_default()
13+
```
14+
15+
<!-- !! processed by numpydoc !! -->
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# set_default
2+
3+
<a id="ansys.meshing.prime.AddLabelResults.set_default"></a>
4+
5+
#### *static* AddLabelResults.set_default(error_code=None)
6+
7+
Set the default values of the `AddLabelResults` object.
8+
9+
* **Parameters:**
10+
11+
**error_code: ErrorCode, optional**
12+
: Error code associated with the add label operation.
13+
14+
<!-- !! processed by numpydoc !! -->
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ansys.meshing.prime.AddThicknessParams.fix_intersections
2+
3+
<a id="ansys.meshing.prime.AddThicknessParams.fix_intersections"></a>
4+
5+
#### *property* AddThicknessParams.fix_intersections *: [bool](https://docs.python.org/3.11/library/functions.html#bool)*
6+
7+
Fix intersections in concave regions.
8+
9+
<!-- !! processed by numpydoc !! -->
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# AddThicknessParams
2+
3+
<a id="ansys.meshing.prime.AddThicknessParams"></a>
4+
5+
### *class* ansys.meshing.prime.AddThicknessParams(model=None, thickness=None, reverse_face_normal=None, suggested_part_name=None, fix_intersections=None, json_data=None, \*\*kwargs)
6+
7+
Parameters to add thickness for a given plane.
8+
9+
* **Parameters:**
10+
11+
**model: Model**
12+
: Model to create a `AddThicknessParams` object with default parameters.
13+
14+
**thickness: float, optional**
15+
: To assign the offset distance of inflation.
16+
17+
**reverse_face_normal: bool, optional**
18+
: To assign the direction of inflation.
19+
20+
**suggested_part_name: str, optional**
21+
: Suggested part name for created patching surfaces.
22+
23+
**fix_intersections: bool, optional**
24+
: Fix intersections in concave regions.
25+
26+
**json_data: dict, optional**
27+
: JSON dictionary to create a `AddThicknessParams` object with provided parameters.
28+
29+
### Examples
30+
31+
```pycon
32+
>>> add_thickness_params = prime.AddThicknessParams(model = model)
33+
```
34+
35+
<!-- !! processed by numpydoc !! -->
36+
37+
### Methods
38+
39+
| Name | Description |
40+
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
41+
| [`AddThicknessParams.print_default`](ansys.meshing.prime.AddThicknessParams.print_default.md#ansys.meshing.prime.AddThicknessParams.print_default)() | Print the default values of `AddThicknessParams` object. |
42+
| [`AddThicknessParams.set_default`](ansys.meshing.prime.AddThicknessParams.set_default.md#ansys.meshing.prime.AddThicknessParams.set_default)([thickness, ...]) | Set the default values of the `AddThicknessParams` object. |
43+
44+
### Attributes
45+
46+
| Name | Description |
47+
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
48+
| [`AddThicknessParams.fix_intersections`](ansys.meshing.prime.AddThicknessParams.fix_intersections.md#ansys.meshing.prime.AddThicknessParams.fix_intersections) | Fix intersections in concave regions. |
49+
| [`AddThicknessParams.reverse_face_normal`](ansys.meshing.prime.AddThicknessParams.reverse_face_normal.md#ansys.meshing.prime.AddThicknessParams.reverse_face_normal) | To assign the direction of inflation. |
50+
| [`AddThicknessParams.suggested_part_name`](ansys.meshing.prime.AddThicknessParams.suggested_part_name.md#ansys.meshing.prime.AddThicknessParams.suggested_part_name) | Suggested part name for created patching surfaces. |
51+
| [`AddThicknessParams.thickness`](ansys.meshing.prime.AddThicknessParams.thickness.md#ansys.meshing.prime.AddThicknessParams.thickness) | To assign the offset distance of inflation. |
52+
<!-- vale on -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# print_default
2+
3+
<a id="ansys.meshing.prime.AddThicknessParams.print_default"></a>
4+
5+
#### *static* AddThicknessParams.print_default()
6+
7+
Print the default values of `AddThicknessParams` object.
8+
9+
### Examples
10+
11+
```pycon
12+
>>> AddThicknessParams.print_default()
13+
```
14+
15+
<!-- !! processed by numpydoc !! -->
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ansys.meshing.prime.AddThicknessParams.reverse_face_normal
2+
3+
<a id="ansys.meshing.prime.AddThicknessParams.reverse_face_normal"></a>
4+
5+
#### *property* AddThicknessParams.reverse_face_normal *: [bool](https://docs.python.org/3.11/library/functions.html#bool)*
6+
7+
To assign the direction of inflation.
8+
9+
<!-- !! processed by numpydoc !! -->
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# set_default
2+
3+
<a id="ansys.meshing.prime.AddThicknessParams.set_default"></a>
4+
5+
#### *static* AddThicknessParams.set_default(thickness=None, reverse_face_normal=None, suggested_part_name=None, fix_intersections=None)
6+
7+
Set the default values of the `AddThicknessParams` object.
8+
9+
* **Parameters:**
10+
11+
**thickness: float, optional**
12+
: To assign the offset distance of inflation.
13+
14+
**reverse_face_normal: bool, optional**
15+
: To assign the direction of inflation.
16+
17+
**suggested_part_name: str, optional**
18+
: Suggested part name for created patching surfaces.
19+
20+
**fix_intersections: bool, optional**
21+
: Fix intersections in concave regions.
22+
23+
<!-- !! processed by numpydoc !! -->

0 commit comments

Comments
 (0)