Hi Everyone-
I've used Python for a while and I understand the basic concepts of OOP, but
I'm new to .NET and C#. I'm trying to automate a 3D CAD package called
Alibre so I can generate 300+ assemblies and export them to an industry
standard format. I've been looking through their C# sample code for two days
now and I understand most of it, I can translate a good portion of it,
(IronPython in Action arrived three days ago :), but there is on line in
particular that I can't figure out.
Here's a snippet of the C# example file. I can post the whole thing if
needed. //# starts comments I've added in.
.....
using AlibreX
.....
private void btnBrowse_Click(object sender, EventArgs e)
{
IADSession objSession; //Holds Alibre Session
Object
IADDesignSession designSession; //Holds Alibre Design
Session object
IADPhysicalProperties designProps; //Holds Physical
Properties object
.....
OpenFileDialog ofd = new OpenFileDialog(); //# Opens a dialog
box so you can enter the name of an existing part file.
ofd.Title = "Select File";
ofd.Filter = "Alibre Part|*.AD_PRT";
if (ofd.ShowDialog() == DialogResult.OK)
{
txtFilePath.Text = ofd.FileName;
if (rootObj == null) //# rootObj is the Root Object for
controlling Alibre Design
{
OpenAlibre(); //Call to method which checks to see if
there is running instance of Alibre Design
//# This method, defined further
down in the file, attaches to a running instance of the program, or starts a
new instance.
//# In either case, rootObj is
created and attached to it.
}
objSession = rootObj.OpenFile(txtFilePath.Text); //#
Creates an instance of IADSession from the rootObj
if (objSession.SessionType == ADObjectSubType.AD_PART) //#
As long as the Session is attached to a part...
{
//# THIS IS THE LINE I CAN'T TRANSLATE!!!
designSession =
(IADDesignSession)objSession; //Set Design Session Object to
be the Session you opened
//# I think it's creating an instance of IADDesignSession
based on the objSession (see code line below) and I can't figure out how to
do it.
//# designSession = objSession obviously leaves me two
references to the same Session Object.
//# I've done dir(objSession) and I don't see a method to
create a DesignSession instance.
//# Any ideas??
designProps =
designSession.PhysicalProperties(ADAccuracySetting.AD_HIGH); //Set Design
Properties object with the Physical Properties of the Part
.....
Thanks in Advance
Dave
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com