Git Product home page Git Product logo

cadmium's People

Contributors

jay3sh avatar meawoppl avatar o8ruza8o avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cadmium's Issues

stl import

Hallo,

i dont know if it is possible to import an stl and use it a primive.
I tried to do it but keep getting a runtime exception in line "
test = sol + s0":

"Message File Name Line Position
Traceback
C:\Documents and Settings\Tarjan\My Documents\Downloads\jayesh3-cadmium-ff4e994\jayesh3-cadmium-ff4e994\examples\example-001b.py 21
add c:\Python26\Lib\site-packages\cadmium\solid.py 42
RuntimeError: StdFail_NotDone
BRep_API: command not done "

My Code is:

!/usr/bin/python

import sys
import math
sys.path.append('./src')

from cadmium import *

stlfname = "example.stl"#sys.argv[1]

s0 = Sphere(r=4)

from OCC.Utils.DataExchange import STL
reader = STL.STLImporter(r'basebrick.stl')
reader.read_file()

sol = Solid(reader.get_shape())

test = sol + s0

test.toSTL(stlfname)


If somebody tells me how, ican upload the stl file. It seems that the OpenCASCADE lib throws the exception. But i cant step into it...

Tarjan

Memory leak

Union consumes about 500 Kb per sphere, though not producing new vertices.
Following program was run on a machine with 512Mb memory limit, crashed after making union of 800 identical spheres.

!/usr/bin/python

import sys
import math

from cadmium import *

def memory_usage():
"""Memory usage of the current process in MB."""
status = None
result = {'peak': 0, 'rss': 0}
try:
status = open('/proc/self/status')
for line in status:
parts = line.split()
key = parts[0][2:-1].lower()
if key in result:
result[key] = int(parts[1]) / 1024
finally:
if status is not None:

        status.close()
return result

s = Sphere(r = 5, center = True)
a = s

n = int(sys.argv[1])
for i in xrange(0, n):
s = s + a
if (i % 100) == 0:
print "i =", i, "mem usage", memory_usage()

s.toSTL("1.stl")

Output was:

deltaflight@natty32:~$ time python loop.py 900
i = 0 mem usage {'peak': 148, 'rss': 79}
i = 100 mem usage {'peak': 197, 'rss': 127}
i = 200 mem usage {'peak': 247, 'rss': 176}
i = 300 mem usage {'peak': 297, 'rss': 225}
i = 400 mem usage {'peak': 350, 'rss': 277}
i = 500 mem usage {'peak': 400, 'rss': 325}
i = 600 mem usage {'peak': 450, 'rss': 374}
i = 700 mem usage {'peak': 499, 'rss': 422}
i = 800 mem usage {'peak': 554, 'rss': 462}
Killed

real 2m6.949s
user 0m25.714s
sys 1m10.208s

deltaflight@natty32:~$ dmesg |tail -2
[ 3123.445580] Out of memory: Kill process 1101 (python) score 934 or sacrifice child
[ 3123.445833] Killed process 1101 (python) total-vm:607704kB, anon-rss:474520kB, file-rss:24kB

strange Standard_ConstructionError

please look at this:

import sys
sys.path.append('./src')
from cadmium import *
u = Box(62,62,100, center=True) + Sphere(19).translate(-31,-31,-31)```

when run with current HEAD, I get:
```Traceback (most recent call last):
  File "examples/fail.py", line 5, in <module>
    u = Box(62,62,100, center=True) + Sphere(19).translate(-31,-31,-31)
  File "./src/cadmium/solid.py", line 50, in __add__
    union = BRepAlgoAPI_Fuse(self.shape, other.shape).Shape()
  File "/usr/lib/pymodules/python2.7/OCC/BRepAlgoAPI.py", line 222, in __init__
    _BRepAlgoAPI.BRepAlgoAPI_Fuse_swiginit(self,_BRepAlgoAPI.new_BRepAlgoAPI_Fuse(*args))
RuntimeError: Standard_ConstructionError```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.