Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
dparmarF6BDE
in reply to: A.Acheson

hello @A.Acheson ,
here is the derived script i have been using so far. now about the work flow, I have thought about an approach which seems pretty straight forward but want to test the feasibility (coding wise). So I have and excel in the same directory as the current Idw file for example. now there is only one sheet in that workbook and as per the image shown below, I have three column, now from the ilogic, I want to open the excel and start a "for loop" from 2nd row till the row 2500 for example. Now looping through each row, I want to change the "DUMMY 1" Ipart member to the column A cell value, similarly I want to do the same for the other two views and their Ipart. So every time we jump to a new row, all the three views is gonna get updated to the member name in row. Can we achieve this using Ilogic? Thanks in Advance!

dparmarF6BDE_1-1708436782613.pngdparmarF6BDE_2-1708436946698.png

 

Sub Main

	Dim oDrawing As DrawingDocument = ThisApplication.ActiveDocument
	Dim oPath As String = "C:\IMAGINE" 'Folder to save the drawings
	Dim oFactory As iPartFactory
	
	
	
	For Each oView As DrawingView In oDrawing.ActiveSheet.DrawingViews
		Dim oDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
		oFactory = oDoc.ComponentDefinition.ipartMember.ParentFactory
		Exit For
	Next
	
	Dim memberName As String = InputBox("Enter the Membername you wish to Start the Loop", "iLogic", "CBCAL0820PL01") 
	
	If oFactory Is Nothing = False Then
		For Each oRow As iPartTableRow In oFactory.TableRows
				If Not oRow.MemberName = memberName AndAlso  Not memberName Is Nothing Then Continue For
				memberName = Nothing
			
			For Each oView In oDrawing.ActiveSheet.DrawingViews
				If oView.ActiveMemberName <> oRow.MemberName Then oView.ActiveMemberName = oRow.MemberName
				oDrawing.Update
				
' Get the DXF translator Add-In.
Dim DXFAddIn As TranslatorAddIn
DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "C:\temp\dxfout.ini"
' Create the name-value that specifies the ini file to use.
oOptions.Value("Export_Acad_IniFile") = strIniFile
End If
'Set the destination file name
Dim dxfFileName As String = oPath & "\DXF\" & oRow.MemberName & ".dxf"
oDataMedium.FileName = dxfFileName


iLogicVb.RunRule("FIXED SCALE")
iLogicVb.RunRule("POSITION")

'Publish document.
oDrawing.Update
DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)	

				Do While oView.IsUpdateComplete = False
					Call ThisApplication.UserInterfaceManager.DoEvents
				Loop
			Next
			
			'oDrawing.SaveAs(oPath & "\" & oRow.MemberName & ".idw", True)
			'oDrawing.SaveAs(oPath & "\PDF\" & oRow.MemberName & ".pdf", True)
		Next
	End If
End Sub