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 17-03-2008, 12:32
Rick Randall
Guest
 
Posts: n/a
Unhappy Optimization Vs. EventsEnabled ???

What's the difference between "EventsEnabled = false" and "Optimization = True"?

Thanks!
Reply With Quote
  #2  
Old 17-03-2008, 13:23
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

  • EventsEnabled=false - disables all custom document/shape modification code hooked up in ThisMacroStorage
  • Optimization=True - IMO disables UI updates, esp. some dockers like ObjectManager, BUT NOT ALL, see the link in the end of the message
  • ActiveDocument.PreserveSelection=false - disables redrawing of actively selected shapes handles
  • ActiveDocument.BeginCommandGroup / EndCommandGroup - to have just one undo list entry to undo all the multiple modifications

These optimizations are the must for any shape modifications intensive code, just don't forget to match them with corresponding alternatives - especially take care of premature exits in code, also in case of unexpected errors - handle them with either on error goto <ErrHandler> or on error resume next and analysis of err.number, because if the macro will be stopped without closing of ...UndoGroup or Optimizations you won't be able to work with document unless you issue the commands to cancel optimizations manually in e.g. ImmediateWindow (in case of VBA)

Take a look at this post about speeding up macros 10 times :-)
Reply With Quote
  #3  
Old 18-03-2008, 12:59
Rick Randall
Guest
 
Posts: n/a
Cool stuck on crazy macro

I've been playing with this crazy macro for creating part numbers and leader lines that will point to parts on technical illustrations. I think its about 80%there but there are some pretty serious issues probably due to the fact that I have no formal training in VB so...

I'm sure there are quite a few ways that I might improve this thing.
I had to use some crazy math to get the leader lines to always point toward the center of the part numbers.

Take a peek! (see attachment)

Thanks,
Rick
Attached Files
File Type: zip Leaderama.zip (49.4 KB, 342 views)
Reply With Quote
  #4  
Old 18-03-2008, 13:06
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

I like the pic :-) but what are the problems actually?
Reply With Quote
  #5  
Old 18-03-2008, 14:19
Rick Randall
Guest
 
Posts: n/a
Talking issues...

Usage:
After an illustrator has drawn a bunch of parts on a page, the last step is to add the part numbers and little lines pointing to the parts. Today, this takes several steps.

My macro basically (when finished) will do this is two clicks. Click #1 is the place where the line points to. (i.e.: the edge of a drawn graphic of an auto part) Click #2 is where the line ends and the part number text is created.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Here are the Issues:
1) It behaves sluggishly on pages with a lot of shapes for some unknown reason
2) Click #1 sometimes selects the auto part vector graphic if of course you click over top of it. I want the macro to behave (when running) as though it cannot select any shapes even though you might click on one. Ideally it would be cool to have it snap to the edge of a part but still not select anything.
3) Sometimes click #2 actually selects the leader line itself. In general, I want nothing to ever be selected. I want it to be fast and smooth with no flickers, or flashing selection handles.

That's basically it!
Reply With Quote
  #6  
Old 18-03-2008, 15:03
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

pi is 3.1415926..., yours isn't, anyway here's a trick to convert from radians to degrees: Degree = CorelScriptTools.AngleConvert(2, 1, Radians)

I think there is nothing you could do about hiding selection handles in this case, keep trying though :-) This is due to the interactive nature of your macro, so either you have instant redraw with handles or slower redraw without them.

p.s. the only way to have such instant redraw as you need without object handles is to hack the dll code in memory IMO

Last edited by wOxxOm; 18-03-2008 at 15:06.
Reply With Quote
  #7  
Old 19-03-2008, 04:07
Gadget
Guest
 
Posts: n/a
Default

Would it help to change the way it works slightly?
- select an object
- click on a button that says "add Callout" {runs your script}
- type in value/callout info in a user form
- click where to position it

you can then disable all screen-refreshes and re-draws untill it's placed: should be quick and slick and eliminate the need to work out in the code what is selected with the first click.

{I've not opened the Zip, so you may already be doing this}
Reply With Quote
  #8  
Old 19-03-2008, 07:22
Rick Randall
Guest
 
Posts: n/a
Default angleConvert

I'm curious about your idea of using...
Degree = CorelScriptTools.AngleConvert(2, 1, Radians)

I'm thinking you mean in my "getAngle_A" module right?
I'm a little unclear where to apply this and what values to supply this function. (2, 1, Radians)?

//rick
Reply With Quote
  #9  
Old 19-03-2008, 07:25
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

instead of radians*180/pi
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing fontname Sebastian CorelDRAW/Corel DESIGNER VBA 30 26-07-2007 11:00
Optimization in CS fadimas CorelDRAW CS 0 08-05-2005 02:23


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


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