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!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
cmundi
Posts: 28
Joined: Thu Apr 17, 2014 5:03 am

Re: Spreadsheet module

Post by cmundi »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Spreadsheet module

Post by triplus »

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

Post by cmundi »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Spreadsheet module

Post by triplus »

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

Re: Spreadsheet module

Post by kwahoo »

Hi,
Could you check my file? Spreadsheet workbench crashes when I'm trying open it.
simple-crank.fcstd
(27.47 KiB) Downloaded 139 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
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Spreadsheet module

Post by jmaustpc »

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 5110 times
User avatar
kwahoo
Posts: 680
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: Spreadsheet module

Post by kwahoo »

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
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Spreadsheet module

Post by yorik »

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: 22
Joined: Fri Jan 30, 2015 7:23 pm
Location: Johannesburg, South Africa
Contact:

Re: Spreadsheet module

Post by cShellPro »

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.
Dr. Franklin
Post Reply