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: 

Ilogic Member not found issue

6 REPLIES 6
Reply
Message 1 of 7
gazadder
1181 Views, 6 Replies

Ilogic Member not found issue

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

6 REPLIES 6
Message 2 of 7
rossano_praderi
in reply to: gazadder

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



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 3 of 7
gazadder
in reply to: rossano_praderi

Hi,

 

Thanks for the heads up.

 

I have a feeling my issue has something to do with this:-

 

http://forums.autodesk.com/t5/inventor-general-discussion/use-ilogic-to-set-the-size-and-length-of-a...

 

Do you know what the error would be in my rule and what it should be?

Message 4 of 7
rossano_praderi
in reply to: gazadder

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



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 5 of 7
gazadder
in reply to: rossano_praderi

Hi Rossano,

I have actually replaced the old code with your new neater one but I still get the error.

I could attached the assembly but the problem is that most times it runs fine with no error so it may not error for you.
Message 6 of 7
rossano_praderi
in reply to: gazadder

Hi Gazadder, as i wrote, my code is not your solution.
I'm sure you will find someone with more experience and more time to dedicate at your issue (as wrote, I don't have the release 2014).

Bregs
Rossano Praderi


--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 7 of 7
rschader
in reply to: 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))

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

Post to forums