XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Hole-n-mold ... How to use BoolObj ...

12-10-2010, 08:23 PM
the title says all...

fn projectedBoolean nodes:(selection as array) operation:#mold =
fn makeResetScaleMatrix3 tm = (translate (rotate (scale (matrix3 1) [1,1,1]) tm.rotation) tm.translation)

if nodes.count == 2 do
local hole = nodes[1]
local mesh = nodes[2]
if not canconvertto hole SplineShape do swap hole mesh
if canconvertto hole SplineShape and iskindof mesh GeometryClass do
action = case operation of
#mold: 2
#hole: 3
default: operation

hole2 = copy hole wirecolor:mesh.wirecolor
convertToSplineShape hole2
mesh2 = copy mesh wirecolor:hole2.wirecolor
select #(hole2, mesh2)

act = on
for k=1 to (numSplines hole2) while act do
close hole2 k
act = isClosed hole2 k
if act do
tm = makeResetScaleMatrix3 hole2.transform
bb = nodeGetBoundingBox mesh tm
addmodifier hole2 (extrude amount:(bb[2].z*1.2) capEnd:on capStart:on)
if (intersectRay mesh2 (ray tm[4] tm[3])) == undefined do
bb = nodeGetBoundingBox mesh (prerotateX tm 180)
hole2.extrude.amount = -(bb[2].z*1.2)
addmodifier hole2 (cap_holes())

if intersects hole2 mesh2 do
boolObj.createBooleanObject mesh2
boolObj.setBoolOp mesh2 action
boolObj.setBoolCutType mesh2 2
boolObj.SetOperandB mesh2 hole2 4 2
converttopoly mesh2
instanceReplace mesh mesh2
delete mesh2
setCommandPanelTaskMode mode:#create
delete objects
p1 = plane width:200 length:50 lengthsegs:20 widthsegs:80 pos:[0,0,0] wirecolor:orange
rotate p1 (angleaxis 25 [1,0,0])
addModifier p1 (Noisemodifier strength:[20,20,20] fractal:on)
p2 = copy p1 pos:[0,0,-3] wirecolor:yellow
t = text text:"denisT" size:50 pos:[0,-15,15] wirecolor:brown
projectedBoolean nodes:#(p1,t) operation:#mold
projectedBoolean nodes:#(p2,t) operation:#hole

12-11-2010, 06:09 AM
Thank you,

Very good denis T, I've filed it away for future use.

12-12-2010, 02:04 AM
Very cool :D

CGTalk Moderation
12-12-2010, 02:04 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.