×
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

Separate Drawings For Each Model?
5

Separate Drawings For Each Model?

Separate Drawings For Each Model?

(OP)
I have been keeping all of my project drawings within one file. (One drawing file per project) This means that a large assebmly will have many drawing sheets in the drawing file. - Is this typical swx practice? If so how can you switch from different sheets without scrolling to find the tab?

Thanks.

RE: Separate Drawings For Each Model?

5
I know a lot of places do all detail drawings in one file.  We don't because our assembly drawing requirements are pretty stiff, requiring quite a few views, alternate positions, sections, details, etc. that would kill performance during detailing of parts.  Also, if I want to re-use a component in a different project I can easily just copy the part and drawing files to the new job.  

If you want to be able to change sheets w/o scrolling around it would be fairly simple to write a macro that would show all the drawing sheets in a list box and switch to the selected sheet when clicked.

RE: Separate Drawings For Each Model?

Is this typical swx practice?
You will probably find all the possible variations are being used.
1 drawing (single sheet) per model file.
1 drawing set (multi sheet) per single assy & related parts.
1 drawing set (multi sheet) for all model files (assy's & parts)
1 drawing set for all assy files plus 1 drawing set per all part files.

I use the last one, as I find it handy to be able to separately print all the assy's, or all the parts.

how can you switch from different sheets without scrolling to find the tab?
I would also like to know if there is a shortcut. On larger drawing sets, I often "collapse" the sheets in the Drawing Manager then scroll & activate from there.

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: Separate Drawings For Each Model?

If this is something several people have interest in I would be glad to work on some code.  I'll have to check that FAQ on where to post files, since straight code won't cut it in this case. smile

RE: Separate Drawings For Each Model?

I do not have the specs here, but mil specs say each part has it's own dwg. If you need (and you should) to control the rev of each part and assy, make each one with own dwg.

Chris
Systems Analyst, I.S.
SolidWorks/PDMWorks 05
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716

RE: Separate Drawings For Each Model?

handleman ... What do I need to change to get this to run with SW2005?

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: Separate Drawings For Each Model?

Shouldn't be much change.  You may have to go to Tools->References in the VBA editor and see what's there.  I have (in order):

Visual Basic for Applications
SolidWorks Extensibility Type Library
OLE Automation
SldWorks 2006 Type Library
SolidWorks 2006 Constant type library
Microsoft Forms 2.0 Object Library

I would guess you'll need to reference the 2005 versions of the SW libraries.  I don't think I used anything that's unique to 2006.  

Let me know if it works...

RE: Separate Drawings For Each Model?

OK, I just deselected the "MISSING" ref's & selected the matching SW05 refs & it now works well. Once I make a shortcut it will save a couple of clicks over the collapse & select method.

Thanks handleman thumbsup2

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: Separate Drawings For Each Model?

(OP)
Got it to work. This is just what I needed. Thanks.

RE: Separate Drawings For Each Model?

Thanks handleman, I have asked for something like this on 2 occasions.  I had suggested right-clicking a sheet-tab to select a sheet.  This works even better, but I have a suggestion and want to know if it's possible.  

Whenever you run this macro, the top sheet (sheet1 for example) in the dialog-box is highlighted with a gray outline.  Would it be possible for it to highlight the current sheet that your on?  

Flores
SW06 SP4.0

RE: Separate Drawings For Each Model?

No problem, smcadman.  Below is the entire code for the main() portion of the macro with the addition of highlighting the current sheet.  I streamlined the code a little bit, eliminating some intermediate variables that really weren't needed.  

If you're just starting out with this macro you'll still need to download it, since it includes a user form.  Once you've downloaded it, you can edit it and replace the code in the SwitchSheets1 module with the code below.

CODE

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swDwgDoc As SldWorks.DrawingDoc


Sub main()

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc

If swDoc.GetType <> swDocDRAWING Then
    MsgBox "Please open a drawing document to use this macro."
    Exit Sub
End If

Set swDwgDoc = swDoc
SheetPick.ShtNameBox.List = swDwgDoc.GetSheetNames
SheetPick.ShtNameBox.Value = swDwgDoc.GetCurrentSheet.GetName
SheetPick.Show
While SheetPick.Visible
    DoEvents 'Wait
Wend

If SheetPick.ShtNameBox.Value <> "" Then
    swDwgDoc.ActivateSheet SheetPick.ShtNameBox.Value
End If

Unload SheetPick
Set swDwgDoc = Nothing
Set swDoc = Nothing
Set swApp = Nothing

End Sub

RE: Separate Drawings For Each Model?

handleman You Rock!  One oddity is now the dialog-box only pops up on my 2nd monitor, even if I drag it to the 1st monitor and pick a sheet.  I AM NOT COMPLAINING, that was just a side note, great job.  
 
Flores
SW06 SP4.0

RE: Separate Drawings For Each Model?

Thanks, smcadman!  You can fiddle with the dialog box to make it open up where you want it.  Click on the SheetPick form and view its properties.  The ones that control the location are StartUpPosition, Left, and Top.  The default StartUpPosition is CenterOwner, and each StartUpPosition will give you different behavior.  The other wrinkle is that whatever multi-monitor software you're using, if any, can also grab dialog boxes and reposition them where it wants to.  If you want it to open consistently in the same spot every time then you can change StartUpPosition to Manual and play with the Top and Left properties until it opens where you want it.

Have fun!

RE: Separate Drawings For Each Model?

smcadman,

in the control panel veiw of your dual monitor setup, do you have your monitors set with #2 on the left and #1 on the right. If so, windows adresses this #2 monitor with negative values, and since top left is called for in startup windows adresses this with the lowes display values (-x,0) rather than (0,0) which is always the value of the upper left pixel in #1.

Nice macro handleman.

RE: Separate Drawings For Each Model?

The left monitor is setup as #1.  Not sure if this was the correct way of fixing it, but I set the StartUpPosition to "CenterOwner", and changed the Left to "-150".  Whenever I had set StartUpPosition to manual, I was having to move the dialog to the left and downward.   

Flores
SW06 SP4.0

RE: Separate Drawings For Each Model?

handleman ... The above macro has stopped working for me, and I have noticed that the Microsoft Forms 2.0 Object Library is no longer available. Was that part of the download you provided? If so would you mind posting a new link for it ... the one posted no longer works.

cheers
Helpful SW websites FAQ559-520
How to find answers ... FAQ559-1091

RE: Separate Drawings For Each Model?

That's odd... have you recently updated Office or Windows?  The controls I used were very basic, so I believe you should be able to reference any version of the Microsoft Forms Object Library.  There should be some version already on your system.  It's the same library that all VBA stuff accesses.

RE: Separate Drawings For Each Model?

When I downloaded the macro I had SW05 installed. Since then I have completely uninstalled SW05 and installed both SW06-SP5 & SW07-SP1.

Both Office & Windows have been updated with whatever the Microsoft Update utility had to offer.

cheers
Helpful SW websites FAQ559-520
How to find answers ... FAQ559-1091

RE: Separate Drawings For Each Model?

So do you have some version of the Forms library to choose?

RE: Separate Drawings For Each Model?

Nope ... I've just scanned through every line of the Tools > References but could not see one Forms Library.

cheers
Helpful SW websites FAQ559-520
How to find answers ... FAQ559-1091

RE: Separate Drawings For Each Model?

The filename for the library is FM20.dll.  It should be installed along with Office.  If it's on your PC then you may just have to register it with "regsvr32 [path to fm20.dll]".

RE: Separate Drawings For Each Model?

[b]handleman ... you-da-man ... I had to reboot after registering the dll, but the macro is now working again.

I can't give you another star so hope you'll settle for a 2thumbsup instead.

Many thanks.

cheers
Helpful SW websites FAQ559-520
How to find answers ... FAQ559-1091

RE: Separate Drawings For Each Model?

Glad to help.  If the dll was on your system but not registered it could be that your Office install was either incomplete or got corrupted.  Office should have registered that dll when you installed it.  If everything else works OK for now then I'd just file this away in the back of your head in case Office does anything else screwy.

Have a great day!

RE: Separate Drawings For Each Model?

handleman,

Could you update the download link for the macro?

Thanks,
Ken

RE: Separate Drawings For Each Model?

Sure - I'll try to remember to get it tomorrow.  Already home for the day.  smile

RE: Separate Drawings For Each Model?

As promised, here is an updated link to the sheet pick macro.  

I went ahead and included another macro called "DocPick" that does a similar function for all open files.  I wrote it because for some reason whenever I get more than 10 windows open the Window commands get very unreliable, especially the Window->More Windows dialog.  When run, it shows a dialog box with three list boxes showing the names of all open windows in alphabetical order; one for parts, one for drawings, and one for assemblies.  It also gives you a count of all documents that are open, including those that are open but not visible (due to assembly/drawing being open).  Clicking on any of the file names in the list boxes will activate that window.  When you release the mouse button the macro will quit.  If you move the cursor to another document in the list before releasing the mouse button then it will activate the new document.  If you want to activate the window but not close the macro you can press the Shift key before releasing the mouse button.  Checking the "Double click closes file" box will also keep the macro open after single-clicking any document name.  Of course, it also does what it sounds like - double-clicking will close that window, prompting for save if necessary.  Of course, the file itself will stay open if it's referenced by any open drawing or assembly.  

Enjoy!

RE: Separate Drawings For Each Model?

I think DocPick is handy, and it has a feature that would be great on SwitchSheets.   That feature is holding down the shift key to pick different items.  If that feature was on SwitchSheets, you could "preview" the sheets before you dismiss the dialog box.  

If not the "hold shift down to keep box active", then maybe a checkbox or "OK" button to dismiss it.

Helpful if you have 20+ sheets and you're not exactly sure what sheet a particular model it's on.

SW06 SP5.0

Flores

RE: Separate Drawings For Each Model?

Definitely possible.  I'll check into it.  It may be tomorrow, though.

RE: Separate Drawings For Each Model?

Here it is.  The new version is called SheetPick to highlight its feature that was added from DocPick at Flores' suggestion.  I also added automatic sizing so that the dialog box will only be as big as it needs to be to hold the number of sheets in the drawing.  After it gets up to about 20-something sheets it will quit growing and start scrolling.  I thought about adding automatic sizing to DocPick, but due to the added complexity of having several boxes I don't think it's worth the effort.  Anyway, hope this saves you a few clicks!

RE: Separate Drawings For Each Model?

Handleman, you rock as always!  SW07 made a measly attempt at improving sheet tabs by adding a little button for first sheet, and last sheet.  Your macro is a vast improvement.

On a side note, one of my side mouse buttons is Shift, so I do not even have to take my hand off of the mouse to pick different sheets.  I guess I could program the Spaceball for that also.

SW06 SP5.0

Flores

RE: Separate Drawings For Each Model?

I am trying to download this macro but, when I click on "Click Here To Download" I get a "Page cannot be displayed" error message. Does anyone know what to change in my browser to be able to do the download. I am using MS Internet Explorer 6.0.

RE: Separate Drawings For Each Model?

Try right-clicking and choosing "Save target as".  It sounds like there's something screwy in your browser that is making it try to open the zip file with IE as a web page.

RE: Separate Drawings For Each Model?

I've already tried that but still didn't work. I'll try to download it at home and send it to work by email.

RE: Separate Drawings For Each Model?

Try this link.  I did add auto-sizing to the DocPick after all.  And I handled the error that occurs when you either double-click to close the last file or hit refresh with nothing open.  Enjoy!

RE: Separate Drawings For Each Model?

This link worked nice. I was able to use the other one as well but only from my home computer. Thank you.

RE: Separate Drawings For Each Model?

Nice macros Handleman. When I use DocPick though, the window that comes up for the form only shows parts and I cannot expand it to show the drawings and assemblies. Any ideas?
Carl

RE: Separate Drawings For Each Model?

It should show all documents that are open.  Each list box on the form expands to hold all the documents of that type that are open.  However, it doesn't refresh on its own.  If you run the macro and then open files you have to hit the refresh button.

RE: Separate Drawings For Each Model?

I opened parts and drawings and the whole form just doesn't show up. It only shows the top part where the parts are. It looks like a window that just needs to be pulled down to reveal the rest but it is fixed at the size that it opens.
Oh well, these are the kinds of little problems that motivate me to learn more about how things work. Macros in this case.
Thanks again for your efforts with these.

RE: Separate Drawings For Each Model?

carlbud, it is working perfectly here, but if the latest one with auto-size doesn't work, then try the one above which doesn't have auto-size on it.  

SW06 SP5.0  

Flores

RE: Separate Drawings For Each Model?

That did it. It works perfectly for me without the auto size.
Thanks

RE: Separate Drawings For Each Model?

I think I've found the issue with autosizing.  I was setting the list box heights and then using the height property later to calculate positions and the overall form size.  What I believe was happening was that the command to set the heights wasn't getting fully processed by the form before I queried it later in the macro.  Not only was I getting erroneous data back to calculate other heights, I believe the querying itself was disrupting the setting of the height, so nothing looked right at all!  I thought I had fixed it by moving the querying code to the end of the macro, but I guess it depends on your PC how fast each bit of processing goes.  To make a long story short, I've now changed to storing the list box height in a variable rather than querying after setting, so the autosizing should work now.  I also added an event handler to automatically refresh the form whenever a file is opened.  It works when you open a file with either the open dialog or right-click on a component in an assembly or drawing and choose "Open [Part/Assembly]", even if that document is already open but "hidden" (does not have a window).  However, it will not refresh if you have a macro/program that shows an "open but hidden" document with the ActivateDoc method.  In that case you'll have to hit the refresh button.  Enjoy!

(OOPS! I almost forgot to link to the file!)

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