Open the room

Hello everyone,

 

I realize that I very often use the "Open Part" button in an assembly to edit the part in question.

I haven't figured out how to assign a keyboard shortcut to this "function".

 

The goal would be to select (any face) of the coin and open it on its own.

 

Do you have any ideas?


Thank you very much!

1 Like

Hello

 

If you haven't found it in the list with a right-click on a toolbar > Customize > Keyboard Onlget (there's a search box where you can type "open"), it shouldn't be possible!

 

Maybe by a macro!

 

Edit: I found a macro that allows you to directly open the drawing for the selected part in an assembly, it is attached.

A small modification could do the trick!


open_selected_component_drawing.swp_.zip
2 Likes

Hello

 

I found this maccro, I haven't tested it but according to the author, it opens your part/your sub-assembly directly by clicking on it or selecting it in the feature manager.

 

Cdt

Joss


assemblyopen.swp
4 Likes

Great macro, it works! Thank you very much!

 

To assign the macro to a keyboard shortcut:

 

http://help.solidworks.com/2012/French/SolidWorks/sldworks/t_assigning_macro_keyboard_shortcut.htm

 

 

4 Likes

I don't really see the point of putting this button as a shortcut....

 

When you click on the part in your assembly, there is a small window that opens (see image)

 

Who allows you to open the room? This is already a shortcut at the base.

 

If I understand correctly, you would like to click on the room to open, and press a key to open it?


ouvrir.png
3 Likes

@Bart

 

As a matter of habit, personally I work almost only with keyboard shortcuts. The B for example allows me to delete a component, Ctrl+D to directly open a drawing,... and several dozen others. Historically, I came here so that I didn't have to constantly look for icons.

 

I prefer it (my musician side maybe... ;) ). Everyone has their own perception of the subject.

I still have my hands on the keyboard (a lot of shortcuts).

 

My action to open the room: Select click on any face of the room + o

With the small window: Click on the part + move the mouse over the button + click.

 

I just avoid clicks (I already do quite a few...)

 

I have other direct shortcuts, I have a 5 button mouse:

 

Button 3: Measure Tool

Button 4: Normal A

Button 5: Zoom in on the selection

O: Open the part with one side selected.

F: Zoom at best

Create an assembly from: Ctrl and +

Tab: Hidden the selected component

Ctrl + Tab: Navigating between documents

F9: Hide Left Pane

E: Sketch on the selected side

 

I have others on Windows as well.

2 Likes

I'm re-opening the post because I'm having a small problem with the macro in question which is used to open the selected part in the graphic area. 

This is because the macro only works if the part is set to resolved. 

Do you know if it would be possible to integrate this into the macro, i.e.: selecting the coin in the graphic area (face or other), launching the macro: solving the coin and then opening it. 

 

I'll give you the code of the macro below: 

'***************************************************************************­***
' ASSEMBLYOPEN. SWB by Ted Griebling
' This macro will open the owning part or subassebly (if selected from the
' feature scrambler) of anything selected in an assembly.
' ***************************************************************************­***


Dim swApp As Object
Dim activeDocument As Object
Dim selEntity As Object
Dim selType As Long
Dim SelMgr As Object
Dim owningComponent As Object
Dim componentName As String
Dim part As Object
Dim componentpath As String


Const swDocPART = 1
Const swDocASSEMBLY = 2
Const swDocDRAWING = 3


Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set activeDocument = swApp.ActiveDoc


' Make sure this is not a part.
If (activeDocument.GetType = swDocPART) Then
    Exit Sub
End If


' Do something else for drawings?
If (activeDocument.GetType = swDocDRAWING) Then
    Exit Sub
End If


' Get the SelectionMgr interface
Set SelMgr = activeDocument.SelectionManager


' Obtain the selected Entity object
Set selEntity = SelMgr.GetSelectedObject3(1)


selType = SelMgr.GetSelectedObjectType2(1)

'MsgBox selType

' Types that make later parts barf
If (selType = 0) Or (selType = 42) Or (selType = 69) Then
    Exit Sub
End If


' This works grand for components selected from the feature scrambler
If (SelMgr.GetSelectedObjectType2(1) = 20) Then
    ' yes!
    activeDocument.OpenCompFile
    Exit Sub
End If


'extract the path name from the entity selected.
If (activeDocument.GetType = swDocASSEMBLY) Then
    ' Get the owning Component object
    Set owningComponent = selEntity.GetComponent
    ' Get the Component Path Name
    componentpath = owningComponent.GetPathName
    ' MsgBox componentpath
    ' Open the part in it's own window yes!
    
         Set part = swApp.ActivateDoc(componentpath)
     
    Exit Sub
End If
End Sub

 

Thank you in advance for your answers. 

Kind regards

Hello

This is normal, because the "solved" parts are loaded into memory when the assembly is opened.

I don't have my PC with me, so I can't change the macro. 

What you can do is retrieve the path of your part and open it without passing it in solved in your assembly. I think that in terms of memory, it's better to do it like this, especially if it's a big assembly.

Kind regards.