Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Manual Selection from view -> API Macro

Status
Not open for further replies.

Ponza85

Bioengineer
Feb 3, 2011
6
Hi to everybody..

Within the Macro I'm going to create, there is a part in which I wish to get some entities selections from an assembly.

I explain it better.

At a certain point of the macro, an assembly is opened.
A CommandButton in a Form says "Select the XXXX plane".

The macro now has to wait in standby that I select manually the plane I desire from the Assembly view, "store" this selection in a variable and then, create a "Plane1" which is coincident with that plane of my selection.

This is the code I thought to, but I'm on the wrong way .. :(
I wish you can help me..
thanks a lot.

Dim swApp As SldWorks.SldWorks

Dim feature As Object

Dim SelMgr As SelectionMgr



Set swApp = Application.SldWorks

Set Assembly = swApp.ActiveDoc

Set SelMgr = Assembly.SelectionManager
'***************************************

Form.Hide



Set feature = SelMgr.GetSelectedObject6(1, 0)


feature = Assembly.GetSelectedItems()



Set feature = Assembly.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraint_Coincident, 0, 0, 0, 0, 0)
 
Replies continue below

Recommended for you

I add only a comment...

If I use this option:

boolstatus = Assembly.Extension.SelectByID2("", "", 0, 0, 0, False, 0, Nothing, 0)



Set feature = Assembly.FeatureManager.InsertRefPlane(swRefPlaneReferenceConstraint_Coincident, 0, 0, 0, 0, 0)

a plane is created, BUT the macro doesn't wait my manual selection. The plane created is coincident to another plane I don't want..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor