AnsweredAssumed Answered

How to insert a block at Appointed Location

Question asked by Jeremy Descroizilles on May 30, 2019
Latest reply on Jun 3, 2019 by Jeremy Descroizilles

Hi all, I have used Vinicius Pontes macro to insert a block onto my sheets. Does / can anyone suggest how it can be modified to place the block in the same place regardless of sheet scale?

 

Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()
Dim swApp As SldWorks.SldWorks
Dim swSktManager As SldWorks.SketchManager
Dim swModel As SldWorks.ModelDoc2
Dim swMathUtility As SldWorks.MathUtility
Dim swMathPoint As SldWorks.MathPoint
Dim PointCoords(2) As Double
Dim swSktBlkDef As SldWorks.SketchBlockDefinition

Dim scl As Double
Dim angle As Double

' Change scale and angle here
scl = 0.1
angle = 0

 

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSktManager = swModel.SketchManager
Set swMathUtility = swApp.GetMathUtility

 

' Change the insert point here
PointCoords(0) = 1 ' X
PointCoords(1) = 1 ' Y
PointCoords(2) = 0 ' Z

 

Set swMathPoint = swMathUtility.CreatePoint(PointCoords)
Set swSktBlkDef = swSktManager.MakeSketchBlockFromFile(swMathPoint, "G:\03_Engineering\Solidworks Master Utilities\Design Library\Annotations\Tick.SLDBLK", False, scl, angle)
End Sub

 

Regards

Jeremy

Outcomes