OK, I'm doing laser cutter stuff again. I need to move things into position
so that I can create matching cutouts. I think I've managed to get an OK-ish
workflow (though I will revise it further). However, one problem with this
workflow is that I kind of lose track of the position of the parts, which
makes it hard to move them to their cut template position.
As it works, translate is relative to current position. Is there any way to
move it to an absolute position?
--
Sent from: http://forum.openscad.org/
If you mean
translate([somewhere in the wilderness])
...
...
translate([to a fixed location])
cube(1);
No. Cascading definitions are relative to those above (outer-scope)
positions.
Interesting concept tho, maybe worth discussion on a language evolution?
Admin - email* me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
Sent from: http://forum.openscad.org/
Translate is absolute if it is at the top. I.e. translate([100, 20, 10])
sphere() places a sphere at [100, 20, 10]. If it is underneath another
translate or rotate, etc, then they get compounded.
I don't really appreciate the problem. I model my flat sheets for CNC
routing as individual modules with their origin at the centre. I know their
sizes, so with a bit of maths I can lay them out for routing or rotate them
into position for the assembly view. I.e. F5 gives me this:
[image: image.png]
And F6 gives me this:
[image: image.png]
The code to lay out for milling is just this:
module acrylic_dxf() {
gap = 8;
off = box_corner_gap(box);
w = box_width(box);
d = box_depth(box);
h = box_height(box);
translate([w / 2 - off, h / 2 - off]) box_front_dxf();
translate([w + gap + d / 2 - 3 * off, h / 2 - off]) box_right_dxf();
translate([w + 2 * gap + 3 * d / 2 - 5 * off, h / 2 - off])
box_left_dxf();
translate([w / 2, h + d / 2 + gap - 2 * off]) box_top_dxf();
left2_dxf();
}
module dibond_dxf() {
gap = 8;
off = box_corner_gap(box);
w = box_width(box);
d = box_depth(box);
h = box_height(box);
translate([w / 2 - off, h / 2 - off]) box_back_dxf();
translate([w / 2, h + d / 2 + gap - 2 * off]) vflip() box_base_dxf();
}
To draw the assembly view I have a box_assembly() module that creates a box
with blank sheets and I redefine the modules for front, back, top, bottom,
left and right with customised sheets with components mounted on them.
On Mon, 11 Feb 2019 at 09:06, Troberg troberg.anders@gmail.com wrote:
OK, I'm doing laser cutter stuff again. I need to move things into position
so that I can create matching cutouts. I think I've managed to get an
OK-ish
workflow (though I will revise it further). However, one problem with this
workflow is that I kind of lose track of the position of the parts, which
makes it hard to move them to their cut template position.
As it works, translate is relative to current position. Is there any way to
move it to an absolute position?
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
How would you define the absolute position of an object?
A common but not the only way is to define it as center of its bounding box.
But OpenSCAD currently does not provide any functions to get information
about its objects.
If you can't do it by introducing relative transformations for each object
using visual control, you are left to to arrange your objects after export
using some other programming language.
When I do a design meant for printing I usually implement a module named
system() and another one named print(). The first shows the assembled state
of the design and arranges all components at their final positions. The
second arranges the components in the best way for print.
--
Sent from: http://forum.openscad.org/
nophead wrote
I don't really appreciate the problem. I model my flat sheets for CNC
routing as individual modules with their origin at the centre. I know
their
sizes, so with a bit of maths I can lay them out for routing or rotate
them
into position for the assembly view. I.e. F5 gives me this:
In your case, it's just flat parts.
In my current test case, it's basically a "rib model" of a "Tintin rocket".
So, everything is curved, and circles that holds the outer profiles
together. Things fit together with "halfway slots", so that each part is cut
into halfway so that they meet up nicely. This means that I need parts to
interact both ways (difference(){a b} and difference(){b a}, and to keep it
neat and generic (I only want one module to define the profile, and one
array to define the support circles, the rest should be a standard immutable
framework), things get buried in several levels of calls with children().
Now, I do it with a rocket, but it could just as well be something like this
(https://www.thingiverse.com/thing:945180) or a zeppelin hull or something
else with a circular cross section.
--
Sent from: http://forum.openscad.org/
Too late for the previous reply, I found something like what I'm trying to
do: https://www.thingiverse.com/thing:202
My model is slightly more complex, but basically the same issue and a
similar construction.
--
Sent from: http://forum.openscad.org/
The model I showed does use that type of construction for the corner
profiles that are too long for my printers.
[image: image.png]
I model the male and female parts separately though, rather than
subtracting one from the other because they have subtle differences to
ensure a good press fit. For example an internal female corner will always
be a bit rounded so I round the corners on the male part. I also make it
one layer shorter than the female socket to ensure the outside meets first
and doesn't leave a gap and I chamfer the entrance and tips to make it easy
to insert.
Again these are modelled with a local origin in the centre, so it isn't
hard to place them for printing or insert them into the assembly.
On Mon, 11 Feb 2019 at 11:50, Troberg troberg.anders@gmail.com wrote:
Too late for the previous reply, I found something like what I'm trying to
do: https://www.thingiverse.com/thing:202
My model is slightly more complex, but basically the same issue and a
similar construction.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org