{"action":"created","issue":{"url":"https://api.github.com/repos/openscad/openscad/issues/1256","labels_url":"https://api.github.com/repos/openscad/openscad/issues/1256/labels{/name}","comments_url":"https://api.github.com/repos/openscad/openscad/issues/1256/comments","events_url":"https://api.github.com/repos/openscad/openscad/issues/1256/events","html_url":"https://github.com/openscad/openscad/issues/1256","id":60767251,"number":1256,"title":"Can't pass child modules to children()","user":{"login":"davidson16807","id":5824741,"avatar_url":"https://avatars.githubusercontent.com/u/5824741?v=3","gravatar_id":"","url":"https://api.github.com/users/davidson16807","html_url":"https://github.com/davidson16807","followers_url":"https://api.github.com/users/davidson16807/followers","following_url":"https://api.github.com/users/davidson16807/following{/other_user}","gists_url":"https://api.github.com/users/davidson16807/gists{/gist_id}","starred_url":"https://api.github.com/users/davidson16807/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidson16807/subscriptions","organizations_url":"https://api.github.com/users/davidson16807/orgs","repos_url":"https://api.github.com/users/davidson16807/repos","events_url":"https://api.github.com/users/davidson16807/events{/privacy}","received_events_url":"https://api.github.com/users/davidson16807/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-12T03:50:15Z","updated_at":"2015-03-12T22:20:09Z","closed_at":null,"body":"I've been trying to implement a new feature for my [library](https://github.com/davidson16807/relativity.scad). I'd like to create a module called `anchor()`. Given a child module that invokes the `children()` operator, `anchor()` translates the child module so that its origin exists at a given location. The location of the origin is specified by a string parameter that is also provided to `anchor()`.\r\n\r\nAs an example:\r\n\r\n    anchor(\"foo\")\r\n    box(50)\r\n    align(top)\r\n    ball(50)\r\n    align(top)\r\n    rod(50, $class=\"foo\")\r\n    children();\r\n\r\nThe object above will be rendered with its origin located at the object of class \"foo\".\r\n\r\nThe implementation I worked out requires that `anchor()` invoke its child module twice. The first invocation is not rendered, and serves only to calculate the absolute position at location \"foo\". The second invocation translates and renders the child module with an offset of -2 times the position found from the first invocation. It looks something like this:\r\n\r\n    module anchor(class){\r\n        attach(class)\r\n        children()\r\n        translate(-2*$position)\r\n        children();\r\n    } \r\n\r\n`$position` is a special variable representing absolute position as calculated by some of the objects in my library. `attach(class)` is what permits only the second instance of children() to be rendered.\r\n\r\nThe problem, I discovered, is that OpenSCAD does not appear to support passing child modules to the children() operator. I've made sure of this by testing the most basic example:\r\n\r\n    module foo(){\r\n        children()\r\n        children();\r\n    } \r\n\r\nIts possible this has been discussed before, but I don't see it when I search existing issues. Is this intended behavior? Is there any strong reason this can't/shouldn't be implemented?\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9465238-can-t-pass-child-modules-to-children?utm_campaign=plugin&utm_content=tracker%2F52063&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F52063&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/openscad/openscad/issues/comments/78655044","html_url":"https://github.com/openscad/openscad/issues/1256#issuecomment-78655044","issue_url":"https://api.github.com/repos/openscad/openscad/issues/1256","id":78655044,"user":{"login":"nophead","id":566149,"avatar_url":"https://avatars.githubusercontent.com/u/566149?v=3","gravatar_id":"","url":"https://api.github.com/users/nophead","html_url":"https://github.com/nophead","followers_url":"https://api.github.com/users/nophead/followers","following_url":"https://api.github.com/users/nophead/following{/other_user}","gists_url":"https://api.github.com/users/nophead/gists{/gist_id}","starred_url":"https://api.github.com/users/nophead/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nophead/subscriptions","organizations_url":"https://api.github.com/users/nophead/orgs","repos_url":"https://api.github.com/users/nophead/repos","events_url":"https://api.github.com/users/nophead/events{/privacy}","received_events_url":"https://api.github.com/users/nophead/received_events","type":"User","site_admin":false},"created_at":"2015-03-12T22:20:09Z","updated_at":"2015-03-12T22:20:09Z","body":"I am afraid you have completely lost me but sphere(5) children() will ignore children() because the sphere module ignores its children.\r\n\r\nThe point I was making is if kid() picks up its children from where it is instiated it cant be passed more children in foo when it is accessed through children(). The meaning of the construct could be one or the other but not both.\r\n"}}