I've been working a large project for a client. Near the end now and I'm looking at 9 10+ pg drawings and about 20 2 page drawings. I've belatedly realized a deficiency in my rev code documentation! Because of the way these drawings are being distributed I need to insert a note that contains
3 file properties but I need that note on every page of every drawings in the same place...
I've made a block of the note but that's about it. I thought I would seek professional help first. ie: existing macros or other automated techniques.
Here is some code that I have used it isn't my best work I was just learning when I wrote it and I didn't do great error handling. It will get you started anyway.
'this function will insert the block at a location 'depending on which template is used 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
End Function
'this will update the fields of the block with the text typed into the form fields. Public Sub UpdateBlock(BlockName As SldWorks.BlockInstance)
You can insert an Excel workbook object on the first sheet and it will show on all sheets, right click over the object to for the toggle. I believe you can insert file properties into an Excel workbook, by renaming the columns or cells , but I don't remember the procedure.
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.