You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please add some multi-transform examples to the documentation #186
From the look of #185, it seems like you had some different expectations about how composed transformations would work. I think that SolidPython & OpenSCAD process those nested transformations identically. Can you think of a minimal example that would have made this more clear to you? I don’t think I quite understand the ambiguity you’d been seeing.
I don't disagree with you about the semantics. I've personally never used a construction where you have a simple transformation with a {} block after it in OpenSCAD so I guess it's no surprise that I don't expect it in python either. I've been missing a trick.
is that t would be a callable that would rotate then translate its argument.
The (incorrectly) unexpected part is that what actually happens is that t is a translation at the root of a tree where one branch has a rotation on it, and calling it again adds another branch to the translation rather than adding to the end of the chain of transforms that I thought I created.
All that aside, I wouldn't have had to try come to any conclusions if there were examples the covered chained transformations. In fact I couldn't find any examples to follow that had more than a single transform applied to an object. I think if I had been able to find a simple example of chained transforms all this unpleasantness would have been avoided.
It doesn't have to be that much, like that's a long tutorial, but yes I'm essentially asking for a snippet that demonstrates a few transforms in a chain.
@charlieb Btw: As you correctly analyzed in #185 SolidPython builds (something like ;) a tree, but -- as this example shows -- it's actually a graph ;)
So the code above, the dotted style won't build for me:
import solid as s
s.sphere(r=10).rotate([0, 90, 0])
gives
Traceback (most recent call last):
File "/home/charlieb/src/textures/test.py", line 3, in <module>
s.sphere(r=10).rotate([0, 90, 0])
AttributeError: 'sphere' object has no attribute 'rotate'
That's a different issue (also no doubt my problem) but yes that instance of ).rotate(0, 90, 0).forward(axle_offset) would be what I'm looking for, only maybe with the alternate syntaxes listed.
Activity
etjones commentedon Sep 19, 2021
charlieb commentedon Sep 19, 2021
I don't disagree with you about the semantics. I've personally never used a construction where you have a simple transformation with a {} block after it in OpenSCAD so I guess it's no surprise that I don't expect it in python either. I've been missing a trick.
What I expected from this code:
is that t would be a callable that would rotate then translate its argument.
The (incorrectly) unexpected part is that what actually happens is that t is a translation at the root of a tree where one branch has a rotation on it, and calling it again adds another branch to the translation rather than adding to the end of the chain of transforms that I thought I created.
All that aside, I wouldn't have had to try come to any conclusions if there were examples the covered chained transformations. In fact I couldn't find any examples to follow that had more than a single transform applied to an object. I think if I had been able to find a simple example of chained transforms all this unpleasantness would have been avoided.
Neon22 commentedon Sep 19, 2021
so in Openscad this would be :
(Because they follow each other we don't need any
{}for grouping)jeff-dh commentedon Sep 19, 2021
One could add an translation of the basic OpenSCAD Tutorial (https://en.wikibooks.org/wiki/OpenSCAD_Tutorial/Chapter_1#Completing_your_first_model)
The exp solid branch contains an example like it but with a different focus (and syntax):
https://github.com/jeff-dh/SolidPython/blob/exp_solid/solid/examples/06-functions.py
The intention was to give an example how to assemble more complex models and I think that's what you're asking for, right?
charlieb commentedon Sep 20, 2021
It doesn't have to be that much, like that's a long tutorial, but yes I'm essentially asking for a snippet that demonstrates a few transforms in a chain.
jeff-dh commentedon Sep 20, 2021
I thought about something like this:
This is "expSolid-Style" but should be easily translatable to Solid::master compatible code.
jeff-dh commentedon Sep 20, 2021
@charlieb Btw: As you correctly analyzed in #185 SolidPython builds (something like ;) a tree, but -- as this example shows -- it's actually a graph ;)
charlieb commentedon Sep 20, 2021
So the code above, the dotted style won't build for me:
gives
That's a different issue (also no doubt my problem) but yes that instance of
).rotate(0, 90, 0).forward(axle_offset)would be what I'm looking for, only maybe with the alternate syntaxes listed.jeff-dh commentedon Sep 20, 2021
This is master compatible....