Ilogic, to save all factory members (flat patterns) as dxf

Ilogic, to save all factory members (flat patterns) as dxf

czegledi_laszlo
Contributor Contributor
376 Views
5 Replies
Message 1 of 6

Ilogic, to save all factory members (flat patterns) as dxf

czegledi_laszlo
Contributor
Contributor

Hello!

Is it possible to export all family members, flat patterns as dxf with an ilogic? Or maybe with another solution?

0 Likes
377 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @czegledi_laszlo.  I just wanted to make sure I am understanding what you want correctly.  Do you mean that you have a sheet metal type part document, which contains multiple ModelStates, and you want to iterate through each ModelState and export the FlatPattern that is influenced by that ModelState to a DXF file?  If so, where do you want to save these new DXF files to, and how do you want to name them differently from each other.  Also, are there any specific settings you need to specify for the export process?...if so, what are they?  The simplest to code would be to save the DXF files to the same folder that the main part is stored in, and give it the same name as the original part file, except maybe add the name of the ModelState to the end of the file's name, but I do not know if that would work OK for you.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

czegledi_laszlo
Contributor
Contributor

HI, @WCrihfield, thanks for your help. I have a sheet metal part file, which converted to ipart, and based on different parameters there will be hundreds if not thousands of iterations, where only 3 parameters changing: inside diamater, outside diameter, and a text parameter. The export is okay if its the same location as the original file, and it would be needed to be dxf 2000 version. For the name two options would work for me: Either the value of the Member field in iauthor, or the value of the text parameter, the latter would be the better. I hope its clearer this way now. Thanks for your help in advance!

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

Hi @czegledi_laszlo.  If you are working with iParts, then I may not be the best at helping you with this task, because I have not used them in years, and am especially rusty at working with them by code.  I am familiar with the basics, but not the detailed stuff.  I know that once you have obtained the iPartFactory object by code, that will tell us where the 'member' documents will be stored when generated, but I am not familiar with iterating these members the right way.

 

But to help others a bit more, what is the exact name, including any capitalization, of the text type parameter you want to use in the DXF file's name.

Here is a little starter code I created that may help you and/or others along the way for now.

Sub Main
	If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
		MsgBox("A Part Document must be active for this rule to work. Exiting.", vbCritical, "")
		Exit Sub
	End If
	Dim oPDoc As PartDocument = ThisDoc.Document
	If oPDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
		MsgBox("This is not a Sheet Metal Part.  Exiting rule.", vbCritical, "")
		Exit Sub
	End If
	Dim iPFactory As iPartFactory = Nothing
	If oPDoc.ComponentDefinition.IsiPartFactory Then
		iPFactory = oPDoc.ComponentDefinition.iPartFactory
	ElseIf oPDoc.ComponentDefinition.IsiPartMember Then
		iPFactory = oPDoc.ComponentDefinition.iPartMember.ParentFactory
	Else
		MsgBox("This Part is not an iPart.  Exiting rule.", vbCritical, "")
		Exit Sub
	End If
	iPFactory.MemberEditScope = MemberEditScopeEnum.kEditActiveMember
	Dim oMDir As String = iPFactory.MemberCacheDir
	'gets an Array of Strings containing the full file names of all part files in that directory
	Dim oExistingMemberFiles() As String = System.IO.Directory.GetFiles(oMDir, "*.ipt", System.IO.SearchOption.TopDirectoryOnly)
	'we could now iterate through them and try to export them to DXF, if possible
	
'	For Each oRow As iPartTableRow In iPFactory.TableRows
'		Dim oMemberName As String = oRow.MemberName
'		Dim oPartName As String = oRow.PartName 'corresponds to file name
'	Next
End Sub

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

czegledi_laszlo
Contributor
Contributor

Thank you for the starting code!

The text parameter looks like this: BVHAF600-630-4-14/38

0 Likes
Message 6 of 6

A.Acheson
Mentor
Mentor

It looks like your text parameter will have some illegal characters like the backslash so I wouldn't recommend using it for file names. 

To use another column other than the member column just enter the column name below. Sourced from this similar post working with iparts and drawings. 

Dim ParamName As String = iPFactory.TableColumns("EnterColumnName").Item(i).Value

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes