-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Tom Stypula Feb 9, 2012 5:53 PM (in response to Tom Stypula)BTW, I am using SW 2011 x64 SP3.0.
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Wayne Matus Feb 9, 2012 9:41 PM (in response to Tom Stypula)Download the API training manual from the SolidWorks website. In the Drawings lesson, they have an example of exactly what you are after.
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Tom Stypula Feb 10, 2012 1:15 PM (in response to Wayne Matus)Thanks for the link. That is a good start but that macro renames the sheets to the configuration name. I still need to be able to change the sheet names to the "itemnumber" property instead of configuration name.
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Vinoth Kumar Feb 17, 2012 6:32 AM (in response to Tom Stypula)I just modified the macro avialable in the link.. See the lines of code in bold..
Dim swCustPropMgr As CustomPropertyManager
Dim strSheetName As String
For i = 0 To UBound(ConfigNamesArray)
ConfigName = ConfigNamesArray(i)
Set swCustPropMgr = swModel.Extension.CustomPropertyManager(ConfigName)
strSheetName = swCustPropMgr.Get("itemnumber")
retval = swDraw.NewSheet3(strSheetName, TemplateSize, _
PaperSize, ScaleNum, ScaleDenom, Not ThirdAngle, "", _
0#, 0#, "")
....it goes like that
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Tom Stypula Mar 1, 2012 12:22 PM (in response to Vinoth Kumar)I appreciate the help everyone. Vinoth, your suggested changes worked great for me. Thank you very much.
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Tommy Stypula May 16, 2018 2:13 PM (in response to Vinoth Kumar)Apparently I am trying to do this again. I used this macro at my old job and now that I have moved on I do not have access to it anymore so I am trying to develop it again. When I download the macro from the link posted above from the API Fundamentals training it errors out with this:
Run-time error '91':
Object variable or With block variable not set
Then it highlights this area in the macro.
Any ideas why this would be happening? I want to get the basic macro operational and then will attempt to add Vinoth's changes but I need to get the basic one running first. I am still a dummie when it comes to macros. I am running SW 2016 SP5.0 and downloaded the macro from the 2016 API Fundamentals training materials.
-
Drawing Automation.swp.zip 9.2 KB
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Tommy Stypula May 16, 2018 2:29 PM (in response to Tommy Stypula)Ok, it turns out I was able to get this to work. I had to download the training material from the 2011 version of SW instead of 2016. However the macro simply generates a drawing file for a given part and creates a drawing sheet for each configuration and names the sheets as the custom property (in my new case I am using the custom property "description").
So, is there a way to modify the attached macro to make it take an existing drawing with one part already shown on each sheet and rename the sheets to the "description" property for the part shown on the drawing sheet?
-
-
-
-
-
Re: Macro to insert drawing sheets of each configuration and rename sheets to SW property?
Anjani Ojha Feb 9, 2012 11:50 PM (in response to Tom Stypula)Hi Tom,
check the attached macro ( From API Fundamental which Wayne has referred).
-
Drawing Automation.rar.zip 7.7 KB
-