US$0.00
0

Category: macros

How To Automate Solidworks Export Bom To Excel Workflow with Thumbnails

If you are using SOLIDWORKS 2018 or lower, exporting Bill of Materials (BOM) manually to Excel and then adding pictures would be quite a tedious and time-consuming process. But the good news is, you can achieve this process with a speedy macro, saving you heaps of time and accelerating your workflow. In this tutorial, we are going to guide you through how to export Bill of Materials SolidWorks to Excel with thumbnails using a parts-only BOM macro. Not only is this faster, but it also provides you with a visual representation of each part, which is invaluable for design reviews and communications within the team. Note that this macro is optimal for smaller assemblies only; larger ones have alternatives like xlBOM with thumbnails or PDM2Excel, which handle complex assemblies more efficiently. Why Use a Macro for BOM Export in SOLIDWORKS? Having your process automated through a macro is a great way to eliminate the drudgery of repetitive tasks. And that’s where the importance of knowing how to export SolidWorks BOM to Excel comes into play. This is why a macro is the best thing to do for it: Requirements You’ll want the following before you begin: Step-by-Step SolidWorks Bill of Materials Tutorial To install and run the macro in your SOLIDWORKS software, follow these simple steps as explained- The macro will now start running and export the BOM to Excel, complete with thumbnail previews for each visible component. How the Macro Works The macro performs two key functions to help you export a SolidWorks BOM with images: Limitations of the Macro There’s no doubt that this macro is absolutely capable of speeding up your workflow significantly. However, you must also be on the lookout for some of its limitations, such as– As mentioned at the start, for more complex assemblies or additional features, consider using advanced tools like xlBOM. This tool can handle larger assemblies and provides more robust export capabilities. Why Choose Automation for BOM Export? Automating the BOM export process in SOLIDWORKS VBA saves you time and effort, especially when dealing with repetitive tasks. By integrating thumbnail previews in Excel, you make it easier for stakeholders to visualize the components, which is critical in manufacturing and design reviews. Need Help with SOLIDWORKS Automation? Automating these kinds of repetitive tasks, like SolidWorks Export Bom To Excel, can spare plenty of your time and effort, which you can utilize for something more significant. In case you need assistance in this or any other custom solutions, feel free to get in touch with us. At Blue Byte Systems, we specialize in automating SOLIDWORKS and PDM workflows. Contact us today and let us show you how we can help you simplify your design process and boost productivity.

Read More »

Protect macros with a password – Valid for Excel and SOLIDWORKS

Protect macros modules from viewing by adding a password from the protection tab at Tools > Macro Name Properties. While it’s a common to protect macros with a password, keep in mind that a passowrd-protcted macros security is very brittle and can be broken easily. For stronger protection, consider upgrading your code to a VB.NET add-in. The content of this article is applicable to both SOLIDWORKS and Microsoft Office Excel, PowerPoint and Word. Protecting macros with a password will prevent users from viewing the source code. You might want to go the extra mile to protect your macro’s from viewing for many reasons. For example you want to: This short article will show you how to lock a VBA macro from being viewed, with a password. Users will continue to be able to run the macro but will not able to view the content of the macro’s modules. These steps are very straight-forward: Is My Macro Protected 100% of the Time? Unfortunately, protecting a macro with a password does not provide you with the ultimate security. For example, check this article on how to crack any password-protected VBA macro. What to Do to Protect My Code? To conclude, the best thing to do is to upgrade your macro to SOLIDWORKS add-ins. In addition to our PDM implementation services, Blue Byte Systems, Inc. has a great wealth of experience upgrading old legacy VBA code to powerful .net Add-ins. Contact us or schedule a quick zoom call here.

Read More »

Early binding vs Late Binding: How to write macros that will always run with no errors

TLDR: Here’s what you need to know about Early Binding Vs Late Binding The topic of Early Binding vs Late Binding is really close to my heart: The eternal question on whether to use early binding or late binding for SOLIDWORKS or Excel VBA macros. Each of these approaches has its consequences and we’re going to discuss those in great detail in this article. Now, before I give you my personal take on early and late binding, let’s define what they are and go over the pros and cons of each other. By the end of this article, you will be able to discern when use late or early binding. Let’s begin with early binding. Early Binding when writing macros When you early-bind your variables in a VBA macro, you tell the VBE, to assign a specific type to a variable, when it compiles the macro for execution. For example:Dim swApp as SldWorks.SldWorks This tells VBE: “Hey, make sure you that swApp is of type SldWorks.SldWorks”. Now this is awesome because VBE doesn’t have to do anything extra. It will go and find the type that matches SldWorks from the referenced libraries in Tools > References and enforce that type assignment for the rest of your macro. This is called type-enforcement. It means if you misspell a method name or miss a parameter, VBE won’t allow you to run the macro until you have those compile-errors fixed. Now, because you’re early-binding your variables, VBE is able to grab the methods and properties definitions from the tlb reference and assist you into writing the api calls by making autocompleted suggestions. This feature is called “IntelliSense”. It is a productivity boost and sometimes is a necessity when you are working with ill-designed API calls that have +10 parameters like FeatureManager::FeatureExtrusion3 Early binding is great but it also comes with its shares of problems. A good example is when the type definitions cannot be found. You will have to go to Tools > References and fix any missing ones to allow VBE to resolve variable declarations appropriately. Late Binding to the rescue When you use late binding, you’re telling VBE to resolve variables types during runtime. VBE has access to all the COM libraries installed on your machine is able to run through them and grab the appropriate type that matches the declared variable and how it is used. This is great way if you don’t know what version of SOLIDWORKS the end-user has on their computer. To use late binding, simply declare all variables as Object. You can even remove the SOLIDWORKS references from the Tools > References window. You will also have to replace the line : Set swApp = Application.SldWorkswith Set swApp = GetObject(, “SldWorks.Application”) Here’s an example that prints a hello world message using late binding: Dim swApp As ObjectSub main()’Attach to the active sldworks sessionSet swApp = GetObject(“”, “SldWorks.Application”)If Not swApp Is Nothing Then ‘print process id Debug.Print “Process ID is : ” & swApp.GetProcessID() ‘display message to user swApp.SendMsgToUser “Hello from late-bound SOLIDWORKS macro!”End IfEnd Sub Unfortunately when you do that, a few things will happen: As you can see writing a macro using late binding is equivalent of writing code on a white board which is unpleasant because no-one memorizes the API. This brings me to my personal take on binding. Continue reading below. Early Binding vs Late Binding conclusion: How to score two birds with one stone What to do next? That’s a good question! VBA is becoming an obsolete scripting language. It’s great for automating small tasks, but it is not the sharpest tool in the shed for automating complex workflows in SOLIDWORKS or PDM. At Blue Byte Systems, Inc., we encourage our customers to reach out to us to upgrade their VBA macros to add-ins. This secures your code and makes it easier to maintain and deploy, while also addressing important considerations such as early binding vs late binding.

Read More »

How to Quickly Delete Dangling Dimensions in SOLIDWORKS Drawings?

When you’re drafting using SOLIDWORKS, you’ve most likely encountered those pesky red dimensions, a very typical sign of a dangling dimensions SOLIDWORKS drawing. This is most often a result of a deleted, modified, or suppressed sketch entity or feature to which a dimension was being anchored in the model. Though they do not affect the model, these dimensions can confuse your drawing, make it illegible, and create ambiguity. The tedious and repetitive exercise of manually figuring out how to quickly delete dangling dimensions in solidworks drawings by reviewing every sheet and view is necessary in case of drawings that are more complex. Instead of individually selecting each dimension, a good and convenient choice is to use a VBA macro. This macro itself is purpose-built to help you solidworks delete dangling dimensions by making the cleanup process more efficient. It accomplishes this by iteratively searching through every annotation on every sheet and view in the active drawing document. Once an annotation, like a dimension, is determined to be “dangling,” the macro will select it for deletion. This will save your time and energy to check and select each erroneous dimension manually, a very time-wasting and labor-intensive activity. It is the perfect way to understand how to delete dimensions in SolidWorks drawing with only one click.

Read More »

How to Automatically Insert a SolidWorks Drawing Watermark Using A Macro?

What Does This Macro Do? This macro is a fast, easy tool for any SOLIDWORKS user. It performs the following essential tasks: Why Should I Use This Macro? Using a watermark drawing macro is the best way to control quality and communicate effectively on your projects. Instead of wasting precious time inserting and formatting notes manually, the macro is a simple, trusted answer. How to Add a Watermark in a SolidWorks Drawing? To add a watermark to your SolidWorks drawing, you don’t need any particular programming knowledge. Just follow these simple steps to get started: The macro will execute instantly, and your watermark will be aligned centrally on the current drawing sheet. The VBA Macro Code Need a Custom Modification? This free macro is a quick solution to solidworks drawing add watermark, but we know that every engineering workflow is unique. So, if you need a more advanced version tailored to your needs, or one based on a custom property to define the text, we’re here to help. At Blue Byte Systems Inc., we excel at creating bespoke VBA macros and add-ins that are ideally suited to your individual requirements. So if you have a concept for a bespoke macro or a bug you’d like resolved, don’t hesitate to get in touch with us here for a quote or free consultation. Together, let’s achieve even higher productivity, ya?

Read More »
0
0
Your Cart
Your cart is emptyReturn to Shop