Comments (15)
You can drop the test code because there isn't really anything to check.
from freecad.
Can you provide an example file, please?
from freecad.
I'll try to get a minimal reproduction extracted from my current project.
from freecad.
@wwmayer OpenSCAD-Radius2-bug.FCStd.zip
from freecad.
The PR fixes this by doing what OpenSCAD itself does: If only one radius exists, it's used for both ends of the cylinder.
from freecad.
Thanks for the file but it's fairly complex and thus not suitable for a unit test. Do you know a simple way (e.g. a code snippet) to trigger the bug?
from freecad.
I'll see if I can get it isolated.
from freecad.
This might be a more fundamental problem. I imported extruder-adaptor-mm.csg.zip, which produced an invalid shape of some kind. I then deleted the offending cylinder024
. After a save and load cycle, it then threw the radius error above. So maybe something else got corrupted earlier on during the import process?
from freecad.
OK, I found a way to reproduce the error message. The point is to create a document with a Frustum object. Then the document must be saved, closed and restored.
The error message is triggered when restoring the Frustum. Right after restoring the property Radius1 the onChanged() method is triggered but at this point Radius2 is not yet restored.
However, only some error messages are printed but when executing the Python code no exception is raised. This makes it bit more difficult to write some testable code.
import OpenSCADFeatures
doc = App.newDocument()
mycyl=doc.addObject("Part::FeaturePython",'frustum')
r1=2
r2=3
h=4
n=6
OpenSCADFeatures.Frustum(mycyl,r1,r2,n,h)
mycyl.ViewObject.Proxy = 0
doc.recompute()
doc.saveAs("/tmp/openscad.FCStd")
App.closeDocument(doc.Name)
doc = App.openDocument("/tmp/openscad.FCStd")
from freecad.
I see, in that case my current PR is only dealing with a symptom, and isn't a proper fix. I'm not sure what the underlying problem is, but if you point me towards what has to be fixed I'll attempt it. If you'd rather fix it yourself I'll just close the PR.
from freecad.
The main problem is that the class Frustum recreates its geometry directly inside onChanged(). This is considered bad practise and should be avoided. createGeometry() should only be called inside execute().
from freecad.
I see that this is present in quite a few of those classes. So it's sufficient to just remove onChanged
for all of them, essentially?
from freecad.
This might be a more fundamental problem. I imported extruder-adaptor-mm.csg.zip, which produced an invalid shape of some kind.
Hmm, I have tried your file and it looks good to me -- independent if I apply your PR or not. I loaded the file into OpenSCAD and there it looks quite the same. In OpenSCAD I exported an STL file, loaded it into FreeCAD and did a visual inspection of the mesh (as actual) and the shape (as nominal) and the highest deviation is less than 0.1 mm.
So, I would say that the loaded object is correct.
Now if you get a broken shape then it's very likely related to something else -- maybe the OCC CAD kernel has some problems with boolean operations.
from freecad.
I see that this is present in quite a few of those classes. So it's sufficient to just remove onChanged for all of them, essentially?
Yes, that's what I would suggest. This will also fix the error messages when loading the FCStd file.
from freecad.
Now if you get a broken shape then it's very likely related to something else -- maybe the OCC CAD kernel has some problems with boolean operations.
Yeah, possibly. I fixed those issues manually in my case, since I was only planning on using the OpenSCAD model as a starting point for further modifications. So it seems that the error this issue is about wasn't caused about an import problem, but entirely by how the model is loaded in instead.
I've removed the onChanged
stuff, and added your test. However, I'm not entirely sure what my options are to validate the result, since it doesn't seem to throw in a way I can intercept, as you already noted. Maybe there is a way to read the report view output after loading?
Edit: I pushed those changes to #13559 if you want to take a look. Currently doesn't include the test though.
from freecad.
Related Issues (20)
- TD: Clean-up class GeometryMatcher
- Wrong export in STL (export with errors) HOT 1
- Start:Asking to Which Workbench Selector to Use HOT 3
- Addon Manager Locks up FreeCAD HOT 10
- Navigation cube: mouse click events are not recognized HOT 2
- Sketcher segfaults when using the symmetry tool HOT 10
- FEM: Bug when pre-selecting geometries for some constraints
- [TreeView] Incorrect Label2 view when element is hiden HOT 3
- Sketcher: "Fit All" zoom command in edit mode always includes axis origin HOT 3
- Draft: Exception during shapes editing HOT 2
- Sketcher: "Fit selection" command in edit mode does not fit view to selection HOT 3
- [Feature Request] 3D Constraint-driven sketcher/wireframe workbench HOT 3
- TechDraw: Smart dimension doesn't support thickness annotations HOT 1
- Error on create output for helical cut on fanuc code HOT 3
- Sketcher: ConstraintEqual doesn't accept Line + Arc HOT 2
- Core: "Go to selection" not working HOT 3
- FEM: Results pipeline can't handle cases when output has a single value in the whole model
- Add Favorite Properties
- OndselSolver: Failing to compile with GCC 14
- Hatch not correctly exported to PDF HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freecad.