Spreadsheet module

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
cmundi
Posts: 28
Joined: Thu Apr 17, 2014 5:03 am

Re: Spreadsheet module

Postby cmundi » Sun Apr 20, 2014 10:14 pm

Would it be easier in the long run to embed a "native" spreadsheet object from the underlying platform, like OpenOffice Calc or MS Excel (or I don't know on MacOS)? Sure, it's a platform dependence but an awful lot of work goes into making a robust spreadsheet. Either way, this is very cool! Thanks!
triplus
Posts: 9428
Joined: Mon Dec 12, 2011 4:45 pm

Re: Spreadsheet module

Postby triplus » Mon Apr 21, 2014 3:46 am

You can already do the work in preferred spreadsheet program and import it in FreeCAD:

viewtopic.php?f=9&t=4359&start=30#p34431
cmundi
Posts: 28
Joined: Thu Apr 17, 2014 5:03 am

Re: Spreadsheet module

Postby cmundi » Mon Apr 21, 2014 4:11 pm

triplus wrote:You can already do the work in preferred spreadsheet program and import it in FreeCAD:

viewtopic.php?f=9&t=4359&start=30#p34431
Ah! Perfect. Thanks!
triplus
Posts: 9428
Joined: Mon Dec 12, 2011 4:45 pm

Re: Spreadsheet module

Postby triplus » Mon Apr 21, 2014 8:01 pm

You're welcome.
kwahoo
Posts: 275
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Spreadsheet module

Postby kwahoo » Sun Jun 01, 2014 2:04 pm

Hi,
Could you check my file? Spreadsheet workbench crashes when I'm trying open it.
simple-crank.fcstd
(27.47 KiB) Downloaded 89 times

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
Next thing: When I'm trying read Shape.Solids[0].CenterOfMass.z it gives me a number in the Python console, but not when I'm using the CellController. I see "Compound object at xxxxxx" instead.

Image

Code: Select all

OS: Ubuntu 14.04 LTS
Platform: 64-bit
Version: 0.14.3639 (Git)
Branch: master
Hash: 4c48bdf2166f273e60bcaf95281b7dde726db2f5
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.0
jmaustpc
Posts: 9639
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Spreadsheet module

Postby jmaustpc » Sun Jun 01, 2014 2:17 pm

The file opened for me and seems to work in that it shows a crank but I get an error message

Traceback (most recent call last):
File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
<type 'exceptions.ValueError'>: No JSON object could be decoded


OS: Ubuntu 12.04.4 LTS
Platform: 64-bit
Version: 0.14.3641 (Git)
Branch: master
Hash: 2724242f38476a4eab398318783bf7f06f889c05
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.1

cranksimplenocrashbuterrors.jpeg
cranksimplenocrashbuterrors.jpeg (69.24 KiB) Viewed 3541 times
kwahoo
Posts: 275
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Spreadsheet module

Postby kwahoo » Sun Jun 01, 2014 2:53 pm

Thanks Jim.

It seems that Spreadsheet object is the culprit...

Edit: I found something.

Spreadsheet object in an usual Document.xml file

Code: Select all

		<Object name="Spreadsheet">
			<Properties Count="3">
				<Property name="Controllers" type="App::PropertyLinkList" group="Base" doc="Cell controllers of this object" attr="0" ro="0" hide="0">
					<LinkList count="0">
					</LinkList>
				</Property>
				<Property name="Label" type="App::PropertyString">
					<String value="Spreadsheet"/>
				</Property>
				<Property name="Proxy" type="App::PropertyPythonObject">
					<Python value="eyJPYmplY3QiOiAiU3ByZWFkc2hlZXQiLCAiVHlwZSI6ICJTcHJlYWRzaGVldCJ9" encoded="yes" module="Spreadsheet" class="Spreadsheet"/>
				</Property>
			</Properties>
		</Object>
In my broken file

Code: Select all

		<Object name="Spreadsheet">
			<Properties Count="3">
				<Property name="Controllers" type="App::PropertyLinkList" group="Base" doc="Cell controllers of this object" attr="0" ro="0" hide="0">
					<LinkList count="10">
						<Link value="PropertyController"/>
						<Link value="PropertyController001"/>
						<Link value="PropertyController002"/>
						<Link value="PropertyController003"/>
						<Link value="PropertyController004"/>
						<Link value="PropertyController005"/>
						<Link value="PropertyController006"/>
						<Link value="CellController"/>
						<Link value="CellController001"/>
						<Link value="CellController002"/>
					</LinkList>
				</Property>
				<Property name="Label" type="App::PropertyString">
					<String value="Spreadsheet"/>
				</Property>
				<Property name="Proxy" type="App::PropertyPythonObject">
					<Python value="" encoded="yes" module="Spreadsheet" class="Spreadsheet"/>
				</Property>
			</Properties>
		</Object>
Notice blank "Python value".
User avatar
yorik
Site Admin
Posts: 11845
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Spreadsheet module

Postby yorik » Sun Jul 06, 2014 9:39 pm

I finally found a moment to have a look at this... The problem is that a document object is written as a cell contents, and it contains "<" and ">" characters that cuase problems when written to xml... I'll add something to avoid this.
*Edit* done in git commit 1be778a
User avatar
cShellPro
Posts: 5
Joined: Fri Jan 30, 2015 7:23 pm
Location: Johannesburg, South Africa

Re: Spreadsheet module

Postby cShellPro » Sat Jan 31, 2015 5:40 am

Could this be used to update paramters in my Sketch?
I'm thinking of a way to change i.e the height, length or
diameter of contstrains, so my model updates according
to the values I enter in the spreadsheet.
Frank
-----------------------------------------------
OpenSuSe 13.2 (64-bit)
FreeCAD V15
Wanhao Duplicator 5S, RepRap Prusa i3