Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem .clone()ing a user defined object #154

Open
Thav opened this issue Feb 5, 2014 · 3 comments
Open

Problem .clone()ing a user defined object #154

Thav opened this issue Feb 5, 2014 · 3 comments

Comments

@Thav
Copy link

Thav commented Feb 5, 2014

Code here:
https://www.dropbox.com/sh/nzkay28ov4nksqz/u08II_ga3C

I have a part that I've defined as a subclass of Part. When I try to .clone() (on line 106 of filletsCloneProblem.coffee in the code in Dropbox) the part, I get the error:
File: line 215: _ref is undefined

There is no line 215 in the code. I am able to clone the objects created in the objectOriented/defining_parts example, but don't see what the problem is here.

@kaosat-dev
Copy link
Owner

sadly the line numbers can be misleading with some errors because of the coffeescript -> javascript compiling, future versions should in theory have less of those issues.

about the issue itself not 100% sure, I am investigating where it comes from (something seems to not be initiated correctly in the filletPlank class from what I traced down so far...very weird

@kaosat-dev
Copy link
Owner

okay, if you replace
@defaults = {}
with
@defaults = {size:[0,0,0]}

in the constructor of filletPlank class you get a "degenerate polygon" error (self intersecting etc) which is already a lot less obscure :)

@Thav
Copy link
Author

Thav commented Feb 6, 2014

Different initializations of size gets different results.

[0,0,1], [0,1,1] and similar - these result in "cube size should be non negative". This seems to be because of the lines
[@x,@y,@r] = @SiZe
@plank = new Cube({size:[@x-@r,@y,@r],center:true}).translate([-@r/2,0,0])
So you get 0-1 as one of the dimensions of the cube created with the default values (even though the cloned object should be getting values other than the default)

[1,1,1] gets maximum stack size exceeded, maybe it's breaking at 0 as one of the dimensions.

[2,1,1] makes it work, and the object is cloned as expected, not using the default values set.

I tried to understand javascript prototypal inheritance, but I don't, and I fear the unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants