Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modifying custom Iproperties in C#

1 REPLY 1
Reply
Message 1 of 2
navbor
405 Views, 1 Reply

Modifying custom Iproperties in C#

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

Regards
Rob
-------------------------------------------
Windows 7 Pro (X64)
Intel(R) core (TM) i5-4690 CPU @ 3.50GHz
32.0 GB RAM
Nvidia Quadro K2000
Autodesk Inventor 2015 Professional Ultimate Design Suite
1 REPLY 1
Message 2 of 2
xiaodong_liang
in reply to: navbor

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. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report