{"id":1220,"date":"2013-08-09T16:53:18","date_gmt":"2013-08-09T15:53:18","guid":{"rendered":"http:\/\/www.solidapps.co.uk\/blog\/?p=1220"},"modified":"2013-08-12T15:57:05","modified_gmt":"2013-08-12T14:57:05","slug":"tip-adding-a-macro-button-to-solidworks","status":"publish","type":"post","link":"https:\/\/www.solidapps.co.uk\/blog\/2013\/08\/tip-adding-a-macro-button-to-solidworks\/","title":{"rendered":"Tip: Adding a macro button to SolidWorks"},"content":{"rendered":"<p>Ever thought \u201cI wish there was quicker way of doing this\u201d? Well, SolidWorks has a great capability to create custom macros. SolidWorks macros can add value to your CAD implementation by automating workflows, removing repetitive tasks, combining commands, or even creating new functionality.<\/p>\n<p>There are a number of great resources for SolidWorks macros. Whether you are new to macro writing, or an experienced coder, the user forums <a href=\"https:\/\/forum.solidworks.com\" target=\"_blank\">https:\/\/forum.solidworks.com<\/a> are invaluable for sharing experiences; user-run websites such as <a href=\"http:\/\/www.cadsharp.com\" target=\"_blank\">www.cadsharp.com<\/a> are an excellent resource for learning the SolidWorks API; and <a href=\"http:\/\/www.3dcontentcentral.com\" target=\"_blank\">www.3dcontentcentral.com<\/a> which has an area for downloading macros shared by other SolidWorks users. Don\u2019t forget, Solid Applications also provide consultancy services for macro writing, or training services for the SolidWorks API course.<\/p>\n<p>I recently created a simple macro for a customer. He was selecting components in a long assembly tree and need to know how many items were selected. After creating a simple macro that gave a count of the number of selected components, I wanted to make this quickly accessible in the SolidWorks user interface. \u00a0This is easily done using the Customize dialog; here\u2019s how.<\/p>\n<p>Go to Tools &gt; Customize\u2026; select the Commands tab on the Customize window, and then select Macros from the Categories list.<\/p>\n<p><a href=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1223\" alt=\"Macro_icon_1\" src=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_1.png\" width=\"742\" height=\"287\" srcset=\"https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_1.png 742w, https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_1-300x116.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/p>\n<p>Drag and drop the \u2018New Macro Button\u2019 on to your tool bar.<\/p>\n<p><a href=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1229\" alt=\"Macro_icon_2\" src=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_2.png\" width=\"364\" height=\"261\" \/><\/a><\/p>\n<p>The customize macro button box will appear.\u00a0 Click on the browse button (\u2026) and locate the macro (xxxx.swp) in the folder it was saved to. Select it and click Open.<\/p>\n<p><a href=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1230\" alt=\"Macro_icon_3\" src=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_3-300x276.png\" width=\"300\" height=\"276\" srcset=\"https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_3-300x276.png 300w, https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_3.png 334w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1231\" alt=\"Macro_icon_4\" src=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_4-300x276.png\" width=\"300\" height=\"276\" srcset=\"https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_4-300x276.png 300w, https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_4.png 334w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To change the icon, click on the Choose Image\u2026 button and select the Bitmap file if provided. You can change the tool tip text to something more useful. Click OK to finish, and click OK on the Customize window.<\/p>\n<p><a href=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1233\" alt=\"Macro_icon_5\" src=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_5-300x144.png\" width=\"300\" height=\"144\" srcset=\"https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_5-300x144.png 300w, https:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/08\/Macro_icon_5.png 356w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Run the macro to test it.<\/p>\n<p>Hope you found this tip useful. More tips next time from the SolidApps team.<\/p>\n<p><a href=\"http:\/\/mkt.solidworks.com\/emarketing_enu\/start.swe?SWECmd=InvokeMethod&amp;SWEMethod=StartSS&amp;SWEView=URLRouter&amp;SWEApplet=SSRoute&amp;SWENargs=SSId=1-12QAQ0H,SSName=REP+ENG+International+Mechanism+Design+Buyer's+Guide,SSLC=,SSCC=,CID=1-1VOY0AL,OID=1-12RQSRK,COID=1-1VOY0AM,PRO=1-NKZ7N\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" alt=\"Mechanism_BuyersGuide_600x90\" src=\"http:\/\/www.solidapps.co.uk\/blog\/wp-content\/uploads\/2013\/07\/Mechanism_BuyersGuide_600x90.png\" width=\"600\" height=\"90\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever thought \u201cI wish there was quicker way of doing this\u201d? Well, SolidWorks has a great capability to create custom macros. SolidWorks macros can add value to your CAD implementation&hellip; <\/p>\n","protected":false},"author":6,"featured_media":128,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,5],"tags":[64,37,65,26],"class_list":["post-1220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solid-applications","category-solidworks","tag-api","tag-hints-tips","tag-macro","tag-support"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=1220"}],"version-history":[{"count":10,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1220\/revisions"}],"predecessor-version":[{"id":1240,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1220\/revisions\/1240"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/media\/128"}],"wp:attachment":[{"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=1220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=1220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.solidapps.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=1220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}