Are there any existing Macros to find any and all live Dynamic Dimensions and turn them off? I work for a sign company that requires I work with multiple pages with multiple elevations at multiple scales. I have my dimensions set to be automatically off (not dynamic) after I use them, so when a client requires an increase in the size of the sign all I have to do is turn them back on, increase the size and then turn them back off. This system works most of the time, however mistakes happen and sometimes I forget to turn the Dynamic Dimensions off and thus when I change the global scale on a separate elevation that one dimension would then be wrong.
This is why I would love a macro that could check my entire document, and flag all the still live dynamic dimensions. Another option would be a macro that automatically turns of all dynamic dimensions when pressed. I would then use this system page by page. I understand there are similar macros that will automatically break dimensions apart, however if at all possible I would love to just keep them live but still in the off position.
Obviously the perfect solution would be for Corel to let users set the scale per page, but seeing how people have been asking for this for 7+ years... I don't even get my hopes up for that anymore.
For stability I use X6, However I do use and have access to CorelDraw 18 as well.
This is my first time posting on the forum, so thank you to everyone who has helped me solve a problem in the past!
This way of doing it is sort of ugly, but in my limited testing, it seems to work. I have it excluding individually locked objects and objects on locked layers:
Sub set_dims_non_dynamic() Dim srDynamic As ShapeRange Dim s As Shape On Error GoTo ErrHandler Set srDynamic = ActivePage.Shapes.FindShapes(, cdrLinearDimensionShape, , "@com.dimension.dynamictext='True' and @com.locked = 'False' and @com.layer.editable = 'True'") For Each s In srDynamic s.CreateSelection Application.FrameWork.Automation.InvokeItem "fdaf006a-eeb2-38bb-409b-40b9c7abac44" Next s srDynamic.CreateSelection MsgBox "Number of dimensions changed to non-dynamic: " & srDynamic.Count ExitSub: Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "set_dims_non_dynamic()", vbCritical Resume ExitSub End Sub
Here is one that uses the same criteria for finding objects, but doesn't change them; just selects them.
Sub select_dynamic_dims() Dim srDynamic As ShapeRange On Error GoTo ErrHandler Set srDynamic = ActivePage.Shapes.FindShapes(, cdrLinearDimensionShape, , "@com.dimension.dynamictext='True' and @com.locked = 'False' and @com.layer.editable = 'True'") If srDynamic.Count > 0 Then srDynamic.CreateSelection Else MsgBox "No selectable dynamic dimensions were found." End If ExitSub: Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "select_dynamic_dims()", vbCritical Resume ExitSub End Sub
Here's a link to a .zip file that contains a .GMS file with those two subs in it:
JQ_dynamic_dims_2019_08_23_1636.zip
.
Instead of changing my first post, I'll add this as a new one. As before, I have it excluding individually locked objects and objects on locked layers: This version has three subs in it:
JQ_dynamic_dims_2019_08_23_1804.zip
The code looks like this now:
Option Explicit Sub select_dynamic_dims() Dim srDynamic As ShapeRange On Error GoTo ErrHandler If Not ActiveDocument Is Nothing Then Set srDynamic = ActivePage.Shapes.FindShapes(, cdrLinearDimensionShape, , "@com.dimension.dynamictext='True' and @com.locked = 'False' and @com.layer.editable = 'True'") If srDynamic.Count > 0 Then srDynamic.CreateSelection Else ActiveDocument.ClearSelection MsgBox "No selectable dynamic dimensions were found." End If Else MsgBox "No document is active." End If ExitSub: Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "select_dynamic_dims()", vbCritical Resume ExitSub End Sub Sub set_dims_non_dynamic_current_page() Dim lngChangedCount As Long On Error GoTo ErrHandler If Not ActiveDocument Is Nothing Then set_dims_non_dynamic_page ActivePage, lngChangedCount MsgBox "Number dimensions changed to non-dynamic: " & lngChangedCount Else MsgBox "No document is active." End If ExitSub: Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "set_dims_non_dynamic()", vbCritical Resume ExitSub End Sub Sub set_dims_non_dynamic_all_pages() Dim pageRemembered As Page Dim pageThis As Page Dim lngChangedCountPage As Long Dim lngChangedCountTotal As Long On Error GoTo ErrHandler If Not ActiveDocument Is Nothing Then Set pageRemembered = ActivePage For Each pageThis In ActiveDocument.Pages set_dims_non_dynamic_page pageThis, lngChangedCountPage lngChangedCountTotal = lngChangedCountTotal + lngChangedCountPage Next pageThis pageRemembered.Activate MsgBox "Total number of dimensions changed to non-dynamic (all pages): " & lngChangedCountTotal Else MsgBox "No document is active." End If ExitSub: Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "set_dims_non_dynamic_all_pages()", vbCritical Resume ExitSub End Sub Sub set_dims_non_dynamic_page(ByRef Page As Page, Optional ByRef ChangedCount As Long) Dim srDynamic As ShapeRange Dim s As Shape On Error GoTo ErrHandler Page.Activate Set srDynamic = ActivePage.Shapes.FindShapes(, cdrLinearDimensionShape, , "@com.dimension.dynamictext='True' and @com.locked = 'False' and @com.layer.editable = 'True'") For Each s In srDynamic s.CreateSelection Application.FrameWork.Automation.InvokeItem "fdaf006a-eeb2-38bb-409b-40b9c7abac44" Next s ChangedCount = srDynamic.Count ExitSub: Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "set_dims_non_dynamic_page()", vbCritical Resume ExitSub End Sub
Wow! Thank you so much for such quick and comprehensive solutions! I'm at home at the moment, so I haven't tested them yet, but first thing Monday I'll give them a shot. Thanks again!