ilogic dxf sheet metal export issue

ilogic dxf sheet metal export issue

Anonymous
Not applicable
916 Views
1 Reply
Message 1 of 2

ilogic dxf sheet metal export issue

Anonymous
Not applicable

I have some some code as below that I use to export flat patterns of parts to dxf. Basically what the code does go through unsupressed parts iproperties and looks for a value called "ISM" in the iproperties - summery - keywords, if this value is present then it produces a dxf of the part.

 

95% of the time it works but occasionally I get the below error message. There seems to be no pattern to when it appears but more likely after one of the parts is unsupressed and before a save of the assembly. However, after not working 2 or 3 times it suddenly begins to work again.

 

Error in rule: DXF, in document: IMPELLER.iam

Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))

 

Does anyone know of a reason why the a code below may be vunerable to occasionally not working? (Using Inventor 2014)

 

 

Example of code used below:-

 

DXF_LOC = ThisDoc.Path & "\IMPELLER_DXF\"

part_no = 1

 

Dim oDoc As Document

Dim asmDoc As AssemblyDocument 

asmDoc = ThisApplication.ActiveDocument 

Dim asmDef As AssemblyComponentDefinition 

asmDef = asmDoc.ComponentDefinition

Dim oComp As Inventor.ComponentOccurrence

 

For Each oDoc In ThisApplication.ActiveDocument.AllReferencedDocuments

Dim filename As String = IO.Path.GetFileName(oDoc.displayname)

oDocName = oDoc.Displayname

 

iProperties.Value(oDocName ,"Summary", "Title") = oDocName

 

    If iProperties.Value(oDocName ,"Summary", "Keywords") = "ISM" Then

    iProperties.Value(oDocName ,"Project", "Part Number") = JOB_NUMBER & "I" & part_no & ".dxf"

    Dim oCompDef As SheetMetalComponentDefinition

    oCompDef = 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

Next

0 Likes
917 Views
1 Reply
Reply (1)
Message 2 of 2

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

You mentioned unsuppressing things. If a component is suppressed then you cannot access its ComponentDefinition.

So you might have to update the document after unsuppressing components in it.

That could be one reason.

 

 

One way to debug something like this is to place the code part in a Try/Catch, and inside the Catch part show a message with the name of the component you had issues with. That could give you a clue.


Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes