Anyone have a macro that inserts a block into a drawing at a specified X,Y location in the sheet format?
I have tried to record a macro to do this, but no sucess. I looked up the help in api for insterting a bloack but I cannot seem to decipher the notes on this.
I use this to insert a revision block we use and it sets all of it's annotations to and empty string. It determines the location by the name of the template so you will have to handle that according to your own system.
Regards Corey
Function insertBlock() As SldWorks.BlockDefinition
Dim x As Double Dim y As Double Dim Bscale As Double Dim RevLev As Object Dim RLX As Double Dim RLY As Double Dim RLHeight As Double Dim RevLevTxt As String Dim SheetSize As String Dim blockDef As SldWorks.BlockDefinition Dim MyBlock As SldWorks.BlockInstance
Set blockDef = dwgdoc.GetBlockDefinition("A CHANGE") dwgdoc.EditSheet
If blockDef Is Nothing Then MsgBox "There was a problem finding the block." & VBA.Chr(vbKeyReturn) & _ "Make sure " & VBA.Chr(34) & "A Change.SLDBLK" & VBA.Chr(34) & "is in the same directory as this macro." End End If Set insertBlock = blockDef
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.