allenliuyy Posted August 24, 2009 Posted August 24, 2009 Does anybody has infromation about learning VBA programming in Inventor? i.e. books Thanks. Quote
Hickoz_bro Posted September 2, 2009 Posted September 2, 2009 I've done a little bit of VBA, and i've found that the tutorials included with Inventor to be the most useful resource available. Basically you need to start with an idea for a program/macro, then go from there... I'm assuming you have an idea to start with? Quote
allenliuyy Posted September 2, 2009 Author Posted September 2, 2009 Thank you very much for your infromation. I will look into it. Quote
allenliuyy Posted September 3, 2009 Author Posted September 3, 2009 How to get the intersecting surface or intersecting edge profile when a workplane intersects with a solidbody in VBA? For example, when a workplane intersects with a solid cylinder body, and the workplane is perpendicular to the cylinder axis, the intersecting surface should be a circle. Which method should be used in this case? Thanks. Quote
Hickoz_bro Posted September 4, 2009 Posted September 4, 2009 What information are you trying to find? are you just trying to create a sketch? or are you trying to find particular information about the intersection without creating a sketch? From my experience with VBA in Inventor, VBA can only do the same operations as you could do normally, often even less then normal, for example, currently you can create a 3D sketch that contains the intersection geometry between two surfaces, I couldn't imagine doing this in VBA would make life any easier. Perhaps i don't quite understand what your trying to achieve? Quote
allenliuyy Posted September 5, 2009 Author Posted September 5, 2009 Actually I need this intersecting 2D sketch (in the above example it is a circle). I am doing a project in my study by using Inventor. A solidbody part with Spline surface will be sliced to certain pieces as per part's length and shape, then I need to output every slice profile (2D sketches) to convert them to dxf files for further use. Thanks. Quote
allenliuyy Posted September 8, 2009 Author Posted September 8, 2009 Can any body help me to solve the above problem in VBA? Thanks. Quote
Hickoz_bro Posted September 8, 2009 Posted September 8, 2009 Can you provide an example of what your working with? I'm having trouble understanding the problem... Quote
allenliuyy Posted September 9, 2009 Author Posted September 9, 2009 Thank you Hickoz. Attached please find the pictures for the mentioned problem, hope it will be helpful. Oops, I can not attach picturs in this thread. How to do it? I will try your email later on. Quote
Hickoz_bro Posted September 9, 2009 Posted September 9, 2009 Allen, I got your e-mail, and your pics made it much clearer, I wasn't sure whether you were intersecting your solid with work planes, or splined surfaces. I've had a bit of a look, and I hate to say it, but I don't think it can be done with VBA... I've gotten so far as creating a sketch on the work planes, but you can't project cut edges into your sketch. Basically, it's just not something that's been included in the API. You can do a 'project geometry' but you can't do a 'project cut edges'. If you can get the edges projected in the sketch manually, then it won't be too hard to export them. Someone else might know of a way to achieve this, but when it comes to VBA, this is where my knowledge ends. Brian Ekins wrote a program for Inventor to import STL data into inventor, he had a method for projecting cut edges into a sketch, so I dare say it's possible. I have his e-mail address at work, so i'll see if he can stick his nose into this thread, or even just offer some advice. Anyways, This is as far as my VBA knowledge goes... Sorry I can't be of more assistance. Sub exportsectiontest() 'set definitions for expressions Dim oDoc As PartDocument Dim oComponent As Object Dim oSketch As Sketch Dim oLine As SketchLine Set oDoc = ThisApplication.ActiveDocument 'define document Set oComponent = oDoc.ComponentDefinitions.Item(1) 'define component For i = 1 To oComponent.WorkPlanes.Count Set oWorkPlane = oComponent.WorkPlanes.Item(i) Set oSketch = oComponent.Sketches.Add(oWorkPlane, True) Set oLine = oSketch.AddByProjectingEntity '***This is where you need to 'project cut edges', but it's not included in the API*** Next End Sub Quote
basiow Posted September 21, 2009 Posted September 21, 2009 somebody give us agood book tutorial for vba please Quote
Hickoz_bro Posted September 21, 2009 Posted September 21, 2009 Do a bit of a google search... http://www.amazon.com/VBA-Dummies-John-Paul-Mueller/dp/0764539892 There's bucket loads of information out there... start with the tutorials included with your program Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.