Jump to content

Recommended Posts

Posted

Does anybody has infromation about learning VBA programming in Inventor? i.e. books

 

Thanks.:geek:

  • 2 weeks later...
Posted

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?

Posted

Thank you very much for your infromation. I will look into it.:)

Posted

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.:geek:

Posted

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?

Posted

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. :geek:

Posted

Can any body help me to solve the above problem in VBA?

Thanks.:geek:

Posted

Can you provide an example of what your working with? I'm having trouble understanding the problem...

Posted

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.:geek:

Posted

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

  • 2 weeks later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...