Is it possible to delete a sheet using API code?

I have a DXF macro that creates a sheet, then exports it in DXF format. I would like to delete the sheet after the DXF is saved.

Is this possible? I dont see this option in API help.

Reply to
SW Monkey
Loading thread data ...

Well, this is one of those RARE times when Macro Recorder works 100%! The following code could be modified to give you control over which sheet to delete on the fly or have the same one (same name) deleted everytime.

Dim swApp As Object Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long 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.SelectByID2("Sheet2", "SHEET", 0, 0, 0, False, 0, Nothing, 0) Part.EditDelete End Sub

Reply to
fcsuper

those RARE times when Macro Recorder works 100%!

Ill try your code out. I did try the macro recorder route, but it didnt give any good code (like most of the time). This is the code I recieved.

Dim swApp As Object Dim Part As Object Dim SelMgr As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim Feature As Object Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc Set SelMgr = Part.SelectionManager Part.EditDelete End Sub

Reply to
SW Monkey

It's funny, I tried to replicate the creation of code your macro recorder came up with and I can't figure out how to do it. I guess I'm glad of that. lol I tried deleting from the bottom tabs (produced useless, but not the same code as you), and by going to the sheet, selecting it and deleting (which did produce functioning code). The original (and cleanest) method was selecting the sheet from the feature manager.

What version of S/W are you running? I'm on 2005.

Matt

SW M> > SW M> > > I have a DXF macro that creates a sheet, then exports it in DXF format.

those RARE times when Macro Recorder works 100%!

Reply to
fcsuper

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.