Defining a plane in a VB script from 3 points

Guys I require the syntax to define a plane from 3 points to be executed in a vb macro. The SW API help is horrible, any help would be appreciated.

Reply to
Ben
Loading thread data ...

The API help makes more sense if you are literate in C or VBA.

Reply to
That70sTick

Option Explicit

Dim swApp As SldWorks.SldWorks Dim aDoc As SldWorks.ModelDoc2 Dim SelMgr As SldWorks.SelectionMgr Dim NewPlane As SldWorks.RefPlane

Sub main() On Error Resume Next

Set swApp = Application.SldWorks Set aDoc = swApp.ActiveDoc If aDoc Is Nothing Or (aDoc.GetType 1 And aDoc.GetType 2) Then MsgBox "Active doc not a part or assembly.": GoTo ExitStrategy 'no active doc or doc not assembly or part Set SelMgr = aDoc.SelectionManager If SelMgr.GetSelectedObjectCount < 3 Then MsgBox "Not enough objects selected to make a plane through 3 points.": GoTo ExitStrategy

Set NewPlane = aDoc.CreatePlaneThru3Points3(True) aDoc.EditRebuild3

If NewPlane Is Nothing Then MsgBox "Failed to create plane. Wise up! Be sure you have three points seleted before starting."

'clean up objects before exiting ExitStrategy: Set NewPlane = Nothing Set SelMgr = Nothing Set aDoc = Nothing Set swApp = Nothing End End Sub

Reply to
That70sTick

Great thanks

Reply to
Ben

OK, so now on my new plane, in a macro, how can i generate a set of concentric circles with radii 12,10 (mm)

generated plane, not on it.

THanks

Reply to
Ben

If you want to do anything useful with macros, you need to learn VBA and understand object-oriented programming. Recording barely gets you started.

Reply to
That70sTick

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.