I want to automate one of our shop floor papers. We have a 1 page document with a drawing of an assembly in the top left.
I want the macro to list all the parts with some detail from the custom properties of each part. There must also be a single view drawing with some production related information.
The way it work is, you drop an assembly on the blank form. By clicking the macro button, it will create all the views, populate all the notes with the custom property info and lastly, it copies a view named "MW" from each part drawing and copy it to the correct view on this sheet.
I have done the part where I get all the views populated with the text data. I also know the full path and file name for the drawing of each part. I also know the name of the View I am interested in. I also know the name of the view in this drawing where I need to copy the drawing to.
Any hints as to where to start with this?
Copy a view from one drawing to a view in a new drawing with VBA
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Copy a view from one drawing to a view in a new drawing with VBA
Thanks, I got enough info from that sample to get my code to past the new view where I want it. Thanks againSPerman wrote: ↑Fri Aug 02, 2024 7:04 am See if this helps.
https://help.solidworks.com/2018/englis ... ple_VB.htm
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Re: Copy a view from one drawing to a view in a new drawing with VBA
Maybe my approach was wrong. I have written the macro to create predefined views which I was hoping to be able to be updated with a view from a part drawing. Since I have the name of the drawing, the full path of the drawing file and the the name of the view, Maybe I should have tried to copy the required view directly to this drawing - is that possible?
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Copy a view from one drawing to a view in a new drawing with VBA
I have now manage to get the macro running to open a specific drawing, activate a specific sheet and copy a selected view, close the drawing and paste the selection in the current drawing. The issue now is that the new drawing view is not pasted in the correct position.
Earlier in the Macro, I create predefined views to add some notes in. The position of the predefined are placed in the correct location with a x and y position. How do I align the drawing view to an existing view OR is there some wrong with my sheet scale.
Earlier in the Macro, I create predefined views to add some notes in. The position of the predefined are placed in the correct location with a x and y position. How do I align the drawing view to an existing view OR is there some wrong with my sheet scale.
Re: Copy a view from one drawing to a view in a new drawing with VBA
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Re: Copy a view from one drawing to a view in a new drawing with VBA
Thanks, I got enough info from that sample to get my code to past the new view where I want it. Thanks againSPerman wrote: ↑Fri Aug 02, 2024 7:04 am See if this helps.
https://help.solidworks.com/2018/englis ... ple_VB.htm