Hello All,
I am using some code from the June 2010 "Mod the machine" posted by Brian Erkins.
I keep getting an error in C# (express 2010), Please see attached screen dump.
I don't see any obvious difference in my code when compared to Brian's (in fact at one point I copied and pasted his code and still had the same error). Has something changed in the object model, or am i simply doing something stupid?
Please could someone give me some pointers. I am a newbie, trying to learn and am a little stumped with this so any assistance would be much appreciated.
Here is the code:
private void button1_Click(object sender, EventArgs e)
{
Inventor.Application invApp = null;
invApp = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
Inventor.Document doc = invApp.ActiveDocument;
Inventor.PropertySet customPropSet;
customPropSet = doc.PropertySets["Inventor User Defined Properties"];
.............
.............
Thanks Rob
Hi,
Sorry, I was a little rash replying just now. Actually the string of the property set name is correct. You are using its Display Name.
After checking the snapshot, I think the problem is no any document is opened. So ActiveDocument is null. Could you give a check?
Again, I suggest looking for propertyset by its internal name which is not localized.