OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Thread Tools Search this Thread Display Modes
Old 05-07-2006, 22:09
Posts: n/a
Default Display Current Scale

I'm a technical designer by trade, and I use Corel V12 to create detailed CAD drawings with dimensions and geometry scaled as precisely as possible. In the creation of these drawings, it becomes necessary to change scale very frequently for different drawing views or different sheets in a drawing set. I needed a one-click shortcut for changing the ruler scale, and I found a solution on Google Groups. I'm not a VBA expert, but I used a macro to set up a toolbar with custom buttons representing the most commonly used architectural scale factors.

Well, it works BEAUTIFULLY! With one click, I'm in the desired scale, and life is good. There is one small caveat, however, and I hope that I can find an answer to complete my toolbar. There is still no clear way to find out what the current World scale factor is at any given moment. In AutoCAD, for example, there's a text box that displays the current sheet scale. When in doubt, all you have to do is look up and there it is. I need some way of keeping track of what scale I'm currently in.

I thought about making the buttons toggle on and off as an indicator, or having a status bar field that will update each time the world scale changes. I also thought about changing my toolbar to a drop down list that would display the current selection at all times. Being a VBA novice, I have much to learn before I can proceed. Does anyone have any ideas on how I might accomplish this goal?

The original message from Google Groups is quoted below:

Topic in corel.graphic_apps.draw10
Scale Tool
From: Alex Vakulenko - view profile
Date: Fri, Nov 2 2001 8:05 pm
Email: "Alex Vakulenko" <a...@vakcer.com>
Groups: corel.graphic_apps.draw10


> However, worse than that is that to change the scale, I have to go thru 4
> steps: double click on the ruler, Edit Scale on the button, set the new
> desired scale and click ok twice! I tried to create customized buttons to
> scale values but I couldn't figure out if it is possible. I think it
> isn't...

It is possible to do in CorelDRAW 10 through VBA. Open VBA Editor (Alt-F11).
[You might need to install it, if you haven't done so during setup - VBA is
not included in typical installation].. In the Project Explorer window to
the left (Ctrl-R), expand the "GlobalMacros (CorelDRAW10.gms)" node in the
tree and drill to "Thisdocument" item under "CorelDRAW 10 Objects".
Double-click on Thisdocument and a code editor window will open. At the end
of the code editor paste the following code:

Sub ChangeDocumentScale()
Dim s As Shape
ActiveDocument.WorldScale = 10
For Each s In ActivePage.Shapes.All
If s.Type = cdrLinearDimensionShape Then
End If
Next s
End Sub

Then click on Save button on the toolbar and return to CorelDRAW. Add a new page and copy your objects with dimensions on it. Run the macro and it will set the document scale to 1:10 and then separate all dimension lines (To run a macro use Tools>Visual Basic>Play... menu command. For the instructions on how to run a macro, read this:

You can duplicate this macro (don't forget to rename it - change
"ChangeDocumentScale" to something like "ChangeDocumentScale2") and replace the number assigned to ActiveDocument.WorldScale. If you want scales like 5:1, then you need to use fraction numbers (1/5 = 0.2).

You can add buttons to the macros on a toolbar and have the scale set to
specific values with one click...

I hope this helps.

Reply With Quote
Old 06-07-2006, 07:06
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

   With Application.FrameWork.MainMenu.Controls
      .Item(1).Caption = "World: "+CStr(ActiveDocument.WorldScale)
   End With
this will show world scale in place of "File" in main menu (replace 1 with any number less than main menu items count). Add these lines to all of your macros (before EndSub)
In order not to replace any of standard items I suppose you can add your custom item to main menu and change item number in code accordingly

ChangeDocumentScale code will run faster if coded this way:
Sub ChangeDocumentScale() 
Dim s As Shape 
ActiveDocument.WorldScale = 10 
For Each s In activepage.FindShapes(,cdrLinearDimensionShape)
Next s 
End Sub

Last edited by wOxxOm; 06-07-2006 at 09:44.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reset the Scale Factor to 100% Hernán CorelDRAW/Corel DESIGNER VBA 18 12-05-2010 23:48
Scale a group with text frame daniello Macros/Add-ons 3 21-03-2006 14:54
[DrawX3 bug] interface display of fractional angle/size wOxxOm General 0 18-02-2006 14:00
CDR12 Scale Factor Ruffus General 3 17-11-2005 19:16
Apply Outline - Scale with Image geopig CorelDRAW/Corel DESIGNER VBA 4 06-05-2004 07:23

All times are GMT -5. The time now is 17:30.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com