Cadmium update

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Cadmium update

Jayesh Salvi
Hi all,

This week I managed to do decent progress with Cadmium and was able to
get results that are good enough to share with you.

If you don't remember my Cadmium announcement couple of weeks ago:
Cadmium is a python library for solid modelling, that implements
similar abstractions like OpenSCAD, but as a python module.

A major breakthrough came after I switched from CGAL to PythonOCC as
the backend. With CGAL I was facing a lot of assertion failures or
crashes. Therefore I decided to give PythonOCC a try and it turned out
to be a really good choice. The underlying OpenCASCADE library has so
far been able to handle all the CSG operations I've thrown at it.

Because PythonOCC/OpenCASCADE can do most of the algorithmic work,
only job that is left to Cadmium is to define simple abstractions
(Box, Cylinder, etc.) and provide easy way to write CSG operations.

As a demo, I pulled out couple of OpenSCAD scripts from Thingiverse
and translated them to Cadmium and the results turned out pretty well.

You can find them here:
http://jayesh3.github.com/cadmium/

Please let me know what you think.
Thanks,
--
Jayesh

Reply | Threaded
Open this post in threaded view
|

Re: Cadmium update

Werner Almesberger
Jayesh Salvi wrote:
> You can find them here:
> http://jayesh3.github.com/cadmium/

I hope it's appropriate to post about Cadmium problems to this list.

When trying to run the example, I get

    File "/usr/local/lib/python2.6/dist-packages/cadmium/solid.py", line 183, in
 toSTL
      StlAPI.StlAPI_Write(self.shape, filename, ascii)
  AttributeError: 'module' object has no attribute 'StlAPI_Write'

This is on an Ubuntu that identifies itself as 10.04 (it has a long
upgrade history) with python2.6-occ version 0.4-1ppa2~lucid1

The change below seems to make things work, but I'm not really sure
what I'm doing there ;-)

- Werner

diff --git a/src/cadmium/solid.py b/src/cadmium/solid.py
index 33039d3..3350e8a 100644
--- a/src/cadmium/solid.py
+++ b/src/cadmium/solid.py
@@ -180,4 +180,4 @@ class Solid():
     return self
 
   def toSTL(self, filename, ascii=False):
-    StlAPI.StlAPI_Write(self.shape, filename, ascii)
+    StlAPI.StlAPI.Write(StlAPI.StlAPI(), self.shape, filename, ascii)

Reply | Threaded
Open this post in threaded view
|

Re: Cadmium update

Jayesh Salvi
Hi Werner,

You are using pythonOCC 0.4. cadmium has been tested to work on 0.5. It is very likely that they used to have different interface for exposing StlAPI functionality.

It's pretty easy to install pythonOCC 0.5 from source on an ubuntu machine. Check the "Getting dependencies - PythonOCC" section on the cadmium page: https://github.com/jayesh3/cadmium
--
Jayesh



On Thu, Jul 21, 2011 at 7:22 PM, Werner Almesberger <[hidden email]> wrote:
Jayesh Salvi wrote:
> You can find them here:
> http://jayesh3.github.com/cadmium/

I hope it's appropriate to post about Cadmium problems to this list.

When trying to run the example, I get

   File "/usr/local/lib/python2.6/dist-packages/cadmium/solid.py", line 183, in
 toSTL
     StlAPI.StlAPI_Write(self.shape, filename, ascii)
 AttributeError: 'module' object has no attribute 'StlAPI_Write'

This is on an Ubuntu that identifies itself as 10.04 (it has a long
upgrade history) with python2.6-occ version 0.4-1ppa2~lucid1

The change below seems to make things work, but I'm not really sure
what I'm doing there ;-)

- Werner

diff --git a/src/cadmium/solid.py b/src/cadmium/solid.py
index 33039d3..3350e8a 100644
--- a/src/cadmium/solid.py
+++ b/src/cadmium/solid.py
@@ -180,4 +180,4 @@ class Solid():
    return self

  def toSTL(self, filename, ascii=False):
-    StlAPI.StlAPI_Write(self.shape, filename, ascii)
+    StlAPI.StlAPI.Write(StlAPI.StlAPI(), self.shape, filename, ascii)
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Cadmium update

Giles Bathgate-2
> On Thu, Jul 21, 2011 at 7:22 PM, Werner Almesberger <[hidden email]>
> wrote:
>>
>> Jayesh Salvi wrote:
>> > You can find them here:
>> > http://jayesh3.github.com/cadmium/
>>
>> I hope it's appropriate to post about Cadmium problems to this list.

Prehaps jayesh could setup a google group, or host his own mailing list?

Regards

Giles.

Reply | Threaded
Open this post in threaded view
|

Re: Cadmium update

Werner Almesberger
In reply to this post by Jayesh Salvi
Jayesh Salvi wrote:
> You are using pythonOCC 0.4. cadmium has been tested to work on 0.5. It is
> very likely that they used to have different interface for exposing StlAPI
> functionality.

Indeed, the API changed. I built pythonOCC 0.5 from source, had Cadmium
complain with my hack still in place, but things worked as expected
after removing my change. Thanks !

- Werner

Reply | Threaded
Open this post in threaded view
|

Re: Cadmium update

Jayesh Salvi
In reply to this post by Giles Bathgate-2


On Fri, Jul 22, 2011 at 12:31 AM, Giles Bathgate <[hidden email]> wrote:
> On Thu, Jul 21, 2011 at 7:22 PM, Werner Almesberger <[hidden email]>
> wrote:
>>
>> Jayesh Salvi wrote:
>> > You can find them here:
>> > http://jayesh3.github.com/cadmium/
>>
>> I hope it's appropriate to post about Cadmium problems to this list.

Prehaps jayesh could setup a google group, or host his own mailing list?


 Makes sense.

Cadmium is part of a big project called 3DTin. I already have a google groups for 3DTin related discussions. It's not in much use recently, but feel free to post cadmium related issues there. I will try to answer as soon as I can.

Also, github's issues are good way to discuss issues with cadmium.