View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002664 | Path | Bug | public | 2016-08-08 15:06 | 2017-01-09 03:38 |
Reporter | sliptonic | Assigned To | mlampert | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | linux | OS | mint | OS Version | (various) |
Product Version | 0.17 | ||||
Target Version | 0.17 | Fixed in Version | 0.17 | ||
Summary | 0002664: created tool object is invalid on first access | ||||
Description | http://pastebin.com/RYyFQpee When a path tool object is created, an error is thrown the first time the object is accessed. After that, the object behaves normally. | ||||
Steps To Reproduce | Python 2.7.6 (default, Jun 22 2015, 18:01:27) [GCC 4.8.2] on linux2 Type 'help', 'copyright', 'credits' or 'license' for more information. >>> import Path >>> tt = Path.Tooltable() >>> print tt Tooltable containing 0 tools >>> t = Path.Tool() >>> print t TypeError: bad argument type for built-in operation >>> print t Tool Default tool >>> | ||||
Additional Information | This is a separate issue but I'll throw it here for comment: Objects can store a reference to a tooltable: obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", "The tooltable used for this CNC program") But a tool can only be referred to by tool number which is then used to look up the tool in the tooltable. Can we add the python wrapper so we can store a direct reference to the tool in the operation? Like: obj.addProperty("Path::PropertyTool", "Tool", "Base", "The tool used for this operation") | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
After rebuilding today, the issue is much improved and doesn't happen anywhere near as often. The following does cause it to occur in the python console. #This doesn't work FreeCADGui.doCommand('import Path') FreeCADGui.doCommand('t = Path.Tool()') FreeCADGui.doCommand('t.Name = "Bob"') FreeCADGui.doCommand('print t.Name') #This works fine snippet = ''' import Path t = Path.Tool() t.Name = "Bob" print t.Name ''' FreeCADGui.doCommand(snippet) |
|
Is this still an issue? This works for me: FreeCADGui.doCommand('import Path') FreeCADGui.doCommand('t = Path.Tool()') FreeCADGui.doCommand('t.Name = "Bob"') FreeCADGui.doCommand('print t.Name') as well as the other code snippets in this report |
|
About your other request, it's possible, but it won't be the same tool as in the tooltable. So I don't think this is what you want. To have a tool that is both a property and inside a tooltable, the only way I see is that everything becomes document object. Then the tool object can be linked to from both a tooltable and an operation. |
|
I'm still seeing it. >>> snippet = ''' ... import Path ... t = Path.Tool() ... t.Name = "Bob" ... print t.Name ... ''' >>> FreeCADGui.doCommand(snippet) Bob >>> >>> import Path >>> t = Path.Tool() >>> t.Name = "Bob" >>> print t.Name >>> >>> #This doesn't work >>> FreeCADGui.doCommand('import Path') >>> import Path >>> FreeCADGui.doCommand('t = Path.Tool()') >>> t = Path.Tool() >>> FreeCADGui.doCommand('t.Name = "Bob"') TypeError: bad argument type for built-in operation >>> FreeCADGui.doCommand('t.Name = "Bob"') >>> t.Name = "Bob" >>> |
|
still no problem for me... I don't get the TypeError: bad argument type for built-in operation This error message is a standard python error message... It seems to be complaining that "Bob" is not of a valid type. Strange! |
|
The simplest case to reproduce is "t = Path.Tool()<enter>" "<enter>" The issue is the initialisation of Tool, disabling that eliminates the error. The problem is that all arguments are optional, and if an optional argument isn't specified the argument parser does not modify provided pointer. In turn the 0 pointer PyObject can not be used to be converted to a double with PyFloat_AsDouble(ptr). |
|
fix merged, commit 25fc1d3ddf81c03f31ff8f8a5d460f786d926538 |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-08-08 15:06 | sliptonic | New Issue | |
2016-08-08 15:06 | sliptonic | Status | new => assigned |
2016-08-08 15:06 | sliptonic | Assigned To | => yorik |
2016-08-12 20:12 | sliptonic | Note Added: 0007266 | |
2016-10-19 17:10 | yorik | Note Added: 0007399 | |
2016-10-19 17:12 | yorik | Note Added: 0007400 | |
2016-10-19 20:17 | sliptonic | Note Added: 0007402 | |
2016-10-19 20:19 | sliptonic | Note Edited: 0007402 | |
2016-10-19 20:34 | yorik | Note Added: 0007403 | |
2017-01-06 22:05 | mlampert | Assigned To | yorik => mlampert |
2017-01-06 22:25 | mlampert | Note Added: 0007567 | |
2017-01-09 01:07 | mlampert | Note Added: 0007576 | |
2017-01-09 01:07 | mlampert | Status | assigned => closed |
2017-01-09 01:07 | mlampert | Resolution | open => fixed |
2017-01-09 01:07 | mlampert | Fixed in Version | => 0.17 |
2017-01-09 03:38 | yorik | Changeset attached | => FreeCAD Master master 25fc1d3d |