Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Default and custom view mapped to number pad

Status
Not open for further replies.

rstupplebeen

Mechanical
Joined
May 9, 2007
Messages
1,281
Location
US
Awhile back I remember seeing a thread about mapping views to the number pad similar to an unfolded box with:
5 top
2 front
0 bottom
8 back
4 left
6 right
period normal to view
I have implemented these as hot keys and it is very intuitive. I would also like to map 7,9,1,3 as 45deg isometric views of the top corners and ctrl+# as the bottom corners. Is this possible? Can custom views be added to shortcuts? Can these custom views be saved in a default template? If none of those work then I guess I could make a macro that is mapped to the keys for the corresponding view. Any thoughts? Thanks.
Rob Stupplebeen
 
Custom views can be save in a template.

As far as I remember, only standard views can be shortcut assigned. However, you could create a small macro for each of those other views and program the keystroke for them.

Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
 
These already exist with the F keys.
F1 = Front
F2 = Back
F3 = LS
F4 = RS
F5 = Top
F6 = Bottom
F7 = Isometric
F8 = Normal to

[cheers]
 
CBL, there's a thing I've seen before that I think Rob is referring to where the numeric keypad is programmed with those views in the same orientation as a 3-Angle projected box is unfolded. That part is easy enough. It's the custom views that post a little challenge.

Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
 
Ahh, I understand now. Thanks Matt.

Two points though;

What do you do when typing actual numbers? Do you have to use the main keyboard keys?

For me, 5 would be the 'logical' Front.

[cheers]
 
Works just the same as mapping shortcuts to a letter key. I have tons of shortcuts mapped to unmodified keystrokes. SW knows when you oughtta be typing (like when the cursor is in a text box or a note) and disables those shortcuts. Most of the time. Very occasionally (maybe once per month, if that often), SW will get messed up and the place where I'm typing will not receive any keystrokes are mapped to shortcuts. In that case I have to restart SW.

I guess which key is logical front depends on how you're used to looking at stuff. I suppose the "box" won't actually unfold correctly unless 5 is the front. It will never actually "unfold" properly if the back view is in line vertically with the top/front views since SW shows the back view right side up. If it unfolded correctly from a 5 top to an 8 back then the part would be upside down. To unfold the back view properly, it would have to be in line horizontally with the front - like

Code:
      Top
       8

Left  Frt  Rght Back
 4     5     6    +

      Btm
       1

-handleman, CSWP (The new, easy test)
 
Like Matt suggested, I have 7,9,1,3 mapped to macros. However, in my case the macros rotate the model to achieve an iso view from the current view. It comes in handy when I need an iso from a view other than Front.
 
Here's a macro that was created many moons ago by Lee Bell and Wayne Tiffany that does what you want. Even works in drawings.

Steve R.
 
Thank you all. Sorry for my slow response back, I was away on travel. I took the 8 iso views macro and changed it so that there was 1 macro for each view and then mapped each macro to a #. In the macros there is a zoom to fit which causes there to be an animation. Does any body know how to get rid of this? One of the macros is below. Thanks again.
Rob Stupplebeen

' ******************************************************
' ISOViews.swp – Recorded on 12/20/01 by Mike J. Wilson
' ISOViews.swp – Updated on 6/7/05 by Heckler
' ******************************************************

Sub main()

Set swApp = CreateObject("SldWorks.Application")

Set Part = swApp.ActiveDoc

pi = 4 * Atn(1)
Z = Tan(30 * pi / 180)
X = Atn(Z / Sqr(-Z * Z + 1))
Y = -45 * pi / 180

Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter -X, Y
Part.ViewZoomtofit

Set Part = Nothing
Set swApp = Nothing

Set swApp = Application.SldWorks
End Sub

 
On your system options, "View" category, turn all "Transitions" to off.

-handleman, CSWP (The new, easy test)
 
Here is the final macro that I settled on. I break out each view and map them to an icon and a numberpad+ (ctrl, alt or shift) to get all the views on the fly. Next to the name of the views I put the shortcut I use as a comment. I have made a multi-sided die to help explain the views. Hope this helps.

Rob Stupplebeen

' ******************************************************
' ISOViews.swp – Recorded on 12/20/01 by Mike J. Wilson
' ISOViews.swp – Updated on 6/7/05 by Heckler
' ISOViews.swp – Updated on 6/3/08 by Stupplebeen
' ******************************************************
Sub main()

Set swApp = CreateObject("SldWorks.Application")

Set Part = swApp.ActiveDoc

pi = 4 * Atn(1)
Z = Tan(30 * pi / 180)
X = Atn(Z / Sqr(-Z * Z + 1))
Y = -45 * pi / 180

Part.DeleteNamedView "ISO-TRF" '3
Part.DeleteNamedView "ISO-TRB" '9
Part.DeleteNamedView "ISO-TLF" '1
Part.DeleteNamedView "ISO-TLB" '7

Part.DeleteNamedView "ISO-BRF" '3C
Part.DeleteNamedView "ISO-BRB" '9C
Part.DeleteNamedView "ISO-BLF" '1C
Part.DeleteNamedView "ISO-BLB" '7C

Part.DeleteNamedView "45-TF" '2A
Part.DeleteNamedView "45-TR" '6A
Part.DeleteNamedView "45-TB" '8A
Part.DeleteNamedView "45-TL" '4A

Part.DeleteNamedView "45-BF" '2C
Part.DeleteNamedView "45-BR" '6C
Part.DeleteNamedView "45-BB" '8C
Part.DeleteNamedView "45-BL" '4C

Part.DeleteNamedView "45-RF" '3A
Part.DeleteNamedView "45-RB" '9A
Part.DeleteNamedView "45-LF" '1A
Part.DeleteNamedView "45-LB" '7A


Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView "ISO-TRF"

Part.ShowNamedView2 "*Right", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView "ISO-TRB"

Part.ShowNamedView2 "*Left", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView "ISO-TLF"

Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter X, Y
Part.ViewZoomtofit
Part.NameView "ISO-TLB"

Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter -X, Y
Part.ViewZoomtofit
Part.NameView "ISO-BRF"

Part.ShowNamedView2 "*Right", -1
Part.ActiveView().RotateAboutCenter -X, Y
Part.ViewZoomtofit
Part.NameView "ISO-BRB"

Part.ShowNamedView2 "*Left", -1
Part.ActiveView().RotateAboutCenter -X, Y
Part.ViewZoomtofit
Part.NameView "ISO-BLF"

Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter -X, Y
Part.ViewZoomtofit
Part.NameView "ISO-BLB"

Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter -Y, 0
Part.ViewZoomtofit
Part.NameView "45-TF"

Part.ShowNamedView2 "*Right", -1
Part.ActiveView().RotateAboutCenter -Y, 0
Part.ViewZoomtofit
Part.NameView "45-TR"

Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter -Y, 0
Part.ViewZoomtofit
Part.NameView "45-TB"

Part.ShowNamedView2 "*Left", -1
Part.ActiveView().RotateAboutCenter -Y, 0
Part.ViewZoomtofit
Part.NameView "45-TL"

Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter Y, 0
Part.ViewZoomtofit
Part.NameView "45-BF"

Part.ShowNamedView2 "*Right", -1
Part.ActiveView().RotateAboutCenter Y, 0
Part.ViewZoomtofit
Part.NameView "45-BR"

Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter Y, 0
Part.ViewZoomtofit
Part.NameView "45-BB"

Part.ShowNamedView2 "*Left", -1
Part.ActiveView().RotateAboutCenter Y, 0
Part.ViewZoomtofit
Part.NameView "45-BL"

Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter 0, Y
Part.ViewZoomtofit
Part.NameView "45-RF"

Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter 0, -Y
Part.ViewZoomtofit
Part.NameView "45-RB"

Part.ShowNamedView2 "*Front", -1
Part.ActiveView().RotateAboutCenter 0, -Y
Part.ViewZoomtofit
Part.NameView "45-LF"

Part.ShowNamedView2 "*Back", -1
Part.ActiveView().RotateAboutCenter 0, Y
Part.ViewZoomtofit
Part.NameView "45-LB"

Set Part = Nothing
Set swApp = Nothing

Set swApp = Application.SldWorks
End Sub
 
 http://files.engineering.com/getfile.aspx?folder=b59824a1-e8b5-4c4a-b3ba-06a5de386c08&file=Die.SLDPRT
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top