Wood Cherry Original
-
There is one wood,
[Wood_Cherry_Original]
, that is a nice hardwood suitable for furniture making. I've written a little Woodworker Tip.It uses
[Wood_Cherry_Original]
and edits in lighter and darker shades to make a selection of cabinet woods.I'd like to write a little Ruby that creates these extra woods, but every time I get near this project I meet Bug Splats. Known issue: if you assign
[Wood_Cherry_Original]
to some geometry, that geometry takes the material but[Wood_Cherry_Original]
is not added to the materials list. You are near Bug Splat. -
The actual code that causes the BugSplat is relevant. May we see it?
-
@martinrinehart said:
There is one wood,
[Wood_Cherry_Original]
, that is a nice hardwood suitable for furniture making. I've written a little Woodworker Tip.
It uses[Wood_Cherry_Original]
and edits in lighter and darker shades to make a selection of cabinet woods.
I'd like to write a little Ruby that creates these extra woods, but every time I get near this project I meet Bug Splats. Known issue: if you assign[Wood_Cherry_Original]
to some geometry, that geometry takes the material but[Wood_Cherry_Original]
is not added to the materials list. You are near Bug Splat.You can't save material/texture skm's externally [yet], though you can save the texture image to file [texture_writer].
To set a material to an external skm is also not scriptable, but again you can add a material by name, then manipulate its color etc and add a texture image.
Until a skm-importer arrives... a work around to effectively 'import a skm', is to have previously made a face with the required material and save that as a small skp file.
Then in the main model use the import method to add this skp as a component, the desired material will come in with it. Get a reference to the definition's face material, and get it's name - on import material names can change with [] <> etc... , erase any instance and all of the imported skp's entities [within a start/commit block] and the skp-component disappears from the browser list... You now have a pointer to the desired material and its name within the main model...
Cloning a material internally within a model requires you to do some convoluted work - see mymaterial-name=.rb
[ http://forums.sketchucation.com/viewtopic.php?p=167219#p167219 ] for ideas on this - with my script because it is not possible to rename an existing material, my method does it by taking the material and 'cloning' it with all the same details and a new name - the original is then deleted... to just clone the material simply make the copy and don't delete the old one... -
@jim said:
The actual code that causes the BugSplat is relevant. May we see it?
Not likely to get back there anytime soon. Materials have been so uncooperative that I've banned them from the Ruby portion of my tutorial.
@tig said:
a work around to effectively 'import a skm', is to have previously made a face with the required material and save that as a small skp file.
Then in the main model use the import method to add this skp as a component, the desired material will come in with it.TIG, you have my undying affection for all the great information you provide! This, however, sounds a lot like a "you can't" answer to "I'd like to write a little Ruby..."
Advertisement