# Curve will not confine to model surfaces

**URL:** <https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525>\
**Category:** Support\
**Created:** [October 3, 2024, 2:41pm UTC](https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525 "2024-10-03T14:41:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jones](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@Jones](https://discourse.slicer.org/u/Jones)\
**Post date:** [October 3, 2024, 2:41pm UTC](https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525/1 "2024-10-03T14:41:35Z")

</div>

I am trying to take semilandmarks on 3D mandible models through taking several open curves on each mandible. For the first 20 models I sampled I didn’t have any problems, but now when I press ‘confine curve to model surface’ the curve instead floats in random places above the surface, in areas unconnected to the initial points of the curve. I have tried uninstalling and restarting the app, as well as uninstalling and updating the SlicerMorph package, but the problem hasn’t resolved. I have tried on many different models and the same problem occurs. This happens whether or not I resample the curve before constraining to surface. The ‘constrain to surface’ function has also become very slow, and sometimes placing the initial points of the curve is also now very slow. I have also tried messing with the ‘advanced’ curve settings, changing the maximum projection distance, and this hasn’t helped. This problem came out of nowhere, and I haven’t been able to fix it for a week- I was wondering what I could do to try and fix it?  
Thank you very much for your help.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 3, 2024, 2:42pm UTC](https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525/2 "2024-10-03T14:42:34Z")

</div>

Could you please share an example scene that has this unexpected behavior (save the scene as .mrb, upload to dropbox/onedrive/etc., and post the link here)?

---

<div class="post-metadata">

**Author:** ![zifangx](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zifangx/32/77050_2.png) [@zifangx](https://discourse.slicer.org/u/zifangx)\
**Post date:** [December 14, 2024, 1:26pm UTC](https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525/3 "2024-12-14T13:26:55Z")

</div>

Hi Jones,

I’m experiencing issues with the ‘constrain to model’ functionality. In my case, the open curve that’s constrained to a model causes crashes almost every time I try to adjust the position of a control point, add a control point, or do any sort of edit to the curve. I’ve also tried all the steps you took and have not found a fix…  
Please share your experiences if you have successfully resolved this issue.  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 15, 2024, 5:00am UTC](https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525/4 "2024-12-15T05:00:55Z")

</div>

@zifangx Could you please share an example scene that has this unexpected behavior (save the scene as .mrb, upload to dropbox/onedrive/etc., and post the link here)?

---

<div class="post-metadata">

**Author:** ![zifangx](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/zifangx/32/77050_2.png) [@zifangx](https://discourse.slicer.org/u/zifangx)\
**Post date:** [December 15, 2024, 4:06pm UTC](https://discourse.slicer.org/t/curve-will-not-confine-to-model-surfaces/39525/5 "2024-12-15T16:06:35Z")

</div>

Thank you; I think I have figured out the trigger. The unexpected behaiour (crashing upon hitting undo on an open curve) started after I added the Undo/Redo button following [this](https://projectweek.na-mic.org/PW39_2023_Montreal/Projects/UndoRedo/) link, and later I tried the code snippet suggested by [this](https://discourse.slicer.org/t/is-it-possible-to-add-a-global-undo-button/16859/8) post, which I suspect further broked the open curve function somehow, crashing every time I try to adjust a control point on the curve, even when I reverse back the first version of the Undo/Redo code snippet.  
I have since then removed all code snippets in ‘.slicerrc’, and no more unexpected crashing so far.
