I am having an issue with Inventor 2014 that I did not have with 2012 in relation to using ilogic to export sheet metal dxf parts from an Ilogic configured assembly.
Specifically the issue I am having is an intermittent error where the code cannot find a specific part and throws up the below message.
Error in rule: DXF, in document: IMPELLER.iam
Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
The steps leading to this are:-
1: Configuring the model using Ilogic to supress and un-suppressed required parts.
2: Once configured I fire the Ilogic rule to run the below code which looks through un-supressed sheet metal parts based on an Iproperty value and exports the flat pattern as a dxf file.
3: Occasionally (sometimes after several configuration changes) the dxf export rule will error stating the Member Not found Error.
The configurations are just swapping between 2 states so when an error finally occurs it is simply erroring on a configuration where it previously didn’t.
The simplest way to overcome this error seems to be saving the model assembly, close the assembly, re-open the assembly and re-run the dxf export rule.
The code as below it seems to be able to write a Part Number to the iproperties but then cannot find it to export the sheet metal.
Can anyone shed any light on why this may be? I have spent literally many days trying to diagnose the issue and find a consistent error pattern with no success.
DXF_LOC = ThisDoc.Path&"\IMPELLER_DXF\"
part_no = 1
DimasmDocAsAssemblyDocument
asmDoc = ThisApplication.ActiveDocument
DimasmDefAsAssemblyComponentDefinition
asmDef = asmDoc.ComponentDefinition
DimoCompAsInventor.ComponentOccurrence
ForEachoDocInThisApplication.ActiveDocument.AllReferencedDocuments
IfoDoc.DocumentType = kPartDocumentObjectThen
DimoFilenameAsString = IO.Path.GetFileName(oDoc.displayname)
oDocName = oDoc.Displayname
DimoIVDesignInfoAsPropertySet
oIVDesignInfo = oDoc.PropertySets.Item("Design Tracking Properties")
DimoIVDocSumInfoAsPropertySet
oIVDocSumInfo = oDoc.PropertySets.Item("Inventor Document Summary Information")
DimoIVSumInfoAsPropertySet
oIVSumInfo = oDoc.PropertySets.Item("Inventor Summary Information")
DimoIVCustomSetAsPropertySet
oIVCustomSet = oDoc.PropertySets.Item("Inventor User Defined Properties")
IfoIVSumInfo.item("Keywords").Value = "WIBBLE"Then
oIVSumInfo.item("Title").Value = oDocName
oIVDesignInfo.item("Part Number").Value = JOB_NUMBER&"I"&part_no
oIVDesignInfo.item("Stock Number").Value = " "
DimoCompDefAsComponentDefinition
oCompDef = oDoc.ComponentDefinition
IfoCompDef.HasFlatPattern = False Then
oCompDef.Unfold
oDoc.Save
oDoc.Close
EndIf
DimsOutAsString
sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_ROLL_TANGENT;IV_ARC_CENTERS"
DimsFnameAsString
sFname = DXF_LOC&iProperties.Value(oDocName ,"Project", "Part Number")&".dxf"
oCompDef.DataIO.WriteDataToFile(sOut, sFname)
part_no = part_no+ 1
Else
EndIf
EndIf
Next
Hi,
the "HasFlatPattern" property is valid only for the "SheetMetalComponentDefinition" and is not within a "PartDefinition" (tested on Inv.2013).
This is not your solution, but an useful information.
This is your cleaned-up code, please next time use this button to insert your code.
DXF_LOC = ThisDoc.Path & "\IMPELLER_DXF\" part_no = 1 Dim asmDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim asmDef As AssemblyComponentDefinition = asmDoc.ComponentDefinition For Each oDoc In asmDoc.AllReferencedDocuments If oDoc.DocumentType = kPartDocumentObject Then oDocName = oDoc.Displayname Dim oIVDesignInfo As PropertySet = oDoc.PropertySets.Item("Design Tracking Properties") Dim oIVDocSumInfo As PropertySet = oDoc.PropertySets.Item("Inventor Document Summary Information") Dim oIVSumInfo As PropertySet = oDoc.PropertySets.Item("Inventor Summary Information") Dim oIVCustomSet As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties") If oIVSumInfo.item("Keywords").Value = "WIBBLE" Then oIVSumInfo.item("Title").Value = oDocName oIVDesignInfo.item("Part Number").Value = JOB_NUMBER & "I" & part_no oIVDesignInfo.item("Stock Number").Value = " " Dim oCompDef As ComponentDefinition = oDoc.ComponentDefinition If oCompDef.HasFlatPattern = False Then oCompDef.Unfold oDoc.Save oDoc.Close End If Dim sOut As String sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_ROLL_TANGENT;IV_ARC_CENTERS" Dim sFname As String sFname = DXF_LOC & iProperties.Value(oDocName ,"Project", "Part Number") & ".dxf" oCompDef.DataIO.WriteDataToFile(sOut, sFname) part_no = part_no + 1 End If End If Next
Bregs
Rossano Praderi
Hi,
Thanks for the heads up.
I have a feeling my issue has something to do with this:-
Do you know what the error would be in my rule and what it should be?
Hi,
in my first post you will find one possible error in your code.
If you like, I can investigate on it but I need the file/files (.asm, .ipt, etc.) which cause the error.
I have only the release 2013 & 2015 of Inventor.
Bregs
Rossano Praderi
I get these Member not found errors every so often, when I did not change anything at all. Found out that if I quit Inventor and restart it, the ilogic rule that threw the error works just fine.
Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))