Hi Troberg,

This reminds me a little bit of a concept I was playing with a few

months back, but hadn't gotten around to sharing yet. Its not a

direct solution to what you are asking but I think the concept might

be applicable in a similar way for what you want.

In this case I wanted to create some continuous pipe using simple

operations and not have to think too hard about where the endpoint is

after a bunch of turns etc.

I just cleaned up my code and added some comments for better

user-friendliness.

In the example below, I guess I am considering the final sphere() call

to be analogous to your concept of a point object.

```

// Pipe library demonstrating a concept of chained operations

$fn = 72; // define exact number of fragments in curves

// using $fs instead would cause some mismatched # of edges during tapers

echo(str("For best results, all angles should be multiples of ",

360/$fn, " degrees"));

// Example of how to use pipe

// Note that all calls are chained (there's only one semicolon, at the end)

// children are automatically transformed to the end of the "path"

pipe([4,6])

elbow()

straight(10)

taper_to([8,10], length=10)

elbow(angle=180, heading=30)

straight(20)

sphere(d=6); // we can even terminate the chain with a module that

doesn't "know" anything about our pipes

// initializes the pipe size, but draws nothing

module pipe(size=[2,4]) {

$pipe_size = size;

children();

}

module straight(length=10) {

linear_extrude(height=length) difference() {

circle(d=$pipe_size[1]);

circle(d=$pipe_size[0]);

}

translate([0,0,length]) children();

}

// no-operation

// This aids in passing data via special variables from parent to children

// Related issue:

https://github.com/openscad/openscad/issues/2104module noop() children();

// calls to noop() could also be replaced by let() (experimental), if

running a development snapshot.

module taper_to(size, length=10) {

IR1 = $pipe_size[0]/2;

OR1 = $pipe_size[1]/2;

IR2 = size[0]/2;

OR2 = size[1]/2;

points = [

[IR1, 0], [OR1, 0],

[OR2, length], [IR2, length]

];

rotate_extrude() polygon(points);

translate([0,0,length])

noop($pipe_size=size)

children();

}

// R = center radius of elbow

// angle = the angle through which the elbow bends.

// heading = which direction it bend towards

module elbow(R=$pipe_size[1]/2, angle=90, heading=0) {

OR = $pipe_size[1]/2;

if (angle != 0) {

rotate(heading) translate([R+OR,0]) rotate([-90,0,0]) {

rotate_extrude(angle=angle)

translate([-R-OR,0]) difference() {

circle(d=$pipe_size[1]);

circle(d=$pipe_size[0]);

}

}

}

rotate(heading) translate([R+OR,0,0]) rotate([0,angle,0])

translate([-R-OR,0,0]) children();

}

```

What do you think? Is that helpful at all for what you need to do?

-Hans

On Mon, Feb 5, 2018 at 2:35 AM, Troberg <

[hidden email]> wrote:

> I have a problem where I need to place a flat object between several

> supports. These supports are parametric, so size and rotation angles varies.

> Also, the supports have thickness which needs to be taking into account.

> (This is only the problem at hand at the moment, I have had many other more

> or less similar issues in other projects, so don't dig too deep into the

> details.)

>

> Now, of course, I could do what I've done so far, and simple do a shitload

> of trigonometry, but that is a total pain in the rear to maintain. I want to

> work creatively, and be able to alter things as I go and as the build takes

> form, and that's simply not possible when things hang on five pages of math.

>

> So, what I'd like to do, something like adding a point object. Kind of like

> a sphere, but without size and invisible. This can then be unioned,

> translated, rotated and so on like any primitive. It never changes size, of

> course, so scale operations and so on only move it if it's unioned with

> other stuff.

>

> Then, at a later point, I want to be able to get the current coordinations

> of this point. That way, I could define the "attachment point", union it to

> whatever part it belongs to, move and rotate the part, then ask the

> "attachment point" what coordinate it has now, and use that for placement of

> other stuff.

>

> Now, this is how I would prefer to do it, but that doesn't seem possible at

> the moment. So, are there any alternative solutions that work?

>

>

>

> --

> Sent from:

http://forum.openscad.org/>

> _______________________________________________

> OpenSCAD mailing list

>

[hidden email]
>

http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org_______________________________________________

OpenSCAD mailing list

[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org