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

can't subtract from intersection #77

Closed
solidboredom opened this issue Aug 26, 2021 · 9 comments
Closed

can't subtract from intersection #77

solidboredom opened this issue Aug 26, 2021 · 9 comments

Comments

@solidboredom
Copy link

solidboredom commented Aug 26, 2021

Hello,
this gives me an Error:

#!/usr/bin/env python3
#coding: utf-8

from zencad import *

def frame(offset):	return (cylinder(33/2+offset,400).rotY(deg(180)).back(70/2)
			+ cylinder(33/2+offset,400).rotY(deg(-115)).back(70/2) 
			+ cylinder(25/2+offset,400).rotY(deg(110)).back(25/2+3))

d = cylinder(60/2,70).rotX(deg(90)) -cylinder(45/2+offset,70).rotX(deg(90))

disp(intersect([frame(10),d])-frame(0))
show()
@oleg-medovikov
Copy link

it's your code. An error somewhere in the indentation.

image

@solidboredom
Copy link
Author

Oh. Thanks Oleg,
CopyPasting to the Github ate my original indentations, but still: a fact is a fact.
i will try it again, it is either my indentation or something about my setup.

@mirmik
Copy link
Owner

mirmik commented Aug 27, 2021

line 9:
cylinder(45/2+offset,70)
45/2+offset - offset is not a variable in this context. Because it is outside the function.
It say "'float' and 'function'". The offset is internal python function. So it is really the function in global scope.

@solidboredom
Copy link
Author

Sadly, the Problem perisists. I could reproduce the error free run, Oleg has screenshoted, but this is different from i intended/wrote. The same goes to Error mirmik has described.
Due to ambiguity of missing indentations in Python (eaten up by github) it changed its meaning to python! GRRRR!
i have updated my original post to possibly diasambigue the code

@mirmik
Copy link
Owner

mirmik commented Aug 27, 2021

You can use code snippets for python code.

def func(a,b):
    return a+b

source code of snippet:

```python
def func(a,b):
    return a+b       (here we use spaces. no tabs.)
```.(without dot)

@solidboredom
Copy link
Author

Thanks Mirmik. i have fixed It. it looks good now. copypastingit reproduces the error for me

@solidboredom
Copy link
Author

solidboredom commented Aug 27, 2021

I mean the problem is still there. i have fixed the formatting on github

@mirmik
Copy link
Owner

mirmik commented Aug 27, 2021

So ok. Whats about offset variable in line 10?

@solidboredom
Copy link
Author

I can't beleive it was so simple! it has nothing to do with the core operations. you were right. after all these years in software, after all.
it is time to learn to interpret pythons error mesages. will need to look at how to force obligatory variable delarations on it.
Thanks!

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

3 participants