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 05-04-2007, 20:11
nachomama
Guest
 
Posts: n/a
Thumbs up Placeholder for Images

Hello all,

I have been through the forum and did not see this particular issue adressed.

Although new to this forum I am aware of procedures one must go through in forums for answers. Unfortunately this project does not give me the time to accomplish this myself and vba is completely alien to me.

I am a laser operator at the company I work for and I won't be able to get a budget for this. However, I can offer laser cutting/engraving goods/services in trade for help on this and I hope this request is not breaking any rules.

Here is what I need:

A script when executed displays thumbnails of vect/rast images based on a (browse to button)folder selected.

I need to then have the ability to select an image and have that image Duplicated into "dummy boxes" on the current document.
*The image must scale to fit the dummy box.
*I will name the boxes on master pages ex. dummy01,dummy02...etc
*A master page can consist of 1 to unlimited dummies (or say 100 if a limit is needed)

The next step is to insert text for up to 3 lines of engraving using the same logic as above.
Example
txt1dummy01,txt1dummy02,...etc
txt2dummy01,txt2dummy02,...etc
txt3dummy01,txt3dummy02,...etc
*Font selector w/ Bold Ital Und
*Scale to dummies
*A master page may contain 0,1,2 or three lines per Image dummy

Please let me know if this post is ok and if it is likely/not to find help this way.


Thanks in advance,
Valerie
A.K.A
nachomama
Reply With Quote
  #2  
Old 06-04-2007, 09:58
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

It might be helpful if you could post an image of what you are trying to achieve. It certainly sounds like it can be done, but what are your time constraints?
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #3  
Old 08-04-2007, 20:22
nachomama
Guest
 
Posts: n/a
Default

Thanks for the reply... I have attached a cdr file that has a typical set up for what I am doing.

On the stage you will see elipses(elipsi? who knows ). I use them to cut holes in acrylic for hardware (standoffs) used in creating a Jig.

You will also see the boxes I currently use to align the atwork and a vector image aligned to each box.

To the left (off-stage) there are just a few examples of the type of artwork being used that are organized into seperate directories and come in cdr, bmp, wmf, jpg and eps files.

The example file is one of whats planned to be many Jigs for exact positioning of various parts to be engraved in the laser. Also the engraving area differs from part to part. So as you can see, the problem I am facing is that I would have to create a file for each individual peice of art and manually position them on multiple templates. It will be a nightmare if I have to create say 25 jigs with 100 art, text and engraving area variations (and that's just for 1 client).

I have to assume that a script like the one I described in my original post is something that many of the forum users and visitors could use. If so please chime in y'all, engravers especially.

In the example.cdr there is a vb userform which is a mock up of a ui. It's not meant to be exact but could be a start.

As for time constraints? Well, I am plugging away at trying to keep up with client requests but everday that passes I am falling further behind. It won't be very long before we start to lose clients because we take too much time to produce. You'd be saving my you know what if you could help.

Thanks again,
nachomama
Reply With Quote
  #4  
Old 08-04-2007, 20:24
nachomama
Guest
 
Posts: n/a
Default

Oops, forgot the attachment...here goes.
Attached Files
File Type: cdr example.cdr (36.2 KB, 431 views)
Reply With Quote
  #5  
Old 09-04-2007, 03:14
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 Everything is Possible

Sure this is possible, I don't have a lot of time but here is a simple and very quick starter for you. To make it work you need to name your dummies "PlaceHolder" It will find all of them on the page and copy and scale the selected object to them.
Code:
Sub QuickExample()
    Dim s As Shape
    Dim sPlaceHolder As Shape
    Dim sPlaceHolderDuplicate As Shape
    Dim srPlaceHolders As ShapeRange
    Dim w As Double, h As Double
    Dim x As Double, y As Double
    
    Set s = ActiveShape
        If s Is Nothing Then
            MsgBox "Nothing is selected."
        Else
            Set srPlaceHolders = ActivePage.FindShapes(Name:="PlaceHolder")
            If srPlaceHolders.Count <> 0 Then
                For Each sPlaceHolder In srPlaceHolders
                    sPlaceHolder.GetSize w, h
                    sPlaceHolder.GetPosition x, y
                    Set sPlaceHolderDuplicate = s.Duplicate()
                    sPlaceHolderDuplicate.SetSize w, h
                    sPlaceHolderDuplicate.SetPosition x, y
                Next sPlaceHolder
            Else
                MsgBox "There are no Place Holders on the current page"
            End If
        End If
End Sub
Hope it gets you started,

Shelby
Reply With Quote
  #6  
Old 09-04-2007, 09:16
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Shelby,

Just a little tiny mini comment about your code. Rather than using two calls to GetSize and GetPosition you should just call GetBoundingBox. And then when you call SetSize/SetPosition, just call SetBoundingBox instead. Additionally, SetBoundingBox allows you to specify how you want to scale the object to fit the rectangle (while keeping proportions or not, and where to place it - center, top, etc). Much more powerful this way...
Reply With Quote
  #7  
Old 09-04-2007, 21:25
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 SetBoundingBox

That is why you are the VBA Master Alex. Pretty darn cool, I don't think I have every used this. Very very nice that it will keep things proportional if you want. So here is the updated code based on Alex's suggestion, much cleaner and works much better.
Code:
Sub QuickExample()
    Dim s As Shape
    Dim sPlaceHolder As Shape
    Dim sPlaceHolderDuplicate As Shape
    Dim srPlaceHolders As ShapeRange
    Dim w As Double, h As Double
    Dim x As Double, y As Double
    
    Set s = ActiveShape
        If s Is Nothing Then
            MsgBox "Nothing is selected."
        Else
            Set srPlaceHolders = ActivePage.FindShapes(Name:="PlaceHolder")
            If srPlaceHolders.Count <> 0 Then
                For Each sPlaceHolder In srPlaceHolders
                    sPlaceHolder.GetBoundingBox x, y, w, h
                    Set sPlaceHolderDuplicate = s.Duplicate()
                    sPlaceHolderDuplicate.SetBoundingBox x, y, w, h, True, cdrCenter
                Next sPlaceHolder
            Else
                MsgBox "There are no Place Holders on the current page"
            End If
        End If
End Sub
Thanks again Alex, that was a GREAT tip!

Shelby
Reply With Quote
  #8  
Old 10-04-2007, 20:07
nachomama
Guest
 
Posts: n/a
Default

Thanks for the input everyone. I see that the ppl who answered this post account for most of the contributions to others here. I'm sure its thankless sometimes but If you havent heard it today... thanks for being here. I was looking for a quick solution but it looks like I'm gonna have to dig in and learn more stuff. Not thrilled but willing .

I see how this code will work and I'm certain I can implement it. However, can you point me to an example or is it even possible to have an editable region or staging area in a vba form that references say the master dummy box? Then add images and multiple lines of text to this staging area and use the GetBoundingBox code to propogate the dummies?

Kind of like a label making app except for the ability to layout the label instances however I want.

I saw where Alex uses a preview window that references objects on the main document (although this would be the reverse) and I also saw where he used vba to format text with a preview area on the form, so I think the elements may be there.

If you will be so kind as to point to reference for the elements required, I will attempt to combine them into what I'm looking for.

Thanks,
nachomama
Reply With Quote
  #9  
Old 11-04-2007, 14:01
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

In case of the live previews in my macros, I used this rather old DLL: http://www.oberonplace.com/script/ui...ary2/index.htm

it can create a bitmap in memory, do all the painting and the save the bitmap to a temporary .bmp file, and load it into the VBA form's image control.

There is a post with some VBA function declaration for SCPRTL20.DLL:

http://forum.oberonplace.com/showthread.php?t=673

I hope this is useful.
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 05:25.


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