iLogic Shrinkwrap Substitute causes error for only some files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
This is my first time posting anything to the forums, so please be gentle (coder noob)! I'm running into a weird issue when it comes to creating a Shrinkwrap Substitute in iLogic. Basing my code pretty much exactly from VBA help (no funny business or anything):
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition oDef = oDoc.ComponentDefinition ' Create a new part document that will be the shrinkwrap substitute Dim oPartDoc As PartDocument oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, , False) Dim oPartDef As PartComponentDefinition oPartDef = oPartDoc.ComponentDefinition Dim oDerivedAssemblyDef As DerivedAssemblyDefinition oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(oDoc.FullDocumentName) ' Set various shrinkwrap related options oDerivedAssemblyDef.DeriveStyle = kDeriveAsSingleBodyNoSeams oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = kDerivedIncludeAll oDerivedAssemblyDef.IncludeAllTopLevelSketches = kDerivedIncludeAll oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions = kDerivedExcludeAll oDerivedAssemblyDef.IncludeAllTopLevelParameters = kDerivedExcludeAll oDerivedAssemblyDef.ReducedMemoryMode = True Call oDerivedAssemblyDef.SetHolePatchingOptions(kDerivedPatchAll) Call oDerivedAssemblyDef.SetRemoveByVisibilityOptions(kDerivedRemovePartsAndFaces, 25) ' Create the shrinkwrap component Dim oDerivedAssembly As DerivedAssemblyComponent oDerivedAssembly = oPartDef.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef) ' Save the part Dim strSubstituteFileName As String strSubstituteFileName = Left$(oDoc.FullFileName, Len(oDoc.FullFileName) - 4) strSubstituteFileName = strSubstituteFileName & "_ShrinkwrapSubstitute.ipt" ThisApplication.SilentOperation = True Call oPartDoc.SaveAs(strSubstituteFileName, False) ThisApplication.SilentOperation = False ' Create a substitute level of detail using the shrinkwrap part. Dim oSubstituteLOD As LevelOfDetailRepresentation oSubstituteLOD = oDef.RepresentationsManager.LevelOfDetailRepresentations.AddSubstitute(strSubstituteFileName) ' Release reference of the invisibly opened part document. oPartDoc.ReleaseReference
This code works fine and dandy for about 90% of the files I'm working with. But for some reason, I am getting an error on certain files.
Error shown when creating shrinkwrap sub manually:
Error shown when creating shrinkwrap sub through iLogic:
Now when doing this Shrinkwrap manually, I can simply hit the handy dandy "accept" button and continue working with my file....is there a way I could do this in iLogic as well?
Not sure if this is allowed or not but here's the link to one of the .stp files I'm using that is causing the issue.
https://drive.google.com/file/d/1zziK5iAzys2I0R4eZQJsaJ50WODc3zcA/view?usp=sharing
Using Inventor Professional 2021 on Win10.
Thanks in advance!