edwardvmills / Silk

NURBS Surface modeling tools focused on low degree and seam continuity (FreeCAD Workbench)
https://edwardvmills.github.io/Silk/
62 stars 11 forks source link

Bug: NStar Surfaces Not Writing Out Geometry Properties Correctly #29

Closed wandrewkeech closed 1 year ago

wandrewkeech commented 1 year ago

Testing on Demo03, delete and recreate any of the NStar surfaces. Operation completes successfully, but on document save the following error is emitted:

CubicNStarSurface_NStar66 Init
09:12:16  GeomBSplineSurface::Save

This very quiet error results in a partially corrupted file, which upon reopening emits these errors:

09:12:16  GeomBSplineSurface::Save
09:15:18  GeomBSplineSurface::Restore
09:15:18  Fatal Error at file /home/.../Silk_Demo_03_NStarBug.FCStd, line 26884, char 27
09:15:18  Invalid Document.xml: expected end of tag 'Geometry'

The contents of the Document.xml file show the object malformed as such, with the GeometryList terminating immediately after starting the Part::GeomBSplineSurface object and leaving the GeometryList open:

<Property name="NSurf" type="Part::PropertyGeometryList" group="CubicNStarSurface_NStar66" doc="N Cubic Surfaces" attr="0" ro="0" hide="0" status="2097152">
               <GeometryList count="5">
                   <Geometry  type="Part::GeomBSplineSurface">
                   </Property>
                   <Property name="Placement" type="App::PropertyPlacement" status="8388608">
                       <PropertyPlacement Px="0.0000000000000000" Py="0.0000000000000000" Pz="0.0000000000000000" Q0="0.0000000000000000" Q1="0.0000000000000000" Q2="0.0000000000000000" Q3="1.0000000000000000" A="0.0000000000000000" Ox="0.0000000000000000" Oy="0.0000000000000000" Oz="1.0000000000000000"/>
                   </Property>
                   <Property name="Proxy" type="App::PropertyPythonObject">
                       <Python value="e30=" encoded="yes" module="ArachNURBS" class="CubicNStarSurface_NStar66"/>
                   </Property>
                   <Property name="Shape" type="Part::PropertyPartShape">
                       <Part file="PartShape268.brp"/>
                   </Property>
                   <Property name="Visibility" type="App::PropertyBool" status="648">
                       <Bool value="true"/>
                   </Property>
               </Properties>
           </Object>
edwardvmills commented 1 year ago

sorry for delayed response. i'll look into it as soon as i can

edwardvmills commented 1 year ago

well the error replicates here. i'll try to play around with it, but I think it's a FreeCAD behavior problem. I do not do anything particular to write/save these objects. All the objects created by the workbench are fairly 'vanilla' python objects.

Have you asked on the forum?

I would certainly like to fix it, but if there's anything that needs to change in silk it's not obvious.

my next test is going to be to delete/rebuild other Silk objects, then rebuild from scratch and see if that behaves any differently. i've never had any 'save' related problems so far.

edwardvmills commented 1 year ago

for the broken star surfaces, some resolution is on the way. Werner has fixed the issue, i'm still not clear when the fix will reach weekly-builds or the official release (i'm not set up to compile) viewtopic.php?t=77148

edwardvmills commented 1 year ago

the previous behavior was that surfaces (in lists) were ignored on save, so they were getting rebuilt every time the file opened. this is fine to me even if it does take longer to reopen files, and maybe one day, they will be saved and files will then open very fast.

edwardvmills commented 1 year ago

Werner fixed it so that the old behavior comes back, but it'll take some time until the fix reaches the prebuilt packages. so the surfaces will simply not be saved and instead will recompute when opening the files.

i'll keep this issue open until i see the fix in a public build.

wandrewkeech commented 1 year ago

Wow, thank you for all that hard work! I'm on the snap nightly build, so I'll try again after the next update and see if that change has come through.

wandrewkeech commented 1 year ago

Confirmed in a development build that the issue has been addressed!

https://forum.freecad.org/viewtopic.php?t=77148