Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

API pan command

Status
Not open for further replies.

swmetal

Mechanical
Oct 13, 2006
58
Hi all
I am playing with custom macros and command buttons. In particular, I would like to see the code for the toolbar functions. Can I see what the actual "pan" or "mate" codes look like, for example. Thanks
 
Replies continue below

Recommended for you

Thanks FCS
Below is what was listed, doesnt work when attached to button though. Even with my limited experience, I dont see a "pan" command?
' ******************************************************************************
' C:\DOCUME~1\haydug\LOCALS~1\Temp\swx3132\Macro1.swb - macro recorded on 07/13/07 by haydug
' ******************************************************************************
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
End Sub
 
Sorry it didn't work. Some things get captured, and somethings don't. But using the macro recorder is a good first step to find out. :)

Pan may not have an actual API function. You may need to look up view functions in the API help. It's not going to be a simple one line of code. From what you described, you'll need the macro to know your current view location, and then to adjust that by so much.


Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
sw.fcsuper.com
Co-moderator of Solidworks Yahoo! Group
 
The macro recorder is almost completely useless for creating macros. It will not capture all commands and will often create a lot of unnecessary code. A much better approach is to look in the API help. In the time it took to ask this question you would have found 7 examples of programs that work with mates as well as the following methods for panning the display.

ModelDoc2::ViewTranslateminusx
ModelDoc2::ViewTranslateminusy
ModelDoc2::ViewTranslateplusx
ModelDoc2::ViewTranslateplusy

If you have a specific question about how to add mating or panning behaviour into a custom routine then you may need to provide more details about what you wish to accomplish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor