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.
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.
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?
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.
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.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register