Inventor Customization

Inventor Customization

Reply
Member
mdevonb
Posts: 3
Registered: ‎10-19-2012
Message 1 of 6 (471 Views)

Assembly Features in Inventor 2012 API

471 Views, 5 Replies
10-19-2012 11:53 AM

Is the modification of weldment features in an assembly document supported in Inventor 2012's API? Considering the E_NOTIMPL message after trying a few methods, I assume it isn't.

 

Going off that, is there a good way to copy the ExtrudeDefinition and to assign a new Profile? Running the Copy method, and trying to alter the profile of that fails in a similar manner to working on the original. And looking from the object browser I can't seem to find a way to get enough information out of the Extent properties to clone it.

 

Since I'm not doing anything complicated, I can get everything working if I just fudge what it should be into the definition, but my inner perfectionist (and the part of me that doesn't ever want to touch this again) wants to scream if I do that.

 

Thanks for taking the time to read this, and I'll apologize in advance if there isn't enough information.

Employee
yuhanzhang
Posts: 480
Registered: ‎01-06-2009
Message 2 of 6 (462 Views)

Re: Assembly Features in Inventor 2012 API

10-22-2012 01:42 AM in reply to: mdevonb

Have you a VBA code sample to explain what you are going to do?



Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.

Member
mdevonb
Posts: 3
Registered: ‎10-19-2012
Message 3 of 6 (455 Views)

Re: Assembly Features in Inventor 2012 API

10-22-2012 06:06 AM in reply to: mdevonb

Well, just as a quick bit of untested C# code ( I could spend the few minutes to rewrite it in VBA if you need )

ExtrudeFeature EF = weldComponentDefinition.Features["Extrude Test"];
EF.Definition.Profile = MagicProfileGenerationFunction();

 Would throw an E_NOTIMPL on the second line.

 

ExtrudeFeature EF = weldComponentDefinition.Features["Extrude Test"];
ExtrudeDefinition ED = EF.Definition.Copy();
ED.Profile = MagicProfileGenerationFunction();
EF.Definition = ED;

Line 4 of this also throws E_NOTIMPL. I remember a test I was doing on Friday throwing E_NOTIMPL on Line 3, but it's not happening today for whatever reason. So, now just deleting the ExtrudeFeature and creating a new one works fine.

 

As for the cloning, it seems I just didn't look hard enough. I looked at the PartFeatureExtents class, and didn't notice any derived classes.

 

Thank you for your response though. If you know of any way to do the above without having to create a new ExtrudeFeature, I would greatly appreciate being told, if there isn't feel free to forget about the thread.

Employee
yuhanzhang
Posts: 480
Registered: ‎01-06-2009
Message 4 of 6 (449 Views)

Re: Assembly Features in Inventor 2012 API

10-23-2012 02:27 AM in reply to: mdevonb

Maybe I need your data to learn which profile you are going to change for the extrude feature definition. But before asking for the data, can you make sure in UI when you edit the extrude feature you are able to change its profile to the one you specified in the MagicProfileGenerationFunction? I mean is that the profile you want to change to is from the same sketch as the current extrusion profile?



Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.

Member
mdevonb
Posts: 3
Registered: ‎10-19-2012
Message 5 of 6 (442 Views)

Re: Assembly Features in Inventor 2012 API

10-23-2012 05:55 AM in reply to: yuhanzhang

Based on your response, modifying the profile of an assembly feature is implemented in IV2012's API then?

 

Back to what you asked, profiles are on the same sketch, and using the UI to change it works perfectly. Modifying the code to work on a part file, rather than an assembly, also works.

 

And I'm attaching a ZIP with a sample IPT, IAM and code in both C# and VBA. Code should swap between the 2.54CM profile and the 5.08CM profile for extrusion TX, based on the triangles in sketch TS. Both throw E_NOTIMPL when trying to assign the profile.

Employee
yuhanzhang
Posts: 480
Registered: ‎01-06-2009
Message 6 of 6 (433 Views)

Re: Assembly Features in Inventor 2012 API

10-23-2012 08:25 PM in reply to: mdevonb

I double checked this function in assembly/weldment, and confirmed this is not implemented yet. I will file this issue with number 1477509, you can track its status with providing this number to us.

 

Sorry for any inconvenience.



Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.