@kyleborot
Hi,
I did a little testing in AlibreScript in an effort to find out what might be possible there..
The following was just a test script to find out if is possible to open a Sheet Metal Part using AlibreScript:
Python:
import fnmatch
import os
from os.path import expanduser
Win = Windows()
ScriptName = 'Sheet metal part into'
Options = []
Options.append(['Source file', WindowsInputTypes.File, expanduser('~'), 'Choose the sheet metal part to open'])
Values = Win.OptionsDialog(ScriptName, Options, 300)
if Values == None:
sys.exit()
SM = Values[0]
Folder = os.path.dirname(os.path.abspath(SM))
FileName = os.path.basename(SM)
P = Part(Folder, FileName)
The script (which has to be run from a part editor window) will open a .AD_PRT file in the editor but any attempt to open a .AD_SMP file returns an exception.
A little digging into the AlibreScript code reveals this:
C#:
public Part(string Folder, string Name)
: this(Folder, Name, false)
{
}
public Part(string Folder, string Name, bool HideEditor)
{
if (!Folder.EndsWith("\\"))
Folder += "\\";
Name = Path.GetFileNameWithoutExtension(Name);
string str = Folder + Name + ".AD_PRT";
this._Part = this.GetOpenedPart(str);
if (this._Part == null)
{
if (!File.Exists(str))
throw new Exception(string.Format(\u0023cf.\u0023qWb("The file '{0}' cannot be found."), (object) str));
this._Part = (IADPartSession) Global.Root.OpenFileEx(str, !HideEditor);
}
this.GetReferenceGeometry();
}
In the above code, there is a line to explicitly force the passed file to have the extension .AD_PRT
So it seems like the author really does not want .AD_SMP files opened with the scripting API!
There is some more flexibility if you write a routine using C# but as I noted before, the AlibeX API does not have the getArea() method.
To give you some idea of the data accessible using C#, you might take a look at my UtilitiesForAlibre Add-On. This includes a Property Viewer that allows you to dig into the structure of a loaded file.
You can download the latest release of the Add-on from the resources section:
UtilitiesForAlibre
I've never really done much with Sheet Metal Parts. If I get chance I'll dig in a little further and try to find out if what you want may be possible.
David