Hi all!
I need help with inserting a block into all sheets of my drawing file. I have 3 different blocks for 3 different drawing sizes (ANSI B, D and E). I have code from another post that inserts the block on the first drawing sheet, but I need some if-conditions to determine the size of the drawing sheet, and then choose the correct block to place, then move to the next sheet in the file, if applicable. Each sheet of the drawing will not necessarily be the same size (Sheet 1 could be size B, Sheet 2 could be size D, etc.).
The blocks are located in the same directory, and are called B-BLOCK, D-BLOCK, & E-BLOCK for each B, D, and E size sheet. I made it such that the insertion point for each block will be the origin, so my MathPoint coordinates don't change.
Any help is greatly appreciated. Thanks in advance!
Trent
Dim swApp As SldWorks.SldWorks
Dim swSkMan As SldWorks.SketchManager
Dim swModel As SldWorks.ModelDoc2
Dim swMathUtil As SldWorks.MathUtility
Dim swMathPoint As SldWorks.MathPoint
Dim dblPointCoords(2) As Double
Dim swSketchBlockDef As SldWorks.SketchBlockDefinition
Dim dblScale As Double
Dim dblAngle As Double
Sub main()
' Change scale and angle here
dblScale = 1
dbleAngle = 0
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSkMan = swModel.SketchManager
Set swMathUtil = swApp.GetMathUtility
'X, Y, Z coords
dblPointCoords(0) = 0
dblPointCoords(1) = 0
dblPointCoords(2) = 0
Set swMathPoint = swMathUtil.CreatePoint(dblPointCoords)
Set swSketchBlockDef = swSkMan.MakeSketchBlockFromFile(swMathPoint, "C:\Users\Desktop\D-BLOCK.sldblk", False, dblScale, dblAngle)
End Sub