Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Delete a Design Table from a Macro

Status
Not open for further replies.

oorah

Mechanical
Jul 29, 2003
10
Hello,

How do I delete a Design Table from a part file within a macro? The recored code for this is listed below. This code will not work unless the DT is actually selected before running the macro. The boolean status line doesn't really select the DT. The real question then is "How do I select the DT so I can delete it?"

Thanks.

Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID("Design Table", "DESIGNTABLE", 0, 0, 0, False, 0, Nothing)
Part.EditDelete
End Sub
 
Replies continue below

Recommended for you

Set DesTable = Part.GetDesignTable ( )
DesTableName = DesTable.GetTitle ( )
boolstatus = Part.Extension.SelectByID(Des TableName, "DESIGNTABLE", 0, 0, 0, False, 0, Nothing)
Part.EditDelete

An untried shot in the dark. Might get you started in the right direction.

[bat]Good and evil: wrap them up and disguise it as people.[bat]
 
TheTick,

Thanks for the fast response. The code still doesn't select the DT though, so the macro just runs through and ends without deleting the DT. - Oorah
 
I tried by Step-in Mode (F8) and found that DesTableName is empty and boolstatus becomes FALSE.

Eventually I get an error "None of selected entities could be deleted."
 
I was discussing something similar with one of our guys who does a lot of API and macro coding for special in house tools. It appears that to do anything with DT's you need to have the part/assembly file open and VISIBLE. odd....... but maybe worth a try.

3/4 of all the Spam produced goes to Hawaii - shame that's not true of SPAM also.......
 
Yes, I have a part file open and visible. The macro will work if I first select the DT by clicking on it once with the mouse, otherwise it just runs without deleting the DT or returns the error that LoveAeris mentioned. I'm hoping to find the code that will do the same thing as clicking on the DT once with the mouse. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor