Custom or bought 3rd Party Add-Ons?How does one go about adding "addons" within addon manager?
custom and third partyCustom or bought 3rd Party Add-Ons?
I have followed the links you posted and have a good understanding now of what the addon manager can do! My nest question is I have found that Blender "open source" handles alibre models quite well. Having said that I would like to have blender ope as does Keyshot when you select "render" within Alibre.Custom or bought 3rd Party Add-Ons?
Well, v25 (in Beta right now) has the ability to export models as an .obj and .mtl file for direct import into Blender (See New v25 OBJ Export). An Add-On just needs to be a simple single button that calls the export function (that's if Alibre have included it in the API ??), then start a Blender shell process passing the exported file names as Blenders input command line arguments.I have followed the links you posted and have a good understanding now of what the addon manager can do! My nest question is I have found that Blender "open source" handles alibre models quite well. Having said that I would like to have blender ope as does Keyshot when you select "render" within Alib
switch (e.Session.SessionType)
{
case ADObjectSubType.AD_PART:
case ADObjectSubType.AD_ASSEMBLY:
IADDesignSession ds = e.Session as IADDesignSession;
string directory = @"D:\sandbox_alibre\"; // TODO : make a temporary sub-directory named after the part/assembly name.
string name = "test"; // ds.Name;
// TODO : Sanitise 'name' to make it filepath friendly!
// check if Alibre is
if (m_VersionMajor >= BLENDER_MIN_MAJOR_VERSION) // BLENDER_MIN_MAJOR_VERSION needs setting to 25 and AlibreX.dll needs to be from v25
{
// Export the OBJ file
//ds.ExportOBJ(directory + name + ".obj"); // TODO : Need v25 to get the API syntax
// Export the MTL file
//ds.ExportMTL(directory + name + ".mtl"); // TODO : Need v25 to get the API syntax
// Create the Blender python script
StringBuilder sb = new StringBuilder();
sb.AppendLine("import bpy");
sb.AppendLine("");
//sb.AppendLine("name = 'test'"); // TODO : determine 'name' from obj file in the same directory as this script
//sb.AppendLine("");
sb.AppendLine("# Import OBJ");
sb.AppendLine("bpy.ops.import_scene.obj( filepath = '" + directory.Replace("\\", "\\\\") + name + ".obj' )");
// Save python script to same direcrtory as OBJ and MTL files
using (StreamWriter writer = new StreamWriter(directory + "import_from_alibre.py"))
{
writer.Write(sb.ToString());
}
// Open Blender and run the python script to import the OBJ file
Process p = new Process();
p.StartInfo.FileName = m_BlenderShellOpenCommand.Replace("\"", "").Replace("%1", "").Trim();
p.StartInfo.Arguments = "--python \"" + directory + "import_from_alibre.py\"";
p.Start();
}
break;
default:
Debug.WriteLine("ExportBlender : Session type '" + e.Session.SessionType + "' not supported!");
break;
}