Can't work this one out:
LukeR.importer
C;/Program Files/Google/Google SketchUp 8/Plugins/component_import.rb;21; warning; Could not create Image for P;/02 General/Resource Library/People/JPEG/JPEG.jpg
Error; #<NoMethodError; undefined method `explode' for nil;NilClass>
C;/Program Files/Google/Google SketchUp 8/Plugins/component_import.rb;22
C;/Program Files/Google/Google SketchUp 8/Plugins/component_import.rb;15;in `each'
C;/Program Files/Google/Google SketchUp 8/Plugins/component_import.rb;15;in `importer'
(eval);0
module LukeR
def self.importer()
### PURGE UNUSED COMPONENTS
Sketchup.active_model.definitions.purge_unused
### SETUP LIST OF NAMES
model=Sketchup.active_model
defs=model.definitions
cnames=[]
defs.each{|d|cnames << d.name}
cnames.sort!
f='P;\02 General\Resource Library\People\JPEG'
cnames.each{|name|
d=defs[name]
bb=Geom;;BoundingBox.new
d.entities.each{|e|bb.add(e.bounds)}
### ADD IMAGE TEXTURES
img=d.entities.add_image(File.join(f, File.basename(f, ".*")+".jpg"), [-1.mm,-1.mm,0], bb.width+2.mm, bb.height+2.mm)
img.explode
togos=[]
d.entities.each{|e|togos << e if e.valid? and e.is_a?(Sketchup;;Edge) and e.faces.length<2}
d.entities.erase_entities(togos)
d.entities.each{|e|e.reverse! if e.is_a?(Sketchup;;Face) && e.normal!=Z_AXIS}
### STAND COMPONENT CONTENTS TO VERTICAL
tr=Geom;;Transformation.rotation(ORIGIN, X_AXIS, -90.degrees)
d.entities.transform_entities(tr, d.entities.to_a)
}
### FACE ME
cnames.each{|name|
defs[name].save_as(File.join(f, File.basename(f, ".*")+".skp"))
}
### REMOVE OUTER EDGE LEFT FROM EXPLODED IMAGE
img.explode
togos=[]
d.entities.each{|e|togos << e if e.valid? and e.is_a?(Sketchup;;Edge) and e.faces.length<2}
d.entities.erase_entities(togos)
### REMOVE HOLES
faces=[]
d.entities.each{|e|faces << e if e.is_a?(Sketchup;;Face)}
(faces.length-1).times{
for face in faces
if face.valid?
for edgeuse in face.outer_loop.edgeuses
if not edgeuse.partners[0] ### outermost face
faces = faces - [face]
loops = face.loops
for loop in loops
for fac in faces
if fac.valid? and (fac.outer_loop.edges - loop.edges) == []
faces = faces - [fac]
fac.erase! if fac.valid?
### fac abutts kept face so it must be erased...
end #if fac
end #for fac
end #for loop
end #if outermost
end #for edgeuse
end #if valid
end #for face
}#times
end
end