×
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

API pan command

API pan command

API pan command

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

RE: API pan command

Use the macro recorder and perform the function you wish to use.  Also, look through the SolidWorks API help.  

Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
sw.fcsuper.com
Co-moderator of Solidworks Yahoo! Group

RE: API pan command

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

RE: API pan command

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

RE: API pan command

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.

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