OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-11-2006, 09:59
mick classen
Guest
 
Posts: n/a
Default view and print current scale settings

Hello: I've read the correspondence with Drumart regarding display current
> scale. I think this is exactly what I need. What I want to do is:
>
> 1. have the current scale being used displayed in the drawing window
> 2. the ability to change the scale without leaving the drawing
> 3. the ability to print the scale using a macro
>
> It seems as if you have addressed those needs, but because I am new to this
> VBA thing I'm lost. Is there a .gms file that addresses these wants? You
> talk about adding lines to end of all of my macros? I'm not sure how this
> should be done and it doesn't make sense to me that they should be added to
> all of the macros.
>
> Anyway, I'm sure that you are very busy, I'd appreciate if you could atleast
>steer me in the right direction.
Reply With Quote
  #2  
Old 02-11-2006, 18:46
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Scale

OK here is a quick GMS to address all three you listed. I will also post the main code.

To address number one. Basically what it does is append the scale to the document caption. Should work most of the time, can not say everytime, depends on the event.

The ChangeScale just gives you an input box to input the new scale. (Warning, no error handling, just a simple example.)

And finally AddScaleToDocument will add the scale to each page in the current document, bottom right corner.

Hope it helps,

Shelby

Code:
Sub ScaleCaption()

Dim NewCaption As String

NewCaption = "CorelDRAW X3 - Scale: " & ActiveDocument.WorldScale
If AppWindow.Caption <> NewCaption Then AppWindow.Caption = NewCaption

End Sub
Sub ChangeScale()

Dim txtScale As String

txtScale = InputBox("Please Enter Scale: ", "Scale")

ActiveDocument.WorldScale = txtScale
ScaleCaption

End Sub

Sub AddScaleToDocument()

Dim p As Page

For Each p In ActiveDocument.Pages
    p.ActiveLayer.CreateArtisticText 0.25, 0.25, "Scale: " & ActiveDocument.WorldScale, cdrEnglishUS, , "Arial", 12, cdrTrue, cdrTrue, , cdrLeftAlignment
Next p

End Sub
Attached Files
File Type: gms Scale.gms (25.5 KB, 255 views)

Last edited by shelbym; 20-04-2010 at 00:16. Reason: updated GMS
Reply With Quote
  #3  
Old 02-11-2006, 21:18
mick classen
Guest
 
Posts: n/a
Default

Shelby: You're amazing. This is exactly what I needed and more. In fact the way you have the scalecaption and changescale set up ..... that is all I really need. It saves the scalecaption with the saved file so our vinyl techs have it right before their eyes....and we have it as we are designing.

If there was one improvement it would be to the addscaletodocument file. It works great, but doesn't appear to be auto updateable with scale changes. The scalecaption updates just fine.

I'm so proud of myself. I figured out how to move the addscaletodocument to the exact location I need it. Now if it automatically updated with scale changes........oh my!!!

Anyway, thanks again this is very much appreciated. All the best. Mick
Reply With Quote
  #4  
Old 02-11-2006, 21:40
mick classen
Guest
 
Posts: n/a
Default

Hi again Shelby: Everything is just fine, but the trouble with normal is you always want more. ChangeScale and ScaleCaption work perfectly. My question is: When I add dimension lines to my object, they don't update with scale changes.......this could cause a great deal of confusion if the artist forgot to manually update the dimension lines. I don't know if this opens up a big can of worms, but it would be nice if they auto updated if you changed the scale.

Thanks. Mick
Reply With Quote
  #5  
Old 03-11-2006, 09:45
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Update

Sorry I didn't have much time to work on this last night. Here is a little update. If it finds the scale already on the page it updates it. I have not had time to really test this but it should work. If I get some time I will get the dimension lines updated also....working on it when I can:
Code:
Sub ScaleCaption()

Dim NewCaption As String

NewCaption = "CorelDRAW X3 - Scale: " & ActiveDocument.WorldScale
If AppWindow.Caption <> NewCaption Then AppWindow.Caption = NewCaption

End Sub
Sub ChangeScale()

Dim txtScale As String
Dim sScale As Shape
Dim p As Page

txtScale = InputBox("Please Enter Scale: ", "Scale")

ActiveDocument.WorldScale = txtScale

For Each p In ActiveDocument.Pages
    If Not p.FindShape(Name:="Scale") Is Nothing Then
        Set sScale = p.FindShape(Name:="Scale")
        sScale.Text.Story = "Scale: " & ActiveDocument.WorldScale
    End If
Next p

ScaleCaption

End Sub

Sub AddScaleToDocument()

Dim p As Page
Dim sScale As Shape

For Each p In ActiveDocument.Pages
    If p.FindShape(Name:="Scale") Is Nothing Then
        Set sScale = p.ActiveLayer.CreateArtisticText(0.25, 0.25, "Scale: " & ActiveDocument.WorldScale, cdrEnglishUS, , "Arial", 12, cdrTrue, cdrTrue, , cdrLeftAlignment)
        sScale.Name = "Scale"
    Else
        Set sScale = p.FindShape(Name:="Scale")
        sScale.Text.Story = "Scale: " & ActiveDocument.WorldScale
    End If
Next p

End Sub
Best,

Shelby
Reply With Quote
  #6  
Old 03-11-2006, 10:04
mick classen
Guest
 
Posts: n/a
Default

Hi Shelby: My you're fast. After sleeping on this I realized I didn't try something last evening. I merely changed the scale and the dimension lines didn't update. But after thinking about it I thought that if I simply resized the object by dragging the handles it would probably update the lines............and that is exactly what it did. Magnificient.
Reply With Quote
  #7  
Old 04-11-2006, 14:01
mick classen
Guest
 
Posts: n/a
Default

Shelby: I've used your revised file that allows auto updates the displayed scale on the page. It works perfectly. Thank you so much. Our staff loves it. Mick
Reply With Quote
  #8  
Old 05-03-2010, 22:27
gorgo gorgo is offline
Senior Member
 
Join Date: Feb 2010
Posts: 169
Default

Hey Shelby, this is awesome! One little bug though...when I close a document (only one open) I get this error - Runtime error 91 Object variable or with block variable not set. Then this was highlighed
Code:
NewCaption = "CorelDRAW X4 - Scale: " & ActiveDocument.WorldScale
. Any idea?

-Greg
Reply With Quote
  #9  
Old 05-03-2010, 23:38
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default MyScale

Yea, guess I should test if there is an Open Document :-) O the little things. I have updated the GMS above, you should no longer get the error and it detects what version you have so it places it back in the title.

It is still not perfect, if I get some time I will see if I can polish it up a bit.

-Shelby
Reply With Quote
  #10  
Old 06-03-2010, 11:13
gorgo gorgo is offline
Senior Member
 
Join Date: Feb 2010
Posts: 169
Default

Great! Thanks for the update.

-Greg
Reply With Quote
Reply


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


All times are GMT -5. The time now is 04:15.


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