-
Re: Can someone teach me the basics of VBA in solidworks?
Jacob Picolet Aug 21, 2014 5:05 PM (in response to Evan Dlugopolski)1 person found this helpfulKeith Rice has a website called CADSharp.com: SolidWorks API Video Tutorials.
Deepak Gupta also has a lot of helpful information and a blog: Boxer's CAD CAM Blog | News, Events and Tech Tips
Search wise the articles from Javelin and Hawkridge are typically the most helpful.
-
Re: Can someone teach me the basics of VBA in solidworks?
David Mandl Jan 18, 2017 11:21 AM (in response to Jacob Picolet)Allow me to throw my recommendation behind Keith Rice and his website. His videos are very helpful, and the free version of his catalog includes some very handy videos for VBA novices.
-
Re: Can someone teach me the basics of VBA in solidworks?
Christian Chu Jan 18, 2017 11:49 AM (in response to David Mandl)Just adding to your comments: believe Keith will have a seminar in LA just before SWW - Pls. double check his website
Edit: here is the link
-
-
-
Re: Can someone teach me the basics of VBA in solidworks?
Deepak Gupta Aug 22, 2014 1:43 AM (in response to Evan Dlugopolski)1 person found this helpfulIf you looking for a book, check here: SolidWorks API - Programming & Automation
If you looking for video tutorials, check here: Video Tutorials for the SolidWorks API
If you looking for examples/website for macro example, then the forum itself is full of tons of examples. SW API help files are awesome too.
Some of the other sites to look at are:
-
Re: Can someone teach me the basics of VBA in solidworks?
Amen Allah Jlili Jan 18, 2017 6:01 PM (in response to Evan Dlugopolski)Some of the questions you asked are about the fundamentals of programming.
If you do a course on VB.NET, it will all make sense to you. Try Microsoft Virtual Academy (it's free).- dim vs set
- Dim is a keyword used to declare a variable. It says to the compiler, please dimension this variable of name A to this type.
- Set is a keyword used to put a memory reference inside a variable. The variable will hold a memory reference that will point to somewhere else. Set is reserved for reference-types (*: There are exceptions here). Topic to read about here is Ref types and Values types.
- Boolean
- A Boolean a value type. A variable of type boolean can hold either true or false. The value is intrinsic. There are no references involved.
- The hierarchy. Specifically:
- .sldworks vs .solidworks????
- SldWorks is the actual namespace (something to read about) that holds almost all SOLIDWORKS objects. .SldWorks, however is the type representing the highest variable in the hierarchy in terms of access. From it, you can access all the other objects.
- SolidWorks is just a larger namespace that precedes SldWorks // Notice that intellisense shows SolidWorks & SldWorks with the same icon.
- Application is the actual SolidWorks application. Application of member of SOLIDWORKS. It has a number of members that you don't find in SldWorks.
- ModelDoc2
- ModelDoc2 (Go to the online Help). It represents all documents, hence why it's a model.
- .sldworks vs .solidworks????
- selection manager. Specifically:
- component2 (Online Help)
- GetSelectedObjectType(2, 3) : Get the type of the third object that was selected with a mark of 3. Marks are a way to allow methods to perform selections independently. If method A uses objects marked with 45, then selecting objects with a mark 3 and invoking method A wouldn't yield any desired results.
- .GetSelectedObject (2,6): Selects the object at the index 2 as marked by 6. This array is 0 based so technically speaking, it's the third object.
CHEERS
- dim vs set
-
Re: Can someone teach me the basics of VBA in solidworks?
Fernando Castro Jan 18, 2017 7:03 PM (in response to Evan Dlugopolski)i was like you some time ago, and could do a very interesting things, but it was very hard to me. and it was a lot of try and error to make things works. then i decided to learn some basic concepts of Objects oriented programming. and then i finally undertand the api help.
you could se videos od the basics of programing, this worked for me.
-
Re: Can someone teach me the basics of VBA in solidworks?
Solid Air Jan 18, 2017 8:25 PM (in response to Evan Dlugopolski)Some of the questions you ask are not solidworks but Visual Basic 6.0 which is what VBA is derived from. VB.Net is similar but not same so I would stick with VB6.