Message 1 of 3
Run rule in drawing from assembly won't work silently
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all, I have a rule in an assembly that runs a rule in a drawing that positions and scales the view on the sheet. If I run the rule from the assembly silently it throws an error. If I don't run it silently it works just fine. I was wondering if there was some way to run it silent and it work. The rules are below. Thanks in advance for any help!
'This is from the rule in the assembly document
'open drawing document DwgFilename = ThisDoc.Path & "\Dwgs\MyDwg.dwg"
'It works if I run the rule this way Dim oDrawDoc as DrawingDocument = ThisApplication.Documents.Open(Dwgfilename)
'It does NOT work if I run the rule this way 'Dim oDrawDoc as DrawingDocument = ThisApplication.Documents.Open(Dwgfilename, False) 'run rule in the drawing document auto = iLogicVb.Automation auto.RunRule(oDrawDoc, "POSITION VIEW") oDrawDoc.Save oDrawDoc.Close
'This is the "POSITION VIEW" rule in the drawing
Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDrawDoc.ActiveSheet Dim oViews As DrawingViews = oSheet.DrawingViews Dim oView As DrawingView = oSheet.DrawingViews(1) 'Adjust VIEW 1 SCALE until it fits the sheet height'ActiveSheet = oDrawDoc.Sheet("Layout1:1") STARTSCALE = 0.125 oView.Scale = STARTSCALE InventorVb.DocumentUpdate() TryAgain: InventorVb.DocumentUpdate() SheetHeight = oSheet.Height - 0 ViewHeight = oView.Height ScaleStep = 0.02 If ViewHeight > SheetHeight Then VIEWSCALE = STARTSCALE - ScaleStep STARTSCALE = VIEWSCALE RuleParametersOutput() oView.Scale = VIEWSCALE InventorVb.DocumentUpdate() ActiveSheet.View(1).SetSpacingToCorner(1, 2.25, SheetCorner.BottomLeft) InventorVb.DocumentUpdate() If VIEWSCALE <= 0.01 Then MessageBox.Show("That's too darn small!", "ilogic") Return 'exit rule Else Goto TryAgain End If InventorVb.DocumentUpdate() End I