- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone,
I'm working on an automation that makes copies of a certain model and positions these in an existing assembly.
after configuration and positioning i'm copying the drawing of the model and i change the model reference to the newly created configuration.
this all works great but now i want to add more customization in the drawing and i started out with a rule for automatic scaling and centering of the views. the problem is however that i cant seem to get the rule to run from the main rule.
Sub tekening(modelDWG As String, goot As ComponentOccurrence) Dim oPad As String = "C:\\Workspace\NXTdimVault\Documents\Test\Jeremy\Stagemap\Goten" Dim oDirSep As Char = System.IO.Path.DirectorySeparatorChar Dim gootNaam As String = goot.Definition.Document.FullFileName Dim oCopiedDWG As String = oPad & oDirSep & System.IO.Path.GetFileNameWithoutExtension(gootNaam) & ".dwg" Dim docum As Inventor.Document modelDocDwg = ThisApplication.Documents.Open(modelDWG, False) modelDocDwg.SaveAs(oCopiedDWG, False) modeldocDwg.close gootDWG = ThisApplication.Documents.Open(oCopiedDWG, False) Dim oFD As FileDescriptor = gootDWG.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor oFD.ReplaceReference(gootNaam) iLogicVb.RunRule(gootDWG.fulldocumentname, "SCALE_&_CENTER") gootDWG.update() ThisApplication.Documents.Open(oCopiedDWG, True) For Each docum In ThisApplication.Documents.VisibleDocuments If docum.DocumentType = kdrawingdocumentobject Then docum.Activate 'HERE THE RULE SHOULD BE RUN------------ 'iLogicVb.RunRule(docum.FullDocumentName, "SCALE_&_CENTER") 'iLogicVb.RunRule(ThisApplication.ActiveDocument, "SCALE_&_CENTER") 'iLogicVb.RunExternalRule("GOTENPLAN_TEST_V1") '--------------------------------------- docum.Save ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False) System.Windows.Forms.SendKeys.SendWait(Chr(9) & vbCrLf) docum.Close(True) End If Next End Sub
It either tells me it cant find the document or when i use active document as a reference it will tell me the assembly isnt a drawing but onscreen the drawing is activated and open.
I'm not sure how to proceed i tried tons of ways of referencing the rule but i cant seem to get it running. any pointers or directions would be greatly appreciated! thanks!
Best regards,
Jeremy
Solved! Go to Solution.