×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Delete a Design Table from a Macro

Delete a Design Table from a Macro

Delete a Design Table from a Macro

(OP)
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

RE: Delete a Design Table from a Macro

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.

Good and evil: wrap them up and disguise it as people.

RE: Delete a Design Table from a Macro

(OP)
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

RE: Delete a Design Table from a Macro

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."

RE: Delete a Design Table from a Macro

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

RE: Delete a Design Table from a Macro

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources