(c) TIG 2009-2013 ***in parts***
Note: Based on Jim Foltz's 'obj_import.rb'* AND with Whaat's UVW texture mapping ideas... Many thanks!
BUT it's now with added materials with opacity/texture, also units
setting and YZ axes swap dialogs.
On running it a dialog asks you to select units [pick from list] the
file uses any 'units' in the .obj's header as the default value,
if not then default=Inches.
The vt info in the .obj file is used for UVW texture mapping.
There's a warning in the console if .obj's .mtl or any texture files
If the .mtl is missing or incomplete the #default material# is used.
If a texture file is missing the material's colour/opacity is used.
The zoom goes to extents at the end.
A closing dialog asks if you want to swap the YZ axes - Yes/No reply -
some .obj files are created flipped like that... so if the import
appears flipped over Yes will right it...
The 'swap YZ axes' has a one step undo.
The imported materials and geometry in the OBJ groups is only undoable
in multi-steps - instead simply erase the OBJ imported groups
and delete any new materials...
*** IT CAN TAKE A _L_O_N_G_ TIME TO LOAD A BIG OBJ FILE
WITH PERHAPS MANY THOUSANDS OF FACES ***
[perhaps >> 1 minute per Mb ?]
Sometimes very complex OBJ shapes don't receive their textures at all.
Some OBJ files have tiny numbers: then faces might not be created:
if so, retry with larger 'units', you can scale group(s) down afterwards.
Some OBJ files have tiny face planar discrepancies: then some faces
might get triangulated to compensate: if so, retry with smaller 'units'
and scale group(s) up afterwards.
Some complex files might need a bit of manual healing: they can also
have erroneous vertices - so it's recommended you use 'Fix Problems'
accessed from the 'Model Info > Statistics' dialog -
especially if the result takes a long time to process or
have divided faces forced to form geometry or if it feels jittery
when orbiting around the model etc...
Some complex files with excessive smoothing etc might fail to import.
View textured results in 'Monochrome' to see any reversed faces...
1. Menu > Plugins > OBJ Importer > Import OBJ [with Textures]
2. > Import OBJ [no Materials]
3. > Import OBJ [as Mesh]
Option 1. Imports faces with mapped textures.
Option 2. Imports faces without materials [but materials added to model].
Option 3. Imports a mesh without materials [but materials added to model].
Open the Ruby Console before running to see additional reporting...
1.0 20090714 First release.
1.1 20090715 Existing Materials re-used/make variant option added.
Swap Y & Z axes ? Yes/No, option added.
1.2 20090723 Name changed to 'obj_importer.rb' / 'Import OBJ'
Proper UV texture mapping added.
Added dialog geometry & texture mapping Units.
1.3 20090728 Submenu added with '..no Materials' and '...as Mesh'
options. Material/usemtl duplicated entries trapped.
Failure to import geometry - warning message added.
Scaling errors corrected.
Model.start_action()...commit_action removed as it was
causing errors on complex files.
1.4 20100406 Different format obj file text now accepted.
1.5 20100816 Missing group in obj trapped [with "g OBJ"].
1.6 20100825 Negative face indices allowed.
1.7 20100825 Fill from mesh changes.
1.8 20100825 Trapped for spaces in image-names/paths.
1.9 20110223 Errors with occasional reversed faces resolved.
2.0 20130321 Blender-quads now import as two tri-facets.
The OBJ file must contain header-text "# Blender" or similar.
2.1 20131118 Import of OBJ files using a -ve counter for f vertices within
sub-groups fixed. View now refreshes with each group completion.
Download from the SketchUcation Plugin Store or AutoInstall using the toolset within SketchUp itself http://sketchucation.com/resources/plug ... e-download