-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ...Create Imprints on Modeler bodies, not on DesignBodies. The latter makes the script slow. #628
Comments
@agvarghe , Ken @kmental did some testing with imprinting before and after design bodies are created: I didn't see much difference between imprinting in the two cases. I tried 400 rectangles imprinted onto a block, and it took about the same time in both cases. Imprint time (copy): 3329 Imprint time (desBody): 3500 Sample C# code: void TestImprintCurvesPerformance() {
var desCurves = Window.ActiveWindow.ActiveContext.Selection.OfType<DesignCurve>();
if (!desCurves.Any())
return;
var desBody = Window.ActiveWindow.Document.MainPart.Bodies.First();
var curves = desCurves.Select(d => d.Shape).ToList();
var body = desBody.Shape;
var bodyCopy = desBody.Shape.Copy();
// Just a modeler body
var start = Environment.TickCount;
var imprintedCurves2 = bodyCopy.ImprintCurves(curves, null);
Trace.WriteLine($"Imprint time (copy): {Environment.TickCount - start}");
Trace.WriteLine($"Imprint count (copy): {imprintedCurves2.Keys.Count}");
bodyCopy.Dispose();
// With a DesignBody
start = Environment.TickCount;
var imprintedCurves = body.ImprintCurves(curves, null);
Trace.WriteLine($"Imprint time (desBody): {Environment.TickCount - start}");
Trace.WriteLine($"Imprint count (desBody): {imprintedCurves.Keys.Count}");
} Do you get similar results with your model? |
We might need to provide the Python code for this as well - I'm guessing @agvarghe is using PyGeometry rather than the raw API. |
@RobPasMue Good point, there may be a difference in the PyGeometry layer. |
PyGeometry never has the ability to access Modeler bodies, so nothing you write in pygeom could test these 2 cases. I believe he raised the issue concerning our server implementation for imprinting. If the issue was raised requesting the ability to create modeler bodies - we have no plans of supporting that workflow. @agvarghe It may instead be most helpful if you share your PyGeometry code snippet and I could test the 2 different approaches. |
📝 Description of the feature
Creating imprints is the slowest operation. We were under the impression that we were using the low-level APIs but that doesn't seem to be the case. We wouldn't create design body untill we are ready to create the Design bodies.
💡 Steps for implementing the feature
No response
🔗 Useful links and references
No response
The text was updated successfully, but these errors were encountered: