Extract Points outputs only one vertex. Possible bug?
-
Hello,
When I try to extract the set of points that made a sketch (eg. through a loop made from a set of spline points) that has been moved and scaled, the output of Extract -> Extract Points, I only get a single vertex.
Why could this be?
This behaviour also happens in the Python API.Any help at all is greatly appreciated.
-
This behavior is by design for splines in Sim4Life. To extract points along a spline via the GUI, select the spline, then go to Wire Tools > To Polyline. This will allow you to specify a Faceting parameters that will determine how many points can be extracted.
To extract points via the Python API, you can manually extract the points used to define the initial spline, or you can resample the spline:
# -*- coding: utf-8 -*- import s4l_v1.model as model import XCoreModeling entity = model.AllEntities()['Spline Name'] # Get exact points making up spline points_exact = [] for p in entity.Parameters[0]: points_exact.append(p.Value) # Sample spline sample_interval = 100 wires = XCoreModeling.GetWires(entity) curve = wires[0].GetGeometry() curve.Transform(entity.Transform) interval = curve.ParameterRange length = XCoreModeling.MeasureLength([entity]) num_samples = int(length / sample_interval) param_delta = (interval.End - interval.Start) / num_samples points_sampled = [] for i in range(num_samples): points_sampled.append(curve.Eval(interval.Start + i * param_delta))
-
The first method might not be working if your spline doesn't have a parametrization. If you click on the spline in the Model tree and don't see a list of points in the Controller window, then the information is no longer available and you'll have to stick to the second method.