Message 1 of 6
Using the shrinkwrap API causes Inventor to crash when run in Forge

Not applicable
04-27-2021
10:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I have created an Inventor addin in C#. The addin is bundled as an AppBundle and is executed using Forge. Apologies if I'm in the wrong forum, but I didn't see a Forge option.
When the addin uses the shrinkwrap API, I get:
[04/28/2021 05:32:40] End Inventor Core Engine standard output dump.
[04/28/2021 05:32:40] Error: InventorCoreConsole.exe found crash.
[04/28/2021 05:32:40] Error: Reading DUMP file:
[04/28/2021 05:32:40] Error: 2021-04-28 05:32:38 GDI_Objects 23 USEROBJECTS 7 GDIOBJECTSPEAK 25 USEROBJECTSPEAK 7 | SVxApp::CareForAllExceptions() (SVxApp.cpp L2866): |SEH exception caught while executing request!
stack = _NA_ _NA_ [NULL]
_NA_ UTxCERLog::LogCallStack [NULL]
_NA_ SVxApp::CanMigrateCustomSettings [NULL]
_NA_ VBAxApp::TerminateVBA [NULL]
_NA_ _C_specific_handler [NULL]
_NA_ _chkstk [NULL]
_NA_ RtlWalkFrameChain [NULL]
_NA_ KiUserExceptionDispatcher [NULL]
_NA_ PMxIFxPartFeature::SetState [NULL]
_NA_ PMxRootDANode::ApplyShrinkwrap [NULL]
_NA_ PMxSrvRootDANode::ApplyShrinkwrap [NULL]
_NA_ RDxDerivedAssembly::SimplificationSettings [NULL]
_NA_ RDxDerivedCopier::UpdateStructure [NULL]
_NA_ RDxDerivedAssembly::SimplificationSettings [NULL]
_NA_ RDxDerivedCopier::Compute [NULL]
_NA_ RDxDerivedAssembly::Compute [NULL]
_NA_ RDxFragment::DoComputeThisSet [NULL]
_NA_ RDxFragment::DoCompute [NULL]
_NA_ RDxFragment::ComputeMinimum [NULL]
_NA_ RDxPart::Update [NULL]
_NA_ RDxComponent::UpdateComponentActual [NULL]
_NA_ RDxComponent::UpdateComponent [NULL]
_NA_ RDxPart::UpdateComponent [NULL]
_NA_ RQxDerivedAssemblyRequest::_Execute [NULL]
_NA_ FWxChangeRequest::Execute [NULL]
_NA_ AMxProcessShrinkwrapRequest::CreateDoc [NULL]
_NA_ FWxChangeRequest::Execute [NULL]
_NA_ SVxApp::Destruct [NULL]
_NA_ SVxApp::TranscriptingOn [NULL]
_NA_ SVxApp::ProcessChangeRequest [NULL]
_NA_ FWxSceneDoc::ProcessChangeRequest [NULL]
_NA_ CRxDocument<PresentationDocument>::ProcessChangeRequest [NULL]
_NA_ CRxDocument<PresentationDocument>::OnReleaseReference [NULL]
_NA_ _NA_ [NULL]
_NA_ SetErrorInfo [NULL]
_NA_ DispCallFunc [NULL]
_NA_ VarNumFromParseNum [NULL]
_NA_ RxDispatch::Invoke [NULL]
_NA_ _NA_ [NULL]
_NA_ TranslateSecurityAttributes [NULL]
_NA_ TranslateSecurityAttributes [NULL]
_NA_ TranslateSecurityAttributes [NULL]
_NA_ TranslateSecurityAttributes [NULL]
_NA_ _NA_ [NULL]
_NA_ _NA_ [NULL]
_NA_ LogHelp_TerminateOnAssert [NULL]
_NA_ LogHelp_TerminateOnAssert [NULL]
_NA_ LogHelp_TerminateOnAssert [NULL]
_NA_ TranslateSecurityAttributes [NULL]
_NA_ TranslateSecurityAttributes [NULL]
_NA_ _NA_ [NULL]
_NA_ _NA_ [NULL]
_NA_ _NA_ [NULL]
_NA_ _NA_ [NULL]
_NA_ _NA_ [NULL]
2021-04-28 05:32:39 GDI_Objects 23 USEROBJECTS 7 GDIOBJECTSPEAK 25 USEROBJECTSPEAK 7 | DumpAndSend() (ErrorReporter.cpp L1465): |Inventor Crash log!
[04/28/2021 05:32:40] Error: API method ShrinkwrapComponents.Add caught an unhandled exception.
Memory may have been left in an inconsistent state.
[04/28/2021 05:32:40] Error: API method caught an unhandled exception. Memory may have been left in an inconsistent state.
The code looks like this:
private PartDocument Shrinkwrap(AssemblyDocument inputDoc)
{
var shrinkwrapDoc = NewPartDocument();
var shrinkwrapDef =
shrinkwrapDoc.ComponentDefinition.ReferenceComponents.ShrinkwrapComponents.CreateDefinition(
inputDoc.FullDocumentName);
var objectColl = _inventorServer.TransientObjects.CreateObjectCollection();
foreach (ComponentOccurrence occurrence in inputDoc.ComponentDefinition.Occurrences)
{
objectColl.Add(occurrence);
}
shrinkwrapDef.AdditionalIncludedOccurrences = objectColl;
shrinkwrapDef.RemoveInternalParts = true;
shrinkwrapDef.DeriveStyle = DerivedComponentStyleEnum.kDeriveAsSingleBodyWithSeams;
shrinkwrapDef.BreakLink = true;
LogTrace("Adding shrinkwrap definition to shrinkwrap components...");
shrinkwrapDoc.ComponentDefinition.ReferenceComponents.ShrinkwrapComponents.Add(shrinkwrapDef);
LogTrace("Done adding shrinkwrap definition to shrinkwrap components.");
return shrinkwrapDoc;
}
I can see the "Adding shrinkwrap definition" message in the Forge report, but not the "Done adding" message.
When I run the code locally in Inventor 2022, there is no error. In Forge using engine Autodesk.Inventor+2022, the error occurs. The error also occurs when I use Autodesk.Inventor+2021 as engine.
Any ideas?
Thanks,
Per