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!

edit sheet to edit sheet format macro?

Status
Not open for further replies.

DHALE1

Mechanical
Jan 8, 2003
61
I want a macro to toggle between edit sheet and edit sheet format. I have been able to get one to go from edit sheet to edit sheet format, and another to go from edit sheet format to edit sheet. What I really want is one that will toggle to the other no matter which one I am in. I tried combining the two, but must be missing something. Anyone have any ideas?

Thanks

 
Replies continue below

Recommended for you


If I might ask???????

How is this macro going to be easier (or faster) to use than a simple right-click on the drawing backgound.



Remember...
"If you don't use your head,
your going to have to use your feet."
 
Anyway you obviously have the API calls to cahnge back and forth, all you need to do is to first ask for it to return the value of the current setting and then use retval in a simple IF-THEN statement to apply one or the other.



Remember...
"If you don't use your head,
your going to have to use your feet."
 
I would like to program the macro to a key on the keyboard. This is similar to another cad package we have used previously. I tried the if-then statement and was not getting it to work.
 
Can you post what you've got so far?



Remember...
"If you don't use your head,
your going to have to use your feet."
 
Since I was going to get around to writing a macro anyway to edit specific notes we have in our sheet templates at some point in time. This will serve your purpose and get me started......

Option Explicit

' *********************************************
' Edit Sheet/Sheet Format Toggle
' *********************************************

Dim swApp As Object
Dim DwgDoc As Object
Dim retval As Boolean

Sub main()

Set swApp = CreateObject("SldWorks.Application")
Set DwgDoc = swApp.ActiveDoc

retval = DwgDoc.GetEditSheet()
'True if currently editting sheet, False if currently editting template

If retval = True Then
DwgDoc.EditTemplate

Else
DwgDoc.EditSheet

End If

Set DwgDoc = Nothing
Set swApp = Nothing

End Sub




Remember...
"If you don't use your head,
your going to have to use your feet."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor