TAGGED: Moderator SpaceClaim, scripting, spaceclaim
-
-
February 1, 2025 at 2:29 am
z5360540
SubscriberContext: Need to generate a parmetric cylindrical geometry as seen below.
Problem: I generated the points needed for the surface but I don't know how to join the dots to generate the surface.
Summary of code: Generates x,y an z coordinates of points along surface. Draws curves that links up the surface (this is the best I can do right now). Image below shows this.
Help wanted:
1) Is there a method or function that can help me connect these points to form a surface?
2) Is there a better way of creating this geometry? E.g. instead of generating x,y and z locations for points and generating a surface you can use the equation feature in space-claim and revolve it (NB: Tried this method - was unable to include record equation in script and as a result unable to parametrise it)
Code so far:
import math
# Define parameters
D = 0.06 # Diameter of the cylinder (meters)
A = 0.0016 # Amplitude of sinusoidal wave (meters)
W = 0.02 # Wavelength of sinusoidal wave (meters)
length = 0.15 # Length of the cylinder (meters)
segments = 100 # Number of points used to make the structure
revolution_steps = 36 # Number of steps for full 360° revolution# Create a list to store the 3D coordinates
ptList = List[Point]()# Generate the 3D points by revolving the profile
for i in range(segments):
x = i * (length / (segments - 1))
y_base = (D / 2) + A * math.sin((2 * math.pi / W) * x) # Radius at current x# Generate points along the revolution
for j in range(revolution_steps):
angle = (2 * math.pi / revolution_steps) * j # Angle for revolution
y = y_base * math.cos(angle) # Rotate radius in the yz-plane
z = y_base * math.sin(angle)
# Create a point and add to the list
ptList.Add(Point.Create(x, y, z))
# Create the NURBS curve from the points
ncurve = NurbsCurve.CreateThroughPoints(False, ptList, 0.0001)# Create a curve segment from the NURBS curve
curveSegment = CurveSegment.Create(ncurve)# Create a design curve from the segment
designCurve = DesignCurve.Create(GetRootPart(), curveSegment) -
February 18, 2025 at 9:46 am
-
- You must be logged in to reply to this topic.
- Unable to attach geometry 2024 R2
- Data Center Simulation
- DXF file loaded incorrectly
- Inventor 2025 files
- [SpaceClaim] STEP file size using Converter.exe
- Ansys SpaceClaim and Discovery 2024 Facet shelling bug – 2022 version is better
- Spaceclaim 2024 error FNE activation failed
- Ansys Discovery Crashing vGPU (Reproducible)
- How to do the snap fit insertion FEA?
- PMI Product manufacturing information in SpaceClaim/Discovery modeling
-
2457
-
931
-
599
-
591
-
586
© 2025 Copyright ANSYS, Inc. All rights reserved.