telling a story in component shapes (CSG?)

Started by samdavo, May 03, 2013, 04:33:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

samdavo

so... Phil tells me it's all about Boolean additions, subtractions, and intersects etc.

So I Google it and find CSG.
wow - how good is this story (written in Egyptian / Boolean hieroglyphics )  :)
Now to do what it says ... (ok it's a challenge)...

PS note the little smiley mouths, and sad mouths, and minus signs.
PPS not sure why the smiley mouth isn't a simple "+" ??

samdavo

PS here's the web address for all the clues required ...

https://en.wikipedia.org/wiki/Constructive_solid_geometry
...

Quote from: Wikipedia
Workings of CSG

The simplest solid objects used for the representation are called primitives. Typically they are the objects of simple shape: cuboids, cylinders, prisms, pyramids, spheres, cones. The set of allowable primitives is limited by each software package. Some software packages allow CSG on curved objects while other packages do not.

It is said that an object is constructed from primitives by means of allowable operations, which are typically Boolean operations on sets: union, intersection and difference.

A primitive can typically be described by a procedure which accepts some number of parameters; for example, a sphere may be described by the coordinates of its center point, along with a radius value. These primitives can be combined into compound objects using operations like these:

samdavo

I'm gonna agree with one thing in those sketches ( even before trying it) :)
and that is that they have used different colours for the components !!! -
and hence easy to see what component caused which surface in the final result. - 2 cents

samdavo

sorry gents, couldn't help accepting the challenge - probably whilst most of you slept :)
sam

samdavo

#4
PS the beauty of this flowchart is that it is easily modified.
Here for instance, is what you get if you make the green cylinders a bit smaller (2 cents) - i.e. it looks more like the Wiki version.

PS  Diameter of the green cylinders reduced from 70 to 60.
cube 100x100x100,
sphere 130 diam.
cheers

samdavo

ditto exported to sketchup ( although there are some bugs - some colours not showing, some parts not properly subtracted).

minstrel

#6
Quote from: samdavo on May 03, 2013, 07:41:17 AM
...although there are some bugs - some colours not showing, some parts not properly subtracted.

Yea, Sam, you are gonna get this from time to time.

For the most part you can freshen things up by reversing a few faces but, the subtract errors you are seeing are what I refer to as the 'Queen Mother' of all DCAD/Sketchup challenges, namely; z-fighting.  This is where two faces occupy the same space...and as best I can tell it is a result of the way DCAD triangulates and such.  Sometimes you can simply select the 'closed' face and delete it; most times not.

Prl has all the technical stuff as to the 'why'... as to 'how' to assure it doesn't happen...well, I'm still dealing with the 'Queen'.

Minstrel

ps-  nice to see you are having such fun with addition and subtraction...when you have time experiment with 'solid/segregate....and slap those results into a few arrays [ both normal and circular]....and before you do that don't forget your lessons in 'blocks' and add them to the mix...there's no end to what can be created ;)

...And finally, thank you, Sam, for sharing your 'diamond' macro...it's [they are] wonderful.  I hope all those who see your posts really take the time to digest them [try to, anyway] and that they also get swept up into the 'learning' experience...as you are!



samdavo

thanks minstrel
pleased you liked diamond4 / diabox4 :)
more research for me in countless directions, 
or like number 5 used to say ...
"Input!  Input!  Input!  More input!...."
cheers m8

Dr PR

Sam,

The "smiley and sad mouths" are Boolean algebra Union (AND, conjunction) and Intersection (OR, disjunction) dating back about 150 years. Because typewriters, Teletypes and subsequent printers don't have the correct symbols, these are sometimes written as "v" and "^".

Phil
DesignCAD user since 1987

samdavo

Phil, you are a great source of knowledge, thanks.
and sounds like I've made another Boo(lean)-Boo(lean).
cheers

samdavo

#10
Minstrel -
This really involves Sketchup,  (and you might be the only one who reads this but ... two things:-

1. You will see that I altered the flowchart, - This shows how the flowchart works, hence thread-relevant.  And my modifications to the procedure are evident from the flowchart.

2. And this time I get the correct final shape at least with holes in all faces ( i.e. get around the z-fighting).  But two of the three blue sphere(s) still don't want to show in colour - no biggie, at least the final one shows in colour.  :)
cheers

PS  As for Z-fighting, I'm reminded of the joke ...  the little cub scout sees the nun trying to cross the road, and offers to help.  They make it across, and the nun is really thankful.  "That's ok lady, any friend of Zorro's is a friend of mine" - oldie and not a particularly goodie lol. cheers

prl

#11
Sam, here is my version.  In the attached file there is a self-contained movie. After you unzip the file, you double click the executable to watch. 

The action packed movie follows this sequence.

First I toggle on various layers so you can see the various solids, then

Isolate the green cylinders and solid add them together,
Isolate the blue sphere and red cube and intersect them,
Subtract the green cylinders from the intersection.


The attached file has two versions of the initial assembly.  The blocked one is for exporting to SU in case you want to do the solid operations there.  I never have any luck sending DesignCAD entities with internal holes in them to SU, so I let SU do the openings.  Also the reason for sending blocks is that DesignCAD blocks are SU solids.

The second assembly in the file is/are DesignCAD solids.  I used these for the screen movie.

Edit:  I just realized I name everything CGS when it should be CSG.  Apparently I have Centroid Gravity Snap rolling around in my mind . . .  :)

samdavo

#12
prl
just watching that video ( thanks heaps btw) - more time required  to study the details but..
I notice that you add one green cyl to the second, then the third to the sum of the others.   Now, that's what I did too lol (because I was following the flowchart "recipe"  - but I found myself asking , is that the only way it can be done, i.e. not possible to add three in one fowl swoop,  of foul swoop, or fell swoop, or whatever.

prl

#13
Quote from: samdavo on May 04, 2013, 02:48:45 AM
but I found myself asking , is that the only it can be done, i.e. not possible to add three in one fowl swoop,  of foul swoop, or fell swoop, or whatever.

In DC you will need to add them together one at a time. Many programs are kind of dumb like that.  TurboCAD, AutoCAD come to mind.  I think SU will let me do them all in one swoop.


Edit:  I decided to do the same movie in SU.  Yes, I can add all the green cylinders at one time.  Movie file attached.

samdavo

#14
wow - impressive or what !!. (your skills with SU that is)

meanwhile , I checked out another way to say this:-
http://en.wikipedia.org/wiki/Logical_disjunction
the finished shape = (rB^bS)-(gC1+gC2+gC3)
where
rB = red BOX
^ = Solid Intersect, alias (common to both), alias disjunction
bS = blue SPHERE
gC1= green CYLINDER 1
gC2= green CYLINDER 2
gC3= green CYLINDER 3

But to be honest, if I were going to set this up for making a certain shape of steel plate, I would happily do the longhand version (reply #3 refers) - and I could twig a few dimensions, and proceed through to completion of the amended component.

The beauty of that would be that the steps of eg several steel plate designs are recorded in the DCAD file - and you don't have to remember them all.

Incidentally, one of the plus-es of Solidworks is that there is or can be a "Design Table" in the background, which is an Excel spreadsheet.  And you go in there, change a few numbers, and not only the drawing is immediately amended, but also the drawings ( paperspace etc - including views, details, sections) are likewise pretty much finished - possibly a few twigs here and there.

BUT - for all that , lol, I don't particularly like Solidworks (putting it mildly), and I find I use far fewer swearwords when using DCAD :) :)   Life's too short for that sort of dependency on swearwords to get drawings done :)

Edit  -  Back to that "longhand method in reply #3 - heck, maybe I could even use Minstrel's blocks, lol, - where you change the original ( primitive leaves of the "CSG tree") - and the "combined" levels of the tree change semi-automatically - BUT that wouldn't apply to manipulated ( Boolean additions, subtractions and Intersects) i.e.  I suspect that a block can't be "solid intersected" for instance, without exploding that particular block - more research yet again :) )
cheers

PS The finished shape that "fooled" the z-fighting Sketchup was
  (rB^bS-gC3)-(gC1+gC2) ,
but again, I doubt that I will use these equations again lol.