I already have a code below that will read a bunch of drawing filenames that will go into each drawing, save the drawing, (print the drawing but I have this disabled for now,) close it, then move onto the next one.
What I want to do is add reference brackets around every dimension on each drawing. Does anyone have an idea about how to do this? I have managed to update part list styles before using ilogic but I am not sure if it is possible with dimensions.
Thanks,
Wayne
question = MessageBox.Show("Are you sure you want to update multiple drawings? If so, please make sure all drawings are checked out.", "Batch Drawing Update",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
'set condition based on answer
If question = vbNo
Exit Sub
End If
spreadsheet = InputBox("The Batch Drawing Update requires a spreadsheet with a list of drawings you wish to update. Please enter the location and file name of the spreadsheet you wish to use.", "Batch Drawing Update", "C:\Users\wayne.helley\Documents\iLogic\Drawing\Batch Drawing Update")
location = InputBox("Please input the location of the folder which contains the drawings you wish to print.", "Batch Drawing Update", "C:\ARTICULATE\09\090\09090PT0000048")
'printer = InputBox("Please input the location of the printer you wish to use.", "Batch Drawing Update", "\\it-brd-prtsrv\BRD-COLOUR-DUPLEX")
GoExcel.Open(spreadsheet, "Sheet1")
'create lists
Dim DrawingList As New ArrayList
Dim row As Integer
For row = 1 To 1000
'Exits the FOR function when reaching the end of the list
If (GoExcel.CellValue("A" & row) = "") Then
Exit For
End If
DrawingList.add(GoExcel.CellValue("A"& row))
Next
Dim oString as Object
i = 0
For Each oString in DrawingList
'Open Drawing
ThisDoc.Launch(location & "\" & DrawingList.Item(i) & ".idw")
Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument
'Dim oPrintMgr As PrintManager
'
'
' oPrintMgr = oDrawingDoc.PrintManager
' 'specify your printer name
' oPrintMgr.Printer = printer
'
'oPrintMgr.ColorMode = kPrintDefaultColorMode
'oPrintMgr.Orientation = kLandscapeOrientation
'oPrintMgr.PaperSize = SizeActiveSheet
'oPrintMgr.SubmitPrint
oDrawingDoc.Save
oDrawingDoc.Close(True)
i=i+1
Next
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi waynehelley,
Here's a quick snippet that might help. Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
' Set a reference to the select set of the active document.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
' Find all selected occurrences and add them to an ObjectCollection.
Dim oDrawingDims As DrawingDimension
'Loop through all dimensions
For Each oDrawingDims In oDoc.ActiveSheet.DrawingDimensions
'set the Tolerance Method
'oDrawingDims.Tolerance.SetToDefault
'oDrawingDims.Tolerance.SetToBasic
oDrawingDims.Tolerance.SetToReference
Next
Thanks Curtis. That works perfectly!
I am always unsure what forum to use for ilogic questions but I will post in the Customization forum from now on.
@waynehelley wrote:I am always unsure what forum to use for ilogic questions but I will post in the Customization forum from now on.
Hi waynehelley,
Personally, I think iLogic questions fit best in the customization forum, but I don't get to hung up on that sort of thing, and so I try to answer questions where ever they land.
However, I serach for and find a lot of my answers to iLogic coding questions by searching the customization forums, so I try and point it out so that people know it's there. I think a lot of new forum users overlook it.
Happy to hear that worked,
Curtis
http://inventortrenches.blogspot.com
I am very basic beginner in ilogic, your codes are very simple to understand.
i am very much impressed by making codes simpler and easy to understand.
can you give me a iLogic simple code to ask the user to select a dimension.
once selected the dimension has to change to 3 decimal places with symmetric tolerance .030 added to the dimension.
the next line of the dimension showing a text T.S.C
is it difficult to code? please help