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: 

Assembly Features in Inventor 2012 API

5 REPLIES 5
Reply
Message 1 of 6
mdevonb
958 Views, 5 Replies

Assembly Features in Inventor 2012 API

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.

5 REPLIES 5
Message 2 of 6
YuhanZhang
in reply to: mdevonb

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



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 6
mdevonb
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.

Message 4 of 6
YuhanZhang
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?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 5 of 6
mdevonb
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.

Message 6 of 6
YuhanZhang
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.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report