Skip to content

Commit 20c58ec

Browse files
authored
Add files via upload
1 parent cab8eec commit 20c58ec

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""NXOpen Python journal starter for ASTERION v0.3 reference curves.
2+
3+
Run inside Siemens NX after creating or opening AST-1100-SPINE-TRUSS.prt.
4+
The journal creates centreline curves only; inspect and adapt to the installed
5+
NX release before saving production data.
6+
"""
7+
import math
8+
import NXOpen
9+
10+
session = NXOpen.Session.GetSession()
11+
work = session.Parts.Work
12+
if work is None:
13+
raise RuntimeError("Open a work part before running this journal.")
14+
15+
truss_r = 1200.0
16+
x_stations = [-21000,-18500,-16000,-13500,-11000,-8500,-6000,-3500,-2500,-1000,1500,2500,4000,6500,9000,11500,14000,15000,16500,19000,21000]
17+
count = 8
18+
19+
# Create station polygons and longeron segments as associative-independent
20+
# reference curves. Convert them into Tube features manually after audit.
21+
points = {}
22+
for i, x in enumerate(x_stations):
23+
for j in range(count):
24+
a = 2.0 * math.pi * j / count
25+
points[(i,j)] = NXOpen.Point3d(x, truss_r*math.cos(a), truss_r*math.sin(a))
26+
for j in range(count):
27+
work.Curves.CreateLine(points[(i,j)], points[(i,(j+1)%count)])
28+
29+
for i in range(len(x_stations)-1):
30+
step = 1 if i % 2 == 0 else -1
31+
for j in range(count):
32+
work.Curves.CreateLine(points[(i,j)], points[(i+1,j)])
33+
work.Curves.CreateLine(points[(i,j)], points[(i+1,(j+step)%count)])
34+
35+
session.ListingWindow.Open()
36+
session.ListingWindow.WriteLine("ASTERION v0.3 spine reference curves created. Audit geometry before saving.")

0 commit comments

Comments
 (0)