Very true,
I’ll look over it during the holiday break over the next few days and see what it’s all about. Hopefully it contains the abilities to instance as I’m eventually going to add the option for geo to be copies or instances of the reference pipes. I’m going to implement a preview option as well which will be nice.
This is a fun little project to do, which can easily turn into something bigger.
i’m trying to play with every idea on this forum, and almost every one sooner or later comes to me and helps me in one of my tasks.
Any thread with John and Denis going on about anything is… strangely… sensual…
Next on the agenda for me is the preview and then the selecting of last most child’.
Selecting children
If a useR selects a part of the pipes that has branched out into a single pipe, then ‘select children’ will only get the last most child of that system. If the user clicks the first object within the entire system then it will cycle through all children until it finds all the ends. An example
Say you had a wrist with 5 fingers. If the user selects the wrist and hits select ends it will then select the end nodes for each finger ‘appendage’. If a user selects part of the index and pinky finger and hits ‘select ends it then will only cycle through tho use children and get the ends. The result being only the pink and the index ends.
The preview I’m still trying to think about.
So here is what I’ve got so far for collecting the end child no matter where you select in the hierarchy. It only works it’s way down from where you have selected. I find it more useful this way.
I’m sure there may be a better more efficient way of writing this so I’m looking forward to what people may have as improvements. I’m going to look into a better way of writing it as well, but until then I figured I would share the goods.
Get End Child From Selected Point In Hierarchy (works with multiple selections)
fn getEnds node &arr:#() =
(
for c in node.children do
(
append arr c
getEnds c arr:arr
)
arr
)
endCaps = #()
for o in selection do (for c in (getEnds o arr:(selection as array)) where c.children.count == 0 do append endCaps c)
endCaps.wirecolor = random black white
don’t do multiple loops if you can do the job in one:
mapped fn getEndChildren1 node ends:#() root:on = if not isvalidnode node then ends else
(
if root or node.children.count > 0 then for child in node.children do getEndChildren child ends:ends root:off
else appendifunique ends node
ends
)
-- examples
(
getEndChildren objects[1]
)
-- or
(
a = #()
getEndChildren selection ends:a
a
)
-- or
(
a = #()
getEndChildren (helpers as array) ends:a
a
)
also it’s good to collect only unique nodes.
I’ve also got a snippet for rotating an object around it’s local axis which will come into play with the pipes generator for sure.
for o in selection do o.transform = (rotateZmatrix 90) * o.transform
Very impressive, my idea is to keep it open the script for the users
and to give the ability to load there own library (custom geometry)…
Like parts of the road or parts of the plant etc. (check the drawing No 1 + 2).
About the pipes is a good idea the users to have the ability to slice
the pipe and to can visualize the section.(check the drawing No 3).
More advance is to can use after in real flow to can visualize the
flow of the water in the section of the pipes.
Thanks in advance.
Been making notes on a future pipe-generator myself, mainly for doing ventilation pipes along or on top of buildings. Four of the things I wanted to do was:
- Check if next segment would collide with something, make a turn well before it intersects. Make the turn follow the direction of the object surface.
- Do intersections tests for each segment to make sure the pipe stays parallel to the collision object surface.
- Create connection objects towards the surface, which would be pipe-segments with connection geometry.
- If the collision surface ends, “punctuate” the curve with another custom object – for ventilation that would be a air conditioning type box.
i added optional the <root> argument for collecting or not collecting root objects if they don’t have children.
Hey guys these are all great ideas. Based on the way my tool is built users have the ability to build and use an custom pipes they want to now. I’m working on adding more controls. This will make for a very universal tool.