Anonymous
in reply to:
Anonymous
10-30-2020
11:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-30-2020
11:32 AM
Ok here's the whole spill ![]()
I have rule that does the stuff i need to do. From a drawing:
- checks to make sure the referenced model matches the drawing
- opens the referenced model and saves. This will trigger two external rules
- updated everything to make sure the dxf will be accurate.
- creates the dxf.
- Closes the model and goes back to the idw
PDF's the drawings.
This is the code for the checking portion of the rule
Imports System.Threading.Tasks Dim timeout = 1.5 ' secs Dim msg As New Form() With { .Enabled = False } Dim doc As DrawingDocument = ThisDoc.Document Dim sheet As Sheet = doc.ActiveSheet Dim view As DrawingView = sheet.DrawingViews.Item(1) Dim refDoc As Document = ThisApplication.Documents.Open(view.ReferencedFile.FullFileName) 'Dim addin As ApplicationAddIn 'xxxxxx'Dim iLogicAuto As Object = addin.Automation'xxxxxx 'oDoc = ThisDoc.FileName(False) 'without extension'xxxxxx attachedModel = ThisDoc.Path & "\" & IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) PreModel = ThisDoc.ChangeExtension(".ipt") intendedModel = Replace(PreModel,"-1_","-0_") 'MessageBox.Show("attachedModel = " & attachedModel, "iLogic") If attachedModel = intendedModel Then Task.Delay(TimeSpan.FromSeconds(timeout)).ContinueWith( Sub(t) msg.Close() End Sub , TaskScheduler.FromCurrentSynchronizationContext()) MessageBox.Show(msg,"Model/Drawing Matches", "iLogic") refDoc.Save() refDoc.Close() ' Parameter("d0") = 1.2 Else MessageBox.Show("The drawing has the wrong model attached", "iLogic") Return End If
This is the code that calls the model and pdf's after it is done.
Dim doc As DrawingDocument = ThisDoc.Document Dim sheet As Sheet = doc.ActiveSheet Dim view As DrawingView = sheet.DrawingViews.Item(1) Dim refDoc As Document = ThisApplication.Documents.Open(view.ReferencedFile.FullFileName) iLogicVb.RunExternalRule("ModelMatchDrawing") 'refDoc.Save()'refDoc.Close() iLogicVb.RunExternalRule("PDFit")