Advertisement
makos

Untitled

Jan 7th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. Dim swApp As SldWorks.SldWorks
  2. Dim swDoc As SldWorks.ModelDoc2
  3. Dim swExt As SldWorks.ModelDocExtension
  4. Dim swCustProp As CustomPropertyManager
  5. Dim filename As String
  6. Dim newNamePDF As String
  7. Dim newNameDWG As String
  8. Dim fnameLen As Long
  9. Dim result As Boolean
  10. Dim error As Long
  11. Dim warning As Long
  12. Dim bool As Boolean
  13. Dim val As String
  14. Dim revision As String
  15.  
  16. Sub main()
  17. Set swApp = Application.SldWorks
  18. Set swDoc = swApp.ActiveDoc
  19. Set swExt = swDoc.Extension
  20. Set swCustProp = swExt.CustomPropertyManager("")
  21. bool = swCustProp.Get4("Poprawka", False, val, revision)
  22. 'Debug.Print "Get custom prop result: " & bool
  23. 'Debug.Print "Custom prop value: " & revision
  24.  
  25. filename = swDoc.GetPathName()
  26. fnameLen = Len(filename)
  27. 'newNamePDF = Left(filename, fnameLen - 7) & "_" & revision & ".pdf"
  28. 'newNameDWG = Left(filename, fnameLen - 7) & "_" & revision & ".dwg"
  29.  
  30. newNamePDF = Left(filename, fnameLen - 7) & ".pdf"
  31. newNameDWG = Left(filename, fnameLen - 7) & ".dwg"
  32.  
  33. result = swExt.SaveAs3(newNamePDF, 0, 0, Nothing, Nothing, error, warning)
  34. 'Debug.Print result, error, warning
  35. result = swExt.SaveAs3(newNameDWG, 0, 0, Nothing, Nothing, error, warning)
  36. 'Debug.Print result, error, warning
  37. End Sub
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement