View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000671 | Draft | public | 2012-04-13 18:22 | 2012-04-19 21:44 | |
Reporter | galou_breizh | Assigned To | yorik | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Summary | 0000671: Crash with "Draft"/"Put... on sheet" with PartDesignExample.FCStd | ||||
Description | - Open FreeCAD - On the Start Page, select "Load a PartDesign example" - Open the Draft Workbench - Select Pocket002 - Click on the icon "Puts the selected... sheet", note that no drawing sheet was created - Crash! FreeCAD 0.13, Libs: 0.13R0840 (Git) | ||||
Additional Information | In the console: FeaturePython::onChanged (ViewPocket002): 'NoneType' object has no attribute 'PropertiesList' FeaturePython::onChanged (ViewPocket002): 'NoneType' object has no attribute 'PropertiesList' FeaturePython::onChanged (ViewPocket002): 'NoneType' object has no attribute 'PropertiesList' FeaturePython::onChanged (ViewPocket002): 'NoneType' object has no attribute 'PropertiesList' FeaturePython::onChanged (ViewPocket002): 'NoneType' object has no attribute 'PropertiesList' FreeCAD: /home/galou/builds/free-cad/src/Base/BaseClass.cpp:115: virtual PyObject* Base::BaseClass::getPyObject(): Assertion `0' failed. Abnormal program termination... | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
child of | 0000672 | closed | FreeCAD | Loading Example "Drawing extraction" crashes at Baseclass.cpp line 115 |
|
Yes I was trying to debug that problem too... Werner, can you have a look a this? Here is a simple way to reproduce. It doesn't involve the Draft module, so I'm not too sure what to do: 1) save a test.py file in the macro dir with this code: import FreeCAD,FreeCADGui class testView: def __init__(self, obj): obj.Proxy = self def execute(self, obj): print "execute" def onChanged(self, obj, prop): print "updating prop ",prop def make(): page = FreeCAD.ActiveDocument.addObject("Drawing::FeaturePage","Page") template = FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg' page.Template = template view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View") page.addObject(view) testView(view) FreeCAD.ActiveDocument.recompute() 2) open freecad, create an object, and select that object 3) import test.py;test.make() 4) save the file, close freecad 5) reopen the file --> crash with this message: updating prop Proxy updating prop Rotation updating prop Scale updating prop ViewResult updating prop X updating prop Y freecad: /home/yorik/Apps/Sources/FreeCAD/src/Base/BaseClass.cpp:115: virtual PyObject* Base::BaseClass::getPyObject(): Assertion `0' failed. Anything wrong in the code above? |
|
Reminder sent to: wmayer Werner, can you have a look at this one? Thanks! |
|
Note, using "FreeCADGui.ActiveDocument.ActiveView" isn't very reliable (any more) if you want to access the 3D view of the active document. Now, also the SVG view can be the active view and there are other kind of views than can be the active like the split view, ... But all commands in draft are tailored to expect that the active view is always an instance of the C++ class View3DInventor. I think it should be explicitly requested a view of that type and not assuming the "ActiveView" is automatically the right one. Therefore I have added the method/function get3DView() into DraftTools and DraftTrackers to at least fix this issue. I think it might be best to replace all occurrences of 'FreeCADGui.ActiveDocument.ActiveView' with a call of get3DView(). Btw, maybe you can implement a property called 'ActiveView' when used inside classes: class Tracker; ... def get3DView(self): ... ActiveView = property(get3DView) The crash happened because DrawingView::getPyObject() wasn't implemented before. This was fixed with 0000672. And finally the messages: FeaturePython::onChanged (ViewPocket002): 'NoneType' object has no attribute 'PropertiesList' are a different issue. |
|
Ah great! Considering the svg view as an active view will allow for many interesting things, and it's logical, after all. Indeed that requires reconsidering a few things in the Draft module, where it is assumed that there is always a current 3D view. I'll propagate your changes everywhere in the Draft and Arch modules. Thanks for the fix! I didn't know about that python property function... I'll look into it. About the 'NoneType' object has no attribute 'PropertiesList', it comes recurrently when using Drawing::FeatureView objects, but since it doesn't create any problem, I didn't look much into it yet. |
|
okay should be all working again normally now. I'll leave this open a bit more in case I forgot something. The property() system looks VERY useful... Now I'm wanting to use it everywhere! For now I gathered all the functionality to get the 3D view inside the Draft.py module, so it's accessible easily to all functions. Thanks again for your help Werner, I dind't understand well what was happening. |
|
We can now close this i think. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-04-13 18:22 | galou_breizh | New Issue | |
2012-04-13 19:30 | yorik | Note Added: 0001941 | |
2012-04-13 19:30 | yorik | Note Edited: 0001941 | |
2012-04-13 19:32 | yorik | Note Added: 0001942 | |
2012-04-14 13:30 | yorik | Relationship added | child of 0000672 |
2012-04-16 13:17 | wmayer | Note Added: 0001947 | |
2012-04-16 14:25 | yorik | Note Added: 0001949 | |
2012-04-16 20:57 | yorik | Note Added: 0001950 | |
2012-04-16 21:06 | yorik | Status | new => assigned |
2012-04-16 21:06 | yorik | Assigned To | => yorik |
2012-04-19 21:44 | yorik | Note Added: 0001956 | |
2012-04-19 21:44 | yorik | Status | assigned => closed |
2012-04-19 21:44 | yorik | Resolution | open => fixed |