I logic rule for flatpaterns

I logic rule for flatpaterns

Anonymous
Not applicable
951 Views
13 Replies
Message 1 of 14

I logic rule for flatpaterns

Anonymous
Not applicable

Hello,

I have been looking on this forum for help, an iLogic rule for creating a drawing with flat patterns of multiple parts of an assembly, the rule will create a drawing sheet for each or multiple parts with flat pattern in it. this i will use as bending drawing, or any other method to create bending drawings for huge sheet metal parts in an assembly..?

 

Thanks in Advance

0 Likes
Accepted solutions (2)
952 Views
13 Replies
Replies (13)
Message 2 of 14

S_May
Mentor
Mentor

Hello @Anonymous
I can not fulfill them all.. Smiley Very Happy
But the sheet metal as a dxf to store from an assembly they see in the ilogic...

0 Likes
Message 3 of 14

S_May
Mentor
Mentor
Accepted solution

DXF from IAM:

oOptions = ThisApplication.TransientObjects.CreateNameValueMap
'get DXF target folder path
oFolder = oPath & "\" & oAsmName & " DXF Files"
'Check for the DXF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If
'- - - - - - - - - - - - -
'- - - - - - - - - - - - -Component - - - - - - - - - - - -
'look at the files referenced by the assembly
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAsmDoc.AllReferencedDocuments
Dim oRefDoc As Document
'work the the drawing files for the referenced models
'this expects that the model has been saved
For Each oRefDoc In oRefDocs
iptPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "ipt"
'check that model is saved
If(System.IO.File.Exists(iptPathName)) Then
Dim oDrawDoc As PartDocument
oDrawDoc = ThisApplication.Documents.Open(iptPathName, True)
oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName))
Try
'Set the DXF target file name

Try
CustomName =iProperties.Value(oFileName, "Custom", "PF_PRT_ZNR")
Catch
CustomName ="XXX" 'Wert, wenn iPropertie PF_PRT_ZNR nicht existiert
End Try

oDataMedium.FileName = oFolder & "\" & CustomName  & " " & oFileName & ".dxf"

Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDrawDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PR​OFILE"
oCompDef.DataIO.WriteDataToFile( sOut, oDataMedium.FileName)
'just for check its works coretcly
'i=MessageBox.Show(oDataMedium.FileName, "Title",MessageBoxButtons.OKCancel)
'MessageBox.Show(i,"title",MessageBoxButtons.OK)
'If i=2 Then
'Exit Sub
'End If
oCompDef.FlatPattern.ExitEdit
Catch
End Try
oDrawDoc.Close
Else
End If
Next
Message 4 of 14

S_May
Mentor
Mentor
Accepted solution

DXF from IPT:

    Dim oDoc As PartDocument

    oDoc = ThisApplication.ActiveDocument

 

    Dim oCompDef As SheetMetalComponentDefinition

    oCompDef = oDoc.ComponentDefinition

 

    If oCompDef.HasFlatPattern = False Then

        oCompDef.Unfold

    Else

        oCompDef.FlatPattern.Edit

    End If

 

    Dim sOut As String

      If ExportInner = True Then

          sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_INTERIOR_PROFILES"

      Else

      sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE"

      End If

 

    ' Get document's full file name

    Dim sFname As String

    sFname = oDoc.FullFileName

 

    ' The file format will depend on the extension

    ' Set file name extension to ".DXF"

    sFname = Left$(sFname, Len(sFname) - 3) & "dxf"

 

    oCompDef.DataIO.WriteDataToFile( sOut, sFname)

 

End Sub
0 Likes
Message 5 of 14

Anonymous
Not applicable

Hi May,

 

Thanks for your support, but it didn't work well, i got the following error, 

 

Error on Line 12 : 'oAsmDoc' is not declared. It may be inaccessible due to its protection level.
Error on Line 32 : 'oDataMedium' is not declared. It may be inaccessible due to its protection level.
Error on Line 43 : 'oDataMedium' is not declared. It may be inaccessible due to its protection level.

 

 

can you help me..?

 

Thanks 

0 Likes
Message 6 of 14

S_May
Mentor
Mentor

Hello @Anonymous,


We use with us in the company inventor 2016, as the rules work. Smiley Embarassed

 

0 Likes
Message 7 of 14

doug.johnston
Advocate
Advocate

I just tried this code in Inventor 2016 and I removed the "END SUB" command at the end of the code and it worked for me.

 

I will definitely be using this one immediately !!!

 

 

 

--------------------------------------------------------------------------------------------------

''IPT to DXF ILOGIC CODE

 

 

Dim oDoc As PartDocument

oDoc = ThisApplication.ActiveDocument

 

Dim oCompDef As SheetMetalComponentDefinition

oCompDef = oDoc.ComponentDefinition

 

If oCompDef.HasFlatPattern = False Then

oCompDef.Unfold

Else

oCompDef.FlatPattern.Edit

End If

 

Dim sOut As String

If ExportInner = True Then

sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_INTERIOR_PROFILES"

Else

sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_OUTER_PROFILE"

End If

 

' Get document's full file name

Dim sFname As String

sFname = oDoc.FullFileName

 

' The file format will depend on the extension

' Set file name extension to ".DXF"

sFname = Left$(sFname, Len(sFname) - 3) & "dxf"

 

oCompDef.DataIO.WriteDataToFile( sOut, sFname)

 

End Sub

 

 


---------------------------------------------------
It's not easy maintaining this level of insanity !!!!!
0 Likes
Message 8 of 14

doug.johnston
Advocate
Advocate

With this code it creates the DXF with the bend lines and fold "start & end" lines.

 

I use DXF's for waterjet programming and would love a "clean "outline/extents" file for that purpose.

 

Can someone modify this code to eliminate those lines from being exported ??

 

Thanks in advance,

Doug J..

 

p.s. - I'm a newbie at ilogic and don't have enough experience to change it myself.


---------------------------------------------------
It's not easy maintaining this level of insanity !!!!!
0 Likes
Message 9 of 14

S_May
Mentor
Mentor

Hi @doug.johnston,

 

bitte testen Sie diese APP....

0 Likes
Message 10 of 14

S_May
Mentor
Mentor

... und diese APP

0 Likes
Message 11 of 14

w.pepping
Advocate
Advocate

And this app for free

Get control of your sheet metal files.
Download the app from matprop.com
Message 12 of 14

S_May
Mentor
Mentor

Hi @w.pepping

 

The app I had forgotten, which is also very good

0 Likes
Message 13 of 14

Anonymous
Not applicable

How would I set AcadVersion to R12? Also I need to merge profiles to polyline and rebase geometry to 1st quadrant.

 

I'm just now getting into iLogic and have inherited previous programming from a colleague who has since left.

 

Thanks in advance.

0 Likes
Message 14 of 14

Anonymous
Not applicable

Alternatively, if I could get iLogic to retrieve and use a configuration file and use that instead life would be so much better right now.

0 Likes